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:gentracklets.conversions.java

public static double[] geo2radec(PVCoordinates obj, TopocentricFrame staF, Frame inertialFrame,
        AbsoluteDate epoch) {/*from w w  w.java 2 s .c o  m*/

    Vector3D rho = new Vector3D(0, 0, 0);

    try {
        rho = obj.getPosition().subtract(staF.getPVCoordinates(epoch, inertialFrame).getPosition());
    } catch (OrekitException ex) {
        Logger.getLogger(conversions.class.getName()).log(Level.SEVERE, null, ex);
    }

    double rho_mag = rho.getNorm();
    double DEC = FastMath.asin(rho.getZ() / rho_mag);
    double cosRA = 0.0;
    double sinRA = 0.0;
    double RA = 0.0;

    Vector3D v_site = new Vector3D(0, 0, 0);
    try {
        v_site = staF.getPVCoordinates(epoch, inertialFrame).getVelocity();
    } catch (OrekitException ex) {
        Logger.getLogger(conversions.class.getName()).log(Level.SEVERE, null, ex);
    }

    Vector3D rhoDot = obj.getVelocity().subtract(v_site);

    if (FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2)) != 0) {
        cosRA = rho.getX() / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));
        sinRA = rho.getY() / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));
        RA = FastMath.atan2(sinRA, cosRA);
        if (RA <= 0) {
            RA = RA + 2 * FastMath.PI;
        }
    } else {
        sinRA = rhoDot.getY() / FastMath.sqrt(FastMath.pow(rhoDot.getX(), 2) + FastMath.pow(rhoDot.getY(), 2));
        cosRA = rhoDot.getX() / FastMath.sqrt(FastMath.pow(rhoDot.getX(), 2) + FastMath.pow(rhoDot.getY(), 2));
        RA = FastMath.atan2(sinRA, cosRA);
        if (RA <= 0) {
            RA = RA + 2 * FastMath.PI;
        }
    }

    double rhoDot_mag = rho.dotProduct(rhoDot) / rho_mag;
    double RAdot = (rhoDot.getX() * rho.getY() - rhoDot.getY() * rho.getX())
            / (-1 * FastMath.pow(rho.getY(), 2) - FastMath.pow(rho.getX(), 2));
    double DECdot = (rhoDot.getZ() - rhoDot_mag * FastMath.sin(DEC))
            / FastMath.sqrt(FastMath.pow(rho.getX(), 2) + FastMath.pow(rho.getY(), 2));

    double[] out = { RA, RAdot, DEC, DECdot, rho_mag, rhoDot_mag };

    return out;
}

From source file:com.a544jh.kanamemory.io.JsonFileWriter.java

/**
 * Saves the PlayerProfile to a JSON-formatted file. If the file exists, the
 * profile is added to the existing JSON-mapping, if a profile with the same
 * name already exists in th file, it will be overwritten. If the files does
 * not exist, a new JSON-formatted file will be created.
 *
 * @param profile The PlayerProfile to be saved.
 * @param filename The file to save the data to. Can be a JSON-formatted
 * file created by this method, or an nonexistent file.
 *///www. j av a 2  s . c o  m
