List of usage examples for java.lang NumberFormatException printStackTrace
public void printStackTrace()
From source file:com.honkidenihongo.pre.service.JilFirebaseMessagingService.java
/** * Called when message is received.//from ww w .ja v a2s .c o m * * @param remoteMessage Object representing the message received from Firebase Cloud Messaging. */ // [START receive_message] @Override public void onMessageReceived(RemoteMessage remoteMessage) { // [START_EXCLUDE] // There are two types of messages data messages and notification messages. Data messages are handled // here in onMessageReceived whether the app is in the foreground or background. Data messages are the type // traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app // is in the foreground. When the app is in the background an automatically generated notification is displayed. // When the user taps on the notification they are returned to the app. Messages containing both notification // and data payloads are treated as notification messages. The Firebase console always sends notification // messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options // [END_EXCLUDE] String title = ""; String message = ""; long teamId = -1; String teamName = ""; // TODO(developer): Handle FCM messages here. // Not getting messages here? See why this may be: https://goo.gl/39bRNJ Log.d(LOG_TAG, "From: " + remoteMessage.getFrom()); // Check if message contains a data payload. Map<String, String> data = remoteMessage.getData(); if (data != null && data.size() > 0) { Log.d(LOG_TAG, "Data: " + data); try { teamId = Long.parseLong(data.get("teamId")); } catch (NumberFormatException nfe) { nfe.printStackTrace(); } teamName = data.get("teamName"); } // Check if message contains a notification payload. RemoteMessage.Notification notification = remoteMessage.getNotification(); if (notification != null) { title = notification.getTitle(); Log.d(LOG_TAG, "Notification Title: " + title); message = notification.getBody(); Log.d(LOG_TAG, "Notification Message: " + message); } // Also if you intend on generating your own notifications as a result of a received FCM // message, here is where that should be initiated. See sendNotification method below. if (!isAppRunning(this)) { sendNotification(title, message, teamId, teamName); } }
From source file:org.kalypso.model.wspm.pdb.internal.connect.oracle.OracleSettings.java
int getPort() { try {/*from w ww.jav a 2s . c om*/ final String property = getProperty(PROPERTY_PORT); return Integer.valueOf(property); } catch (final NumberFormatException e) { e.printStackTrace(); return DEFAULT_PORT; } }
From source file:com.mac.hazewinkel.plist.util.PListXmlHandler.java
private int parseInteger(String value) { try {//from w ww.j ava 2 s .c om return Integer.parseInt(value); } catch (NumberFormatException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return 0; } }
From source file:com.mac.hazewinkel.plist.util.PListXmlHandler.java
private double parseFloat(String value) { try {/*from ww w . java2 s . c om*/ return Double.parseDouble(value); } catch (NumberFormatException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. return 0; } }
From source file:it.isislab.sof.core.engine.hadoop.sshclient.connection.SofManager.java
public static boolean sendMessage(EnvironmentSession session, Simulation simulation, Message m) { String mexID = getMexID();/*from w ww . jav a 2s . co m*/ String hdfs_mex_filename = fs.getHdfsUserPathSimulationInboxMessagesFileByID(simulation.getId(), mexID); String tmp_file = fs.getClientPathForTmpFile(); Message.convertMessageToXml(m, tmp_file); boolean toReturn = false; try { toReturn = HadoopFileSystemManager.copyFromClientToHdfs(session, tmp_file, hdfs_mex_filename); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSchException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SftpException e) { // TODO Auto-generated catch block e.printStackTrace(); } return toReturn; }
From source file:it.isislab.sof.core.engine.hadoop.sshclient.connection.SofManager.java
public static void setSimulationStatus(EnvironmentSession session, Simulation simulation, String status) { String hdfsSimXmlFile = fs.getHdfsUserPathSimulationXMLFile(simulation.getId()); String tmpsimXmlFile = fs.getClientPathForTmpFile(); try {//from www. j av a2 s .c o m simulation.setState(status); SimulationParser.convertSimulationToXML(simulation, tmpsimXmlFile); if (HadoopFileSystemManager.ifExists(session, hdfsSimXmlFile)) { if (HadoopFileSystemManager.removeFile(session, hdfsSimXmlFile)) log.info("Deleted " + hdfsSimXmlFile + " successfully"); } if (HadoopFileSystemManager.copyFromClientToHdfs(session, tmpsimXmlFile, hdfsSimXmlFile)) log.info("Copied " + hdfsSimXmlFile + " successfully"); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSchException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SftpException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.n52.geoar.codebase.resources.InfoResource.java
/** * Parses a single plugin descriptor file * //from w w w . j ava 2 s. com * @param inputStream * @return */ private static PluginDescriptor readPluginInfoFromDescriptorInputStream(InputStream inputStream) { try { Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream); // Find name String name = null; NodeList nodeList = document.getElementsByTagName("name"); if (nodeList != null && nodeList.getLength() >= 1) { name = nodeList.item(0).getTextContent(); } else { log.warn("Plugin Descriptor for does not specify a name"); } // Find publisher String publisher = null; nodeList = document.getElementsByTagName("publisher"); if (nodeList != null && nodeList.getLength() >= 1) { publisher = nodeList.item(0).getTextContent(); } else { log.warn("Plugin Descriptor for does not specify a publisher"); } // Find description String description = null; nodeList = document.getElementsByTagName("description"); if (nodeList != null && nodeList.getLength() >= 1) { description = nodeList.item(0).getTextContent(); } else { log.warn("Plugin Descriptor for does not specify a description"); } // Find identifier String identifier = null; nodeList = document.getElementsByTagName("identifier"); if (nodeList != null && nodeList.getLength() >= 1) { identifier = nodeList.item(0).getTextContent(); } else { log.warn("Plugin Descriptor for does not specify an identifier"); } // Find version Long version = null; nodeList = document.getElementsByTagName("version"); if (nodeList != null && nodeList.getLength() >= 1) { String versionString = "-" + nodeList.item(0).getTextContent(); Matcher matcher = PluginDescriptor.pluginVersionPattern.matcher(versionString); if (matcher.find() && matcher.group(1) != null) { try { version = PluginDescriptor.parseVersionNumber(matcher.group(1)); } catch (NumberFormatException e) { log.error("Plugin filename version invalid: " + matcher.group(1)); } } } else { log.warn("Plugin Descriptor for does not specify a version"); } if (identifier == null) { identifier = name; } return new PluginDescriptor(name, description, version, identifier, publisher); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ZipException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { inputStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; }
From source file:it.isislab.sof.core.engine.hadoop.sshclient.connection.SofManager.java
private static void setSimulationProcess(EnvironmentSession session, Simulation simulation, String cmd) { String hdfsSimXmlFile = fs.getHdfsUserPathSimulationXMLFile(simulation.getId()); String tmpsimXmlFile = fs.getClientPathForTmpFile(); try {/* ww w . j a v a 2s . c o m*/ if (HadoopFileSystemManager.copyFromHdfsToClient(session, hdfsSimXmlFile, tmpsimXmlFile)) log.info("Copied " + hdfsSimXmlFile + " successfully"); Simulation s = SimulationParser.convertXMLToSimulation(tmpsimXmlFile); cmd = cmd.substring(0, cmd.lastIndexOf("&") - 1); //remove & s.setProcessName(cmd); SimulationParser.convertSimulationToXML(s, tmpsimXmlFile); if (HadoopFileSystemManager.removeFile(session, hdfsSimXmlFile)) log.info("Deleted " + hdfsSimXmlFile + " successfully"); if (HadoopFileSystemManager.copyFromClientToHdfs(session, tmpsimXmlFile, hdfsSimXmlFile)) log.info("Copied " + hdfsSimXmlFile + " successfully"); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSchException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SftpException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:de.ipbhalle.metfrag.main.CommandLineTool.java
/** * /* w ww . j a v a 2s. c o m*/ * set a MutualDouble parameter * * @param value * @param isPositive * @param valueName * @param valueToSet * @return */ public static int setDoubleValue(String value, boolean isPositive, String valueName, MutualDouble valueToSet) { try { valueToSet.setValue(Double.parseDouble(value)); } catch (NumberFormatException e) { e.printStackTrace(); System.out.println("Error: " + value + " is not a correct value for " + valueName + "."); return 1; } if (isPositive && Double.parseDouble(value) < 0) { System.out.println("Error: The value of " + valueName + " is smaller than 0."); return 1; } return 0; }
From source file:dreamboxdataservice.DreamboxChannelHandler.java
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("e2event")) { try {/*from ww w . j a v a2s. co m*/ Calendar cal = Calendar.getInstance(); cal.setTime(new java.util.Date(Long.parseLong(mCurrentEvent.get("e2eventstart")) * 1000)); Date programDate = new Date(cal); MutableProgram prog = new MutableProgram(mChannel, programDate, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true); prog.setTitle(mCurrentEvent.get("e2eventtitle")); prog.setDescription(mCurrentEvent.get("e2eventdescriptionextended")); String shortDesc = mCurrentEvent.get("e2eventdescription"); if (shortDesc.equals(prog.getTitle())) { shortDesc = ""; } if (StringUtils.isEmpty(shortDesc)) { shortDesc = mCurrentEvent.get("e2eventdescriptionextended"); } shortDesc = MutableProgram.generateShortInfoFromDescription(shortDesc); prog.setShortInfo(shortDesc); prog.setLength(Integer.parseInt(mCurrentEvent.get("e2eventduration")) / 60); prog.setProgramLoadingIsComplete(); MutableChannelDayProgram mutDayProg = getMutableDayProgram(programDate); mutDayProg.addProgram(prog); } catch (NumberFormatException e) { e.printStackTrace(); } } else if (qName.equals("e2eventlist")) { storeDayPrograms(mUpdateManager); } else { mCurrentEvent.put(qName, mCharacters.toString()); } }