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:de.hsbremen.websocketChat.WebSocketSession.java

@Override
public void onMessage(String data) {
    JSONObject recv = new JSONObject(data);

    if (recv.has("disconnect")) {
        connection.close();//  w  w  w . j  ava  2 s .  c om
    } else {
        if (recv.has("status")) {
            try {
                connection.sendMessage((new JSONObject()).put("login", (user != null) ? "1" : "0").toString());
            } catch (IOException ex) {
                Logger.getLogger(WebSocketSession.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else if (user != null) {
            if (recv.has("changeUser")) {
                ServletWebSocket.msgs.add(
                        new Message(user.getName(), "change name to \"" + recv.getString("changeUser") + "\""));
                user.setName(recv.getString("changeUser"));
            } else if (recv.has("msg")) {
                ServletWebSocket.msgs.add(new Message(user.getName(), recv.getString("msg")));
                ServletWebSocket.onNotifyAll();
            }
        } else {
            if (recv.has("setUser")) {
                try {
                    user = new User(recv.getString("setUser"));
                    ServletWebSocket.msgs.add(new Message(user.getName(), "auto hallo"));
                    connection.sendMessage(sendCurrentMessages().put("login", "1").toString());
                } catch (IOException ex) {
                    Logger.getLogger(WebSocketSession.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }
}

From source file:br.com.great.gerenciamento.GerenciadorJogos.java

@Override
public void run() {
    while (!isInterrupted()) {

        try {/*  w w w.j a v  a 2 s .com*/
            //             enviarLocalizacao();
            Thread.sleep(5000);
        } catch (InterruptedException ex) {
            Logger.getLogger(GerenciadorJogos.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:loc.zenoss.util.DeviceFactory.java

private DeviceFactory() {
    try {//from w  w w  .  j a v a2  s.  c o m
        config = new PropertiesConfiguration("devices.properties");
    } catch (ConfigurationException ex) {
        Logger.getLogger(DeviceFactory.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:oobbit.database.ConnectionManager.java

/**
 * Connects to the Database described in the database properties file.
 */// w ww .  j ava 2  s  .c  o m
@PostConstruct
public void connect() {
    try {
        connection = DriverManager.getConnection(settings.getConnectorString());
    } catch (SQLException ex) {
        connection = null;
        Logger.getLogger(ConnectionManager.class.getName()).log(Level.SEVERE,
                "Unexpected SQLException occured.", ex);
        System.exit(1); // Force quit (TODO?)
    }
}

From source file:br.eb.ime.labprog3.tam.DefaultController.java

@RequestMapping(value = "index")
public String index(ModelMap map) {

    String fileName = "../../resources/xml/aeroportos.xml";
    Resource resource = null;/*from   w w  w  .j  a v a2s. c  o  m*/

    resource = new ClassPathResource(fileName);

    AeroportoDAO dao = null;
    try {
        dao = new AeroportoDAO(resource.getFile());
    } catch (IOException ex) {
        Logger.getLogger(DefaultController.class.getName()).log(Level.SEVERE, null, ex);
    }

    List<Aeroporto> listaDeAeroportos = null;

    if (dao != null) {
        listaDeAeroportos = dao.listarAeroportos();
        map.addAttribute("listaDeAeroportos", listaDeAeroportos);

    }

    return "index";
}

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

/**
 * Convert an inputstream into a string// ww w .  ja va  2s.  c o  m
 * @param theUrl the url to get the context from
 * @return the string from the input
 */
public static String convertInputStreamFromUrlToString(String theUrl) {
    StringWriter writer = new StringWriter();
    InputStream is = null;
    String encoding = "UTF-8";
    String message = "";
    String theString = "";
    try {
        is = new URL(theUrl).openStream();
        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:chat.com.client.ChatClient.java

/**
 * @param args the command line arguments
 *//* w  w w  .  ja  v a2  s.  c  om*/
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 ("Metal".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException ex) {
        java.util.logging.Logger.getLogger(ChatClient.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (InstantiationException ex) {
        java.util.logging.Logger.getLogger(ChatClient.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (IllegalAccessException ex) {
        java.util.logging.Logger.getLogger(ChatClient.class.getName()).log(java.util.logging.Level.SEVERE, null,
                ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
        java.util.logging.Logger.getLogger(ChatClient.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 ChatClient().setVisible(true);
        }
    });
}

From source file:com.boldust.math001.Math001Test.java

/**
 * Test of pow001 method, of class Math001.
 *//*from w ww.j a  v a 2  s  .com*/
@Test
public void testPow001() {
    System.out.println("pow001");
    Logger l = Logger.getLogger("powtest001");
    //        l.addHandler(new java.util.logging.ConsoleHandler());
    l.log(Level.SEVERE, "Powtest001");
    int base = 20;
    int exp = 5;
    BigInteger expResult = new BigInteger(Integer.valueOf(3200000).toString());
    BigInteger result1 = new BigInteger(Integer.valueOf(3200000).toString());
    BigInteger result = Math001.pow001(base, exp);
    System.out.println(expResult.equals(result));
    assertEquals(expResult, result);
    assertEquals(result1, result);
    // TODO review the generated test code and remove the default call to fail.
    //fail("The test case is a prototype.");
}

From source file:com.javabean.tools.FileHelper.java

public FileHelper(String relativeDirectoryPath, FileItem fileItem) {
    try {//  ww w .java 2s.c om
        this.internalName = SystemInfo.GetUniqueId();
    } catch (Exception ex) {
        Logger.getLogger(FileHelper.class.getName()).log(Level.SEVERE, null, ex);
    }
    this.relativeDirectoryPath = relativeDirectoryPath;
    this.fileItem = fileItem;
}

From source file:com.mewin.util.Utils.java

public static Map getConfig(Plugin plugin) {
    Yaml yaml = new Yaml();
    File configFile = new File(plugin.getDataFolder(), "config.yml");

    if (!configFile.exists()) {
        createDefaultConfig(plugin);/*w w  w .j a v  a  2  s.  co  m*/
    }
    try {
        FileReader reader = new FileReader(configFile);

        return (Map) yaml.load(reader);
    } catch (FileNotFoundException ex) {
        plugin.getLogger().log(Level.SEVERE, "Could not load plugin config file: ", ex);
        return (Map) yaml.load(plugin.getResource("/config.yml"));
    }
}