Example usage for java.util.logging Level SEVERE

List of usage examples for java.util.logging Level SEVERE

Introduction

In this page you can find the example usage for java.util.logging Level SEVERE.

Prototype

Level SEVERE

To view the source code for java.util.logging Level SEVERE.

Click Source Link

Document

SEVERE is a message level indicating a serious failure.

Usage

From source file:local.laer.app.newgenerator.TileBuilder.java

public static String json(Tile tile) {
    try {/*from w ww  .jav  a  2s  .com*/
        return new ObjectMapper().writeValueAsString(tile);
    } catch (JsonProcessingException ex) {
        Logger.getLogger(TileBuilder.class.getName()).log(Level.SEVERE, null, ex);
        throw new RuntimeException(ex);
    }
}

From source file:javaapplication1.RTFTester.java

public static void doStuff() {
    try {/*from  w  w w  .  ja  v  a2  s  . c  o m*/
        String content = IOUtils.toString(new FileInputStream("D:\\TemplateBuilder.rtf"));
        content = content.replaceAll("TAB_NUM", "9003");
        content = content.replaceAll("FULL_NAME", " ? ?");
        content = content.replaceAll("LOGIN", "NMoldabe");
        content = content.replaceAll("ACCEPT_DATE", "2015-09-21");
        IOUtils.write(content, new FileOutputStream("D:\\result.rtf"));

    } catch (FileNotFoundException ex) {
        Logger.getLogger(RTFTester.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(RTFTester.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:iracing.webapi.LicenseParser.java

public static List<License> parse(String json) {
    JSONParser parser = new JSONParser();
    List<License> output = null;
    try {/* www .j av  a  2s.co  m*/
        JSONArray root = (JSONArray) parser.parse(json);
        output = new ArrayList<License>();
        for (int i = 0; i < root.size(); i++) {
            JSONObject o = (JSONObject) root.get(i);
            License license = new License();
            license.setId(getInt(o, "id"));
            license.setShortName(getString(o, "shortname"));
            license.setFullName(getString(o, "name", true));
            output.add(license);
        }
    } catch (ParseException ex) {
        Logger.getLogger(LicenseParser.class.getName()).log(Level.SEVERE, null, ex);
    }
    return output;
}

From source file:controller.NewEntryTextControllerTest.java

@AfterClass
public static void tearDownClass() {
    File file = new File(System.getProperty("user.dir") + fSeparator + "MyDiaryBook" + fSeparator);
    try {//from   www .  j a va2  s  .c  o  m
        FileUtils.deleteDirectory(file);
    } catch (IOException ex) {
        Logger.getLogger(NewEntryTextControllerTest.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:connection.EmailSending.java

public static void sendTextEmail(String subject, String content, String recipientEmail) {
    Email email = new SimpleEmail();

    email.setHostName(MailInfor.HOST_NAME);
    email.setSmtpPort(465);/*  w  w  w .  ja  v  a 2  s .  c o m*/
    email.setAuthenticator(new DefaultAuthenticator(MailInfor.EMAIL_SENDER, MailInfor.PASSWORD));
    email.setSSLOnConnect(true);

    try {
        email.setFrom(MailInfor.EMAIL_SENDER);
        email.setSubject(subject);
        email.setMsg(content);
        email.addTo(recipientEmail);

        email.send();
    } catch (EmailException ex) {
        Logger.getLogger(EmailSending.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:csv.to.sql.parser.mainMenu.java

/**
 * @param args the command line arguments
 *//*w  w  w.  ja  v a2  s.  c  o  m*/
public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(mainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(mainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(mainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(mainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new mainMenu().setVisible(true);
        }
    });
}

From source file:com.willwinder.universalgcodesender.MainWindow.java

/**
 * @param args the command line arguments
 *///from  w w  w . j a  va2 s.  com
public static void main(String args[]) {

    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    }
    //</editor-fold>

    // Fix look and feel to use CMD+C/X/V/A instead of CTRL
    if (SystemUtils.IS_OS_MAC) {
        Collection<InputMap> ims = new ArrayList<>();
        ims.add((InputMap) UIManager.get("TextField.focusInputMap"));
        ims.add((InputMap) UIManager.get("TextArea.focusInputMap"));
        ims.add((InputMap) UIManager.get("EditorPane.focusInputMap"));
        ims.add((InputMap) UIManager.get("FormattedTextField.focusInputMap"));
        ims.add((InputMap) UIManager.get("PasswordField.focusInputMap"));
        ims.add((InputMap) UIManager.get("TextPane.focusInputMap"));

        int c = KeyEvent.VK_C;
        int v = KeyEvent.VK_V;
        int x = KeyEvent.VK_X;
        int a = KeyEvent.VK_A;
        int meta = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();

        for (InputMap im : ims) {
            im.put(KeyStroke.getKeyStroke(c, meta), DefaultEditorKit.copyAction);
            im.put(KeyStroke.getKeyStroke(v, meta), DefaultEditorKit.pasteAction);
            im.put(KeyStroke.getKeyStroke(x, meta), DefaultEditorKit.cutAction);
            im.put(KeyStroke.getKeyStroke(a, meta), DefaultEditorKit.selectAllAction);
        }
    }

    /* Create the form */
    GUIBackend backend = new GUIBackend();
    final MainWindow mw = new MainWindow(backend);

    /* Apply the settings to the MainWindow bofore showing it */
    mw.arrowMovementEnabled.setSelected(mw.settings.isManualModeEnabled());
    mw.stepSizeSpinner.setValue(mw.settings.getManualModeStepSize());
    boolean unitsAreMM = mw.settings.getDefaultUnits().equals("mm");
    mw.mmRadioButton.setSelected(unitsAreMM);
    mw.inchRadioButton.setSelected(!unitsAreMM);
    mw.fileChooser = new JFileChooser(mw.settings.getLastOpenedFilename());
    mw.commPortComboBox.setSelectedItem(mw.settings.getPort());
    mw.baudrateSelectionComboBox.setSelectedItem(mw.settings.getPortRate());
    mw.scrollWindowCheckBox.setSelected(mw.settings.isScrollWindowEnabled());
    mw.showVerboseOutputCheckBox.setSelected(mw.settings.isVerboseOutputEnabled());
    mw.showCommandTableCheckBox.setSelected(mw.settings.isCommandTableEnabled());
    mw.showCommandTableCheckBoxActionPerformed(null);
    mw.firmwareComboBox.setSelectedItem(mw.settings.getFirmwareVersion());

    mw.setSize(mw.settings.getMainWindowSettings().width, mw.settings.getMainWindowSettings().height);
    mw.setLocation(mw.settings.getMainWindowSettings().xLocation,
            mw.settings.getMainWindowSettings().yLocation);

    mw.addComponentListener(new ComponentListener() {
        @Override
        public void componentResized(ComponentEvent ce) {
            mw.settings.getMainWindowSettings().height = ce.getComponent().getSize().height;
            mw.settings.getMainWindowSettings().width = ce.getComponent().getSize().width;
        }

        @Override
        public void componentMoved(ComponentEvent ce) {
            mw.settings.getMainWindowSettings().xLocation = ce.getComponent().getLocation().x;
            mw.settings.getMainWindowSettings().yLocation = ce.getComponent().getLocation().y;
        }

        @Override
        public void componentShown(ComponentEvent ce) {
        }

        @Override
        public void componentHidden(ComponentEvent ce) {
        }
    });

    /* Display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            mw.setVisible(true);
        }
    });

    mw.initFileChooser();

    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
            if (mw.fileChooser.getSelectedFile() != null) {
                mw.settings.setLastOpenedFilename(mw.fileChooser.getSelectedFile().getAbsolutePath());
            }

            mw.settings.setDefaultUnits(mw.inchRadioButton.isSelected() ? "inch" : "mm");
            mw.settings.setManualModeStepSize(mw.getStepSize());
            mw.settings.setManualModeEnabled(mw.arrowMovementEnabled.isSelected());
            mw.settings.setPort(mw.commPortComboBox.getSelectedItem().toString());
            mw.settings.setPortRate(mw.baudrateSelectionComboBox.getSelectedItem().toString());
            mw.settings.setScrollWindowEnabled(mw.scrollWindowCheckBox.isSelected());
            mw.settings.setVerboseOutputEnabled(mw.showVerboseOutputCheckBox.isSelected());
            mw.settings.setCommandTableEnabled(mw.showCommandTableCheckBox.isSelected());
            mw.settings.setFirmwareVersion(mw.firmwareComboBox.getSelectedItem().toString());
            SettingsFactory.saveSettings(mw.settings);

            if (mw.pendantUI != null) {
                mw.pendantUI.stop();
            }
        }
    });

    // Check command line for a file to open.
    boolean open = false;
    for (String arg : args) {
        if (open) {
            try {
                backend.setGcodeFile(new File(arg));
            } catch (Exception ex) {
                Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex);
                System.exit(1);
            }
        }
        if (arg.equals("--open") || arg.equals("-o")) {
            open = true;
        }
    }
}

From source file:functional.testing.customerclient.util.ScreenCapturer.java

public static void takeAShot(WebDriver driver, String filename) {
    File passwordChecked = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    File failureImageFile = new File("target/" + filename);
    try {//from  w w w. java 2  s  .co  m
        FileUtils.moveFile(passwordChecked, failureImageFile);
    } catch (IOException ex) {
        Logger.getLogger(RegisterTest.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:it.cnr.ilc.tokenizer.utils.InputToString.java

/**
 * Convert an inputstream into a string/*from   w  ww .  j  a v  a2s .  com*/
 * @param is the inputstream
 * @return the string from the input
 */
public static String convertInputStreamToString(InputStream is) {
    StringWriter writer = new StringWriter();
    String encoding = "UTF-8";
    String message = "";
    String theString = "";
    try {
        IOUtils.copy(is, writer, encoding);
        theString = writer.toString();
    } catch (Exception e) {
        message = "IOException in coverting the stream into a string " + e.getMessage();
        Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, message);
    }

    //System.err.println("DDDD " + theString);
    IOUtils.closeQuietly(is);
    IOUtils.closeQuietly(writer);
    return theString;
}

From source file:com.croer.javaorange.util.Configuration.java

public static CompositeConfiguration getCONFIGURATION() {
    if (CONFIGURATION == null) {
        List lc = new ArrayList();
        try {//from   ww  w.  j  a  v a  2 s  .  c o m
            PropertiesConfiguration pc1 = new PropertiesConfiguration("prueba.properties");
            //                PropertiesConfiguration pc2 = new PropertiesConfiguration("mvc.properties");
            lc.add(pc1);
            //                lc.add(pc2);
        } catch (ConfigurationException ex) {
            Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex);
        }
        CONFIGURATION = new CompositeConfiguration(lc);
    }
    return CONFIGURATION;
}