public static void saveProfile(PlayerProfile profile, String filename) {
    File file = new File(filename);
    JSONObject jo = null;

    //Create a new file if it doesn't exist
    if (!file.exists()) {
        try {
            file.createNewFile();
        } catch (IOException ex) {
            Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
        }
        //Create new empty JSONObject
        jo = new JSONObject();
    } else {
        //If the file exists
        try {
            //Read the JSONObject from the file
            jo = JsonFileReader.readFileToJsonObject(file);
        } catch (FileNotFoundException | JSONException ex) {
            Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    try {
        //Put the profile's scores to be saved in the JSONOBject with the name as key
        jo.put(profile.getName(), profile.getScoresMap());
        //Write the actual file
        try (FileWriter writer = new FileWriter(file)) {
            writer.write(jo.toString(4));
        }
    } catch (JSONException | IOException ex) {
        Logger.getLogger(JsonFileWriter.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:de.bluepair.sci.client.SHAUtils.java

public static MessageDigest getDigest() {
    try {//ww w  . ja  va 2  s .com
        return MessageDigest.getInstance("SHA-512");

    } catch (NoSuchAlgorithmException ex) {
        Logger.getLogger(FileAnalysis.class.getName()).log(Level.SEVERE, null, ex);
        // try rescue with sha
        try {
            return MessageDigest.getInstance("SHA");
        } catch (NoSuchAlgorithmException ex1) {
            Logger.getLogger(FileAnalysis.class.getName()).log(Level.SEVERE, null, ex1);
            return null;
        }
    }
}

From source file:com.mogotest.ci.TestRunFactory.java

public static void create(final String apiKey, final String testPlanId, final String source) {
    final HttpClient client = new HttpClient();
    final String url = String.format("https://mogotest.com/api/v1/test_plans/%s/tests.json", testPlanId);
    final PostMethod post = new PostMethod(url);

    try {/*w  w  w. java 2  s.  co m*/
        post.addParameter("user_credentials", apiKey);
        post.addParameter("source", source);
        client.executeMethod(post);
    } catch (final Exception e) {
        logger.log(Level.SEVERE, "Error creating Mogotest test run.", e);
    } finally {
        post.releaseConnection();
    }
}

From source file:edu.harvard.iq.dataverse.batch.util.LoggingUtil.java

public static void saveJsonLog(String jobJson, String logDir, String jobId) {
    try {//from w  ww. j  a  v  a  2s  .  co  m
        checkCreateLogDirectory(logDir);
        File dir = new File(logDir);
        if (!dir.exists() && !dir.mkdirs()) {
            logger.log(Level.SEVERE, "Couldn't create directory: " + dir.getAbsolutePath());
        }
        File reportJson = new File(dir.getAbsolutePath() + "/job-" + jobId + ".json");
        FileUtils.writeStringToFile(reportJson, jobJson);
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Error saving json report: " + e.getMessage());
    }
}

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

public static void disconnect() {

    if (!connected) {
        return;/*from w ww.  j  a  v  a  2 s  . co m*/
    }

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

    connected = false;

}

From source file:controller.file.FileUploader.java

public static void fileDownloader(HttpServletRequest request, HttpServletResponse response) {
    PrintWriter out = null;// w w w.  ja  v  a  2  s .co m
    try {
        String filename = "foo.xml";
        String filepath = "/tmp/";
        out = response.getWriter();
        response.setContentType("APPLICATION/OCTET-STREAM");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"");
        java.io.FileInputStream fileInputStream = new java.io.FileInputStream(filepath + filename);
        int i;
        while ((i = fileInputStream.read()) != -1) {
            out.write(i);
        }
        fileInputStream.close();
        out.close();
    } catch (IOException ex) {
        Logger.getLogger(FileUploader.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        out.close();
    }
}

From source file:de.scrubstudios.srvmon.notificator.classes.Crypt.java

public static String encrypt(String key, String data) {
    byte[] encryptedData = null;
    SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");

    try {/*from  w w w .  ja  va 2  s.c o m*/
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

        cipher.init(Cipher.ENCRYPT_MODE, keySpec);
        encryptedData = cipher.doFinal(data.getBytes());

        byte[] encr64 = Base64.encodeBase64(encryptedData);

        //System.out.println(new String(encr64));

        return new String(encr64);
    } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException
            | BadPaddingException ex) {
        Logger.getLogger(Crypt.class.getName()).log(Level.SEVERE, null, ex);
    }

    return null;
}

From source file:bridgempp.ConfigurationManager.java

public static void initializeConfiguration() {
    try {//from ww w  . j  a  v  a 2s  . com
        ShadowManager.log(Level.INFO, "Configuration files are being loaded...");
        serviceConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/config.xml");
        serviceConfiguration.setEncoding("UTF-8");
        groupConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/groups.xml");
        groupConfiguration.setEncoding("UTF-8");
        endpointConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/endpoints.xml");
        endpointConfiguration.setEncoding("UTF-8");
        permissionConfiguration = new XMLConfiguration(BridgeMPP.getPathLocation() + "/keys.xml");
        permissionConfiguration.setEncoding("UTF-8");
        ShadowManager.log(Level.INFO, "Configuration files have been loaded");
    } catch (ConfigurationException ex) {
        Logger.getLogger(ConfigurationManager.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.nuance.expertassistant.ContentExtractor.java

public static void startDocument(String Title, String Filepath) {
    try {/*w  w w  . j  a v  a 2s . c om*/
        writer = new PrintWriter(Filepath, "UTF-8");
        writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<document xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"\n"
                + "          xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n"
                + "          xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"\n"
                + "          xmlns:xdt=\"http://www.w3.org/2005/xpath-datatypes\"\n"
                + "          docid=\"a382247e\"\n" + "          title=\"" + Title + "\">");
    } catch (final FileNotFoundException ex) {
        Logger.getLogger(ContentExtractor.class.getName()).log(Level.SEVERE, null, ex);
    } catch (final UnsupportedEncodingException ex) {
        Logger.getLogger(ContentExtractor.class.getName()).log(Level.SEVERE, null, ex);
    }

}