static int parsePortNumber(String portStr) { try { return Integer.parseInt(portStr); } catch (java.lang.NumberFormatException e) { e.printStackTrace(); usage("Could not interpret port number [" + portStr + "]."); // we won't get here return -1; } }
private long extractContentLength(Map<String, String> header) { long size = 0x7FFFFFFFFFFFFFFFl; String contentLength = header.get("content-length"); if (contentLength != null) { try { size = Integer.parseInt(contentLength); } catch (NumberFormatException ex) { ex.printStackTrace(); } } return size; }
private void SaveInputPlayBuffer(String bufferText) { try { Integer intValue; intValue = Integer.valueOf(bufferText); playBuffer = intValue; Log.i(TAG, "Input play buffer:" + playBuffer); } catch (NumberFormatException e) { Log.i(TAG, "Input play buffer convert exception"); e.printStackTrace(); } }
private static int readAPIVersion (File parentFile) { File propertiesFile = new File(parentFile, "source.properties"); Properties properties; try { properties = readPropertiesFromFile(propertiesFile); String versionString = properties.getProperty("AndroidVersion.ApiLevel"); return Integer.parseInt(versionString); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (NumberFormatException e) { e.printStackTrace(); } return 0; }
private void SaveEchoCancelDelay(String delayText) { try { Integer intValue; intValue = Integer.valueOf(delayText); echoCancelDelay = intValue; Log.i(TAG, "Input echo cancel delay :" + echoCancelDelay); }catch(NumberFormatException e) { Log.i(TAG, "Input echo cancel delay convert exception"); e.printStackTrace(); } }
private void SavePlayInputPlayBuffer(String bufferText) { try { Integer intValue; intValue = Integer.valueOf(bufferText); playbackBuffer = intValue; Log.i(TAG, "Input play buffer:" + playbackBuffer); }catch(NumberFormatException e) { Log.i(TAG, "Input play buffer convert exception"); e.printStackTrace(); } }
public static int toInt(String value, int dEfault) { if(value != null) { String s = value.trim(); try { return Integer.valueOf(s).intValue(); } catch (NumberFormatException e) { LogLog.error("[" + s + "] is not in proper int form."); e.printStackTrace(); } } return dEfault; }
public int getNativeSize() { long highAddress = 0; long lowAddress = 0; try { highAddress = Long.parseLong(rangeEnd, 16); lowAddress = Long.parseLong(rangeStart, 16); } catch (NumberFormatException nfe) { nfe.printStackTrace(); // TODO log } return (int) (highAddress - lowAddress); }
public int getHttpPort() { String port = System.getProperty("httpPort"); if (port != null) { try { int newPort = Integer.parseInt(port); httpPort = newPort; } catch (NumberFormatException ex) { ex.printStackTrace(System.err); } } return httpPort; }
public int getNativeSize() { long highAddress = 0; long lowAddress = 0; try { highAddress = Long.parseLong(rangeEnd, 16); lowAddress = Long.parseLong(rangeStart, 16); } catch (NumberFormatException nfe) { nfe.printStackTrace(); // TODO log } return (int) (highAddress - lowAddress); }
public int getHttpsPort() { String port = System.getProperty("httpsPort"); if (port != null) { try { int newPort = Integer.parseInt(port); httpsPort = newPort; } catch (NumberFormatException ex) { ex.printStackTrace(System.err); } } return httpsPort; }
@Override public int compare(String str1, String str2) { try { Long num1 = Long.parseLong(str1); Long num2 = Long.parseLong(str2); return num1.compareTo(num2); } catch (NumberFormatException e) { logger.error("NumberFormatException when parse integer family number.str1:" + str1 + " str2:" + str2); e.printStackTrace(); return 0; } } };
static void init(String portStr, String configFile) { try { port = Integer.parseInt(portStr); } catch(java.lang.NumberFormatException e) { e.printStackTrace(); usage("Could not interpret port number ["+ portStr +"]."); } if(configFile.endsWith(".xml")) { DOMConfigurator.configure(configFile); } else { PropertyConfigurator.configure(configFile); } } }
@Override public int compare(Object lhs, Object rhs) { String lhsStr = lhs.toString(); String rhsStr = rhs.toString(); lhsStr = lhsStr.startsWith("0") ? lhsStr.substring(1) : lhsStr; rhsStr = rhsStr.startsWith("0") ? rhsStr.substring(1) : rhsStr; try { return Integer.parseInt(lhsStr) - Integer.parseInt(rhsStr); } catch (java.lang.NumberFormatException e) { e.printStackTrace(); return 0; } } });
private long getHeaderFieldLong(HttpURLConnection httpURLConnection, String name) { String field = httpURLConnection.getHeaderField(name); try { return null == field ? -1L : Long.parseLong(field); } catch (NumberFormatException e) { if (LogUtils.isDebug()) { e.printStackTrace(); } } return -1L; }
static void init(String portStr, String configFile, String dirStr) { try { port = Integer.parseInt(portStr); } catch(java.lang.NumberFormatException e) { e.printStackTrace(); usage("Could not interpret port number ["+ portStr +"]."); } PropertyConfigurator.configure(configFile); File dir = new File(dirStr); if(!dir.isDirectory()) { usage("["+dirStr+"] is not a directory."); } server = new SocketServer(dir); }
@Override public int compare(String o1, String o2) { try { Long l1 = Long.parseLong(o1); Long l2 = Long.parseLong(o2); return l1.compareTo(l2); } catch (NumberFormatException e) { e.printStackTrace(); return 0; } } });
@Override public int compare(String o1, String o2) { try { Long l1 = Long.parseLong(o1); Long l2 = Long.parseLong(o2); return l1.compareTo(l2); } catch (NumberFormatException e) { e.printStackTrace(); return 0; } } });
@Override public int compare(String o1, String o2) { try { Double d1 = Double.parseDouble(o1); Double d2 = Double.parseDouble(o2); return d1.compareTo(d2); } catch (NumberFormatException e) { e.printStackTrace(); return 0; } } });
@Override public int compare(String o1, String o2) { try { Double d1 = Double.parseDouble(o1); Double d2 = Double.parseDouble(o2); return d1.compareTo(d2); } catch (NumberFormatException e) { e.printStackTrace(); return 0; } } });