List of usage examples for java.util.logging Level SEVERE
Level SEVERE
To view the source code for java.util.logging Level SEVERE.
Click Source Link
From source file:controllers.FormsController.java
private static Properties getPropertyFile() { Properties properties = new Properties(); InputStream stream = Play.application().classloader().getResourceAsStream("forms_en.properties"); try {/* w w w .ja v a 2s .c o m*/ properties.load(stream); stream.close(); return properties; } catch (FileNotFoundException ex) { Logger.getLogger(FormsController.class.getName()).log(Level.SEVERE, null, ex); return null; } catch (IOException ex) { Logger.getLogger(FormsController.class.getName()).log(Level.SEVERE, null, ex); return null; } finally { try { stream.close(); } catch (IOException ex) { Logger.getLogger(FormsController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:it.cnr.ilc.ilcioutils.IlcInputToFile.java
/** * Creates a file with the content read from the URL * @param theUrl the URL where the content is * @return a File with the content from the URL *//*from ww w. ja v a 2s . c o m*/ public static File createAndWriteTempFileFromUrl(String theUrl) { File tempOutputFile = null; String message; try { tempOutputFile = File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX); FileUtils.copyURLToFile(new URL(theUrl), tempOutputFile); } catch (IOException e) { message = String.format("Error in accessing URL %s %s", theUrl, e.getMessage()); Logger.getLogger(CLASS_NAME).log(Level.SEVERE, message); } return tempOutputFile; }
From source file:com.credomatic.gprod.db2query2csv.Security.java
/** * Codifica a base 64 una cadena de caracteres. * @param value Cadena de caracteres que debe ser codificada en base 64 * @return la cadena codificada como un areglo de bytes. *///from ww w . j a v a2 s.co m public static byte[] encodeToBase64(final String value) { try { return Base64.encodeBase64(value.getBytes("ISO-8859-1")); } catch (UnsupportedEncodingException ex) { Logger.getLogger(Security.class.getName()).log(Level.SEVERE, null, ex); } return null; }
From source file:iracing.webapi.LicenseGroupParser.java
public static List<LicenseGroup> parse(String json) { JSONParser parser = new JSONParser(); List<LicenseGroup> output = null; try {/*from w w w .java 2s . c om*/ JSONArray rootArray = (JSONArray) parser.parse(json); output = new ArrayList<LicenseGroup>(); for (int i = 0; i < rootArray.size(); i++) { JSONObject r = (JSONObject) rootArray.get(i); LicenseGroup lg = new LicenseGroup(); lg.setId(getInt(r, "group")); lg.setName(getString(r, "name", true)); // NOTE: the following aren't specified if not applicable Object o = r.get("minNumTT"); if (o != null) lg.setMinimumNumberOfTimeTrials(((Long) o).intValue()); o = r.get("minNumRaces"); if (o != null) lg.setMinimumNumberOfRaces(((Long) o).intValue()); output.add(lg); } } catch (ParseException ex) { Logger.getLogger(LicenseGroupParser.class.getName()).log(Level.SEVERE, null, ex); } return output; }
From source file:com.dmrr.asistenciasx.Horarios.java
/** * @param args the command line arguments *//*from w ww.j a v a 2 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(Horarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Horarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Horarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Horarios.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Horarios().setVisible(true); } }); }
From source file:com.bluepandora.therap.donatelife.service.CheckService.java
public static boolean isMobileNumberTaken(String mobileNumber, DatabaseService dbService) { String query = GetQuery.mobileNumberUsedQuery(mobileNumber); ResultSet result = dbService.getResultSet(query); boolean mobileNumberRegistered = false; try {/* w w w . ja va 2 s.c om*/ while (result.next()) { mobileNumberRegistered = true; } } catch (SQLException error) { Logger.getLogger(CheckService.class.getName()).log(Level.SEVERE, null, error); } return mobileNumberRegistered; }
From source file:gentracklets.GenTracklets.java
public static void main(String[] args) throws OrekitException { // load the data files File data = new File("/home/zittersteijn/Documents/java/libraries/orekit-data.zip"); DataProvidersManager DM = DataProvidersManager.getInstance(); ZipJarCrawler crawler = new ZipJarCrawler(data); DM.clearProviders();//from w w w .j av a 2 s. c om DM.addProvider(crawler); // Read in TLE elements File tleFile = new File("/home/zittersteijn/Documents/TLEs/ASTRA20151207.tle"); FileReader TLEfr; Vector<TLE> tles = new Vector<>(); tles.setSize(30); try { // read and save TLEs to a vector TLEfr = new FileReader("/home/zittersteijn/Documents/TLEs/ASTRA20151207.tle"); BufferedReader readTLE = new BufferedReader(TLEfr); Scanner s = new Scanner(tleFile); String line1, line2; TLE2 tle = new TLE2(); int nrOfObj = 4; for (int ii = 1; ii < nrOfObj + 1; ii++) { System.out.println(ii); line1 = s.nextLine(); line2 = s.nextLine(); if (TLE.isFormatOK(line1, line2)) { tles.setElementAt(new TLE(line1, line2), ii); System.out.println(tles.get(ii).toString()); } else { System.out.println("format problem"); } } readTLE.close(); // define a groundstation Frame inertialFrame = FramesFactory.getEME2000(); TimeScale utc = TimeScalesFactory.getUTC(); double longitude = FastMath.toRadians(7.465); double latitude = FastMath.toRadians(46.87); double altitude = 950.; GeodeticPoint station = new GeodeticPoint(latitude, longitude, altitude); Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true); BodyShape earth = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, earthFrame); TopocentricFrame staF = new TopocentricFrame(earth, station, "station"); Vector<Orbit> eles = new Vector<>(); eles.setSize(tles.size()); for (int ii = 1; ii < nrOfObj + 1; ii++) { double a = FastMath.pow(Constants.WGS84_EARTH_MU / FastMath.pow(tles.get(ii).getMeanMotion(), 2), (1.0 / 3)); // convert them to orbits Orbit kep = new KeplerianOrbit(a, tles.get(ii).getE(), tles.get(ii).getI(), tles.get(ii).getPerigeeArgument(), tles.get(ii).getRaan(), tles.get(ii).getMeanAnomaly(), PositionAngle.MEAN, inertialFrame, tles.get(ii).getDate(), Constants.WGS84_EARTH_MU); eles.setElementAt(kep, ii); // set up propagators KeplerianPropagator kepler = new KeplerianPropagator(eles.get(ii)); System.out.println("a: " + a); // Initial state definition double mass = 1000.0; SpacecraftState initialState = new SpacecraftState(kep, mass); // Adaptive step integrator // with a minimum step of 0.001 and a maximum step of 1000 double minStep = 0.001; double maxstep = 1000.0; double positionTolerance = 10.0; OrbitType propagationType = OrbitType.KEPLERIAN; double[][] tolerances = NumericalPropagator.tolerances(positionTolerance, kep, propagationType); AdaptiveStepsizeIntegrator integrator = new DormandPrince853Integrator(minStep, maxstep, tolerances[0], tolerances[1]); NumericalPropagator propagator = new NumericalPropagator(integrator); propagator.setOrbitType(propagationType); // set up and add force models double AMR = 0.4; double crossSection = mass * AMR; double Cd = 0.01; double Cr = 0.5; double Co = 0.8; NormalizedSphericalHarmonicsProvider provider = GravityFieldFactory.getNormalizedProvider(4, 4); ForceModel holmesFeatherstone = new HolmesFeatherstoneAttractionModel( FramesFactory.getITRF(IERSConventions.IERS_2010, true), provider); SphericalSpacecraft ssc = new SphericalSpacecraft(crossSection, Cd, Cr, Co); PVCoordinatesProvider sun = CelestialBodyFactory.getSun(); SolarRadiationPressure srp = new SolarRadiationPressure(sun, Constants.WGS84_EARTH_EQUATORIAL_RADIUS, ssc); propagator.addForceModel(srp); propagator.addForceModel(holmesFeatherstone); propagator.setInitialState(initialState); // propagate the orbits with steps size and tracklet lenght at several epochs (tracklets) Vector<AbsoluteDate> startDates = new Vector<>(); startDates.setSize(3); startDates.setElementAt(new AbsoluteDate(2015, 12, 8, 20, 00, 00, utc), 0); startDates.setElementAt(new AbsoluteDate(2015, 12, 9, 21, 00, 00, utc), 1); startDates.setElementAt(new AbsoluteDate(2015, 12, 10, 22, 00, 00, utc), 2); double tstep = 30; int l = 7; for (int tt = 0; tt < startDates.size(); tt++) { // set up output file String app = "S_" + tles.get(ii).getSatelliteNumber() + "_" + startDates.get(tt) + ".txt"; // FileWriter trackletsOutKep = new FileWriter("/home/zittersteijn/Documents/tracklets/simulated/keplerian/ASTRA/dt1h/AMR040/" + app); // FileWriter trackletsOutPer = new FileWriter("/home/zittersteijn/Documents/tracklets/simulated/perturbed/ASTRA/dt1h/AMR040/" + app); // BufferedWriter trackletsKepBW = new BufferedWriter(trackletsOutKep); // BufferedWriter trackletsPerBW = new BufferedWriter(trackletsOutPer); // with formatted output File file1 = new File( "/home/zittersteijn/Documents/tracklets/simulated/keplerian/ASTRA/dt1d/AMR040/" + app); File file2 = new File( "/home/zittersteijn/Documents/tracklets/simulated/perturbed/ASTRA/dt1d/AMR040/" + app); file1.createNewFile(); file2.createNewFile(); Formatter fmt1 = new Formatter(file1); Formatter fmt2 = new Formatter(file2); for (int kk = 0; kk < l; kk++) { AbsoluteDate propDate = startDates.get(tt).shiftedBy(tstep * kk); SpacecraftState currentStateKep = kepler.propagate(propDate); SpacecraftState currentStatePer = propagator.propagate(propDate); System.out.println(currentStateKep.getPVCoordinates().getPosition() + "\t" + currentStateKep.getDate()); // convert to RADEC coordinates double[] radecKep = conversions.geo2radec(currentStateKep.getPVCoordinates(), staF, inertialFrame, propDate); double[] radecPer = conversions.geo2radec(currentStatePer.getPVCoordinates(), staF, inertialFrame, propDate); // write the tracklets to seperate files with the RA, DEC, epoch and fence given // System.out.println(tles.get(kk).getSatelliteNumber() + "\t" + radec[0] / (2 * FastMath.PI) * 180 + "\t" + currentState.getDate()); AbsoluteDate year = new AbsoluteDate(YEAR, utc); fmt1.format("%.12f %.12f %.12f %d%n", radecKep[0], radecKep[2], (currentStateKep.getDate().durationFrom(year) / (24 * 3600)), (tt + 1)); fmt2.format("%.12f %.12f %.12f %d%n", radecPer[0], radecPer[2], (currentStateKep.getDate().durationFrom(year) / (24 * 3600)), (tt + 1)); } fmt1.flush(); fmt1.close(); fmt2.flush(); fmt2.close(); } } } catch (FileNotFoundException ex) { Logger.getLogger(GenTracklets.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException iox) { Logger.getLogger(GenTracklets.class.getName()).log(Level.SEVERE, null, iox); } }
From source file:sandeep.kb.android.remote.utils.Utils.java
public static String readDataFromFile(String path) { String data = null;/*from w w w.j a va 2 s. co m*/ try { InputStream fileStream = Utils.class.getResourceAsStream(path); data = IOUtils.readFully(fileStream); } catch (IOException ex) { Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex); } return data; }
From source file:bizlogic.Records.java
public static void add(Connection DBcon, String sensor_name, String smpl_interval, String running, String name) throws SQLException { String isRunning;/*from w ww . j ava 2s . c o m*/ Statement st; ResultSet rs = null; try { st = DBcon.createStatement(); rs = st.executeQuery("SELECT * FROM USERCONF.SENSORLIST WHERE NAME = '" + sensor_name + "' "); } catch (SQLException ex) { Logger lgr = Logger.getLogger(Records.class.getName()); lgr.log(Level.SEVERE, ex.getMessage(), ex); } rs.next(); int id = rs.getInt("sensor_id"); String sql_statement; if (running.equals("true")) { isRunning = "B'1'"; } else { isRunning = "B'0'"; } st = DBcon.createStatement(); sql_statement = "INSERT INTO USERCONF.LOG_LIST(SENSOR_ID, SMPL_INTERVAL, RUNNING, NAME) " + "VALUES (" + id + ", " + smpl_interval + ", " + isRunning + ", " + "'" + name + "'" + " );"; System.out.println(sql_statement); st.clearBatch(); st = DBcon.createStatement(); DBcon.createStatement(); st.executeUpdate(sql_statement); }
From source file:emailworkshop.EmailWorkshop.java
public static void exe(ArrayList<Checkin> lista, String emailAutentica, String senhaAutentica, String emailRecebe, boolean enviaEmailParticipante) { if (emailAutentica.isEmpty() || senhaAutentica.isEmpty()) { System.exit(0);//from w ww .j a va 2s . c o m } FileWriter fw = null; try { fw = new FileWriter("relatorioDeEnvio.txt"); } catch (IOException ex) { Logger.getLogger(EmailWorkshop.class.getName()).log(Level.SEVERE, null, ex); } int numCert = 2217; for (Checkin c : lista) { //if ("https://drive.google.com/open?id=0B0LxgGB17-B3aGVNMThsTXpWV0E".equals(c.getQrCode())) { gerarPDF(c.getNome(), numCert); try { if (!emailRecebe.isEmpty()) { enviaEmailComAnexo(emailAutentica, senhaAutentica, emailRecebe, c.getNome()); System.out.println("certificado de " + c.getNome() + " gerado!"); try { fw.write("certificado de " + c.getNome() + " gerado!\n"); } catch (IOException ex) { Logger.getLogger(EmailWorkshop.class.getName()).log(Level.SEVERE, null, ex); } } if (enviaEmailParticipante) { System.out.println("envia email para " + c.getNome()); enviaEmailComAnexo(emailAutentica, senhaAutentica, c.getEmail(), c.getNome()); } //avisoDeEnvio(c.getNome()); } catch (EmailException ex) { Logger.getLogger(EmailWorkshop.class.getName()).log(Level.SEVERE, null, ex); } //} numCert = numCert + 1; } try { fw.close(); } catch (IOException ex) { Logger.getLogger(EmailWorkshop.class.getName()).log(Level.SEVERE, null, ex); } }