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:com.eu.evaluation.web.controller.pojo.EvaluateVersionVO.java

public static EvaluateVersionVO cloneWith(EvaluateVersion ev) {
    EvaluateVersionVO vo = new EvaluateVersionVO();
    try {//  w ww.  j  a  v a2  s. com
        BeanUtils.copyProperties(vo, ev);
        vo.setTokens(new String[] { ev.getName() });
        vo.setValue(ev.getName());
    } catch (IllegalAccessException ex) {
        Logger.getLogger(EvaluateVersionVO.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InvocationTargetException ex) {
        Logger.getLogger(EvaluateVersionVO.class.getName()).log(Level.SEVERE, null, ex);
    }
    return vo;
}

From source file:com.mycompany.client.bank.utils.CryptMessage.java

public static List fromInternal(String SuperSecret, Object... criptStrings) {
    paramLst = new ArrayList<>();
    byte[] syperSecretBytes = null;
    try {//from  w  ww.  ja v a  2 s  .c  o  m
        syperSecretBytes = SuperSecret.getBytes("utf-8");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(CryptMessage.class.getName()).log(Level.SEVERE, null, ex);
    }
    int colvo = 0;
    for (Object str : criptStrings) {
        try {
            if (str != null) {
                byte[] mybyte = str.toString().getBytes("utf-8");
                int i = 0;
                ByteTransform(syperSecretBytes, mybyte, i);
                paramLst.add(colvo++, new String(mybyte, "utf-8"));
            } else {
                paramLst.add(colvo++, null);
            }
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(CryptMessage.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return paramLst;
}

From source file:bizlogic.Sensors.java

public static void list(Connection DBcon) throws IOException, ParseException, SQLException {

    Statement st = null;/*from  w w  w . j av a2 s .c  o m*/
    ResultSet rs = null;

    try {
        st = DBcon.createStatement();
        rs = st.executeQuery("SELECT * FROM USERCONF.SENSORLIST");

    } catch (SQLException ex) {
        Logger lgr = Logger.getLogger(Sensors.class.getName());
        lgr.log(Level.SEVERE, ex.getMessage(), ex);
    }
    try {
        FileWriter sensorsFile = new FileWriter("/var/lib/tomcat8/webapps/ROOT/Records/sensors.json");
        sensorsFile.write("");
        sensorsFile.flush();

        JSONParser parser = new JSONParser();

        JSONObject Records = new JSONObject();

        JSONObject operation_Obj = new JSONObject();
        JSONObject operand_Obj = new JSONObject();
        JSONObject unit_Obj = new JSONObject();
        JSONObject name_Obj = new JSONObject();
        JSONObject ip_Obj = new JSONObject();
        JSONObject port_Obj = new JSONObject();

        int _total = 0;

        JSONArray sensorList = new JSONArray();

        while (rs.next()) {

            JSONObject sensor_Obj = new JSONObject();
            int id = rs.getInt("sensor_id");
            String operation = rs.getString("operation");
            int operand = rs.getInt("operand");
            String unit = rs.getString("unit");
            String name = rs.getString("name");
            String ip = rs.getString("IP");
            int port = rs.getInt("port");

            sensor_Obj.put("recid", id);
            sensor_Obj.put("operation", operation);
            sensor_Obj.put("operand", operand);
            sensor_Obj.put("unit", unit);
            sensor_Obj.put("name", name);
            sensor_Obj.put("IP", ip);
            sensor_Obj.put("port", port);

            sensorList.add(sensor_Obj);
            _total++;

        }
        rs.close();

        Records.put("total", _total);
        Records.put("records", sensorList);

        sensorsFile.write(Records.toJSONString());
        sensorsFile.flush();
        sensorsFile.close();
    }

    catch (IOException ex) {
        Logger.getLogger(Sensors.class.getName()).log(Level.WARNING, null, ex);
    }
}

From source file:com.nunofacha.chestmaster.commands.ChestHashCommand.java

public static String getDigest(InputStream is, MessageDigest md, int byteArraySize) {

    try {//from   w  w w  . j  a v a  2s  .  c o m
        md.reset();
        byte[] bytes = new byte[byteArraySize];
        int numBytes;
        while ((numBytes = is.read(bytes)) != -1) {
            md.update(bytes, 0, numBytes);
        }
        byte[] digest = md.digest();
        String result = new String(Hex.encodeHex(digest));
        return result;
    } catch (IOException ex) {
        Logger.getLogger(ChestHashCommand.class.getName()).log(Level.SEVERE, null, ex);
    }
    return "Failed to get hash!";
}

From source file:com.google.oacurl.util.LoggingConfig.java

public static void init(boolean verbose) throws SecurityException, IOException {
    System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");

    Logger defaultLogger = Logger.getLogger("");
    if (verbose) {
        defaultLogger.setLevel(Level.INFO);
    } else {//from w  w w . j a  v a  2 s  . co  m
        defaultLogger.setLevel(Level.SEVERE);
    }
}

From source file:es.logongas.iothome.agent.ConfigLoader.java

public static Config getConfig(String fileName) {
    Config config;//  w  w w . java 2  s.  c  om
    InputStream inputStream = null;
    try {
        ObjectMapper objectMapper = new ObjectMapper();

        inputStream = new BufferedInputStream(new FileInputStream(fileName));
        config = (Config) objectMapper.readValue(inputStream, Config.class);

        return config;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    } finally {
        try {
            if (inputStream != null) {
                inputStream.close();
            }
        } catch (IOException ex) {
            Logger.getLogger(Storage.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

From source file:it.cnr.ilc.ilcioutils.IlcInputToString.java

/**
 * Convert an inputstream into a string/*from   w ww.j  av a2s.c om*/
 *
 * @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(CLASS_NAME).log(Level.SEVERE, message);
    }

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

From source file:deincraftlauncher.IO.download.FTPConnection.java

public static void connect() {

    if (connected) {
        return;/* w ww  .  j ava2s.co m*/
    }

    try {
        client.connect(FTPSync.getFtpServer());
        client.enterLocalPassiveMode();
        client.login(FTPSync.getFtpUsername(), FTPSync.getFtpPassword());
        client.setFileType(FTP.BINARY_FILE_TYPE);

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

    connected = true;
}

From source file:com.devdungeon.httpexamples.HttpGetExample.java

private static String get(String url) {
    HttpClient client = new DefaultHttpClient();

    HttpParams params = client.getParams();
    HttpConnectionParams.setConnectionTimeout(params, 1000 * 5);
    HttpConnectionParams.setSoTimeout(params, 1000 * 5);

    HttpGet request = new HttpGet(url);

    HttpResponse response = null;//from  ww w.j  a v a2s  . com
    try {
        response = client.execute(request);
    } catch (IOException ex) {
        Logger.getLogger(HttpGetExample.class.getName()).log(Level.SEVERE, null, ex);
    }
    BufferedReader rd;
    String html = "";
    String line = null;
    try {
        rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));

        while ((line = rd.readLine()) != null) {
            html += line + "\n";

        }
    } catch (IOException ex) {
        Logger.getLogger(HttpGetExample.class.getName()).log(Level.SEVERE, null, ex);
    } catch (UnsupportedOperationException ex) {
        Logger.getLogger(HttpGetExample.class.getName()).log(Level.SEVERE, null, ex);
    }
    return html;
}

From source file:com.cybernostics.jsp2thymeleaf.api.expressions.function.SymbolWriter.java

public static void write(Writer w, String s) {
    try {/*from   ww  w  .  j  av a2 s  .com*/
        w.write(symbolMap.getOrDefault(s, s));
    } catch (IOException ex) {
        Logger.getLogger(SymbolWriter.class.getName()).log(Level.SEVERE, null, ex);
    }
}