private boolean primeNextFile() { try { if(curPathIter.hasNext() || (primeNextPath() && curPathIter.hasNext())) { currentFile = curPathIter.next(); currentFilename = currentFile.getAbsolutePath(); if(PRINT_FILENAMES) log.info(currentFile); if (tr != null) { tr.close(); } tr = treeReaderFactory().newTreeReader(IOUtils.readerFromFile(currentFile, encoding())); curLineId = 1; return true; } } catch (UnsupportedEncodingException e) { System.err.printf("%s: Filesystem does not support encoding:%n%s%n", this.getClass().getName(), e.toString()); throw new RuntimeException(e); } catch (FileNotFoundException e) { System.err.printf("%s: File does not exist:%n%s%n", this.getClass().getName(),e.toString()); throw new RuntimeException(e); } catch (IOException e) { System.err.printf("%s: Unable to close open tree reader:%n%s%n", this.getClass().getName(),currentFile.getPath()); throw new RuntimeException(e); } return false; }
public void compress(String imagePath, CompressListener listener) { if (config.isEnablePixelCompress()) { try { compressImageByPixel(imagePath, listener); } catch (FileNotFoundException e) { listener.onCompressFailed(imagePath, String.format("图片压缩失败,%s", e.toString())); e.printStackTrace(); } } else { compressImageByQuality(BitmapFactory.decodeFile(imagePath), imagePath, listener); } }
logger.warn(e.toString());
throw new IllegalStateException(message + '\n' + e.toString(), e); } catch (final StreamCorruptedException e) { final String message = I18N.getFormattedString("reponse_non_comprise", appUrls);
throw new HiveException(e.toString()); } catch (IOException e) { LOG.info("show indexes: " + stringifyException(e));
} catch ( FileNotFoundException fnfe ) { logError( BaseMessages.getString( PKG, "JoinRows.Log.UnableToOpenOutputstream" ) + data.file[data.filenr].toString() + "] : " + fnfe.toString() ); stopAll(); setErrors( 1 );
logger.warning(String.format( "The cacheserver status file could not be recreated due to the following exception: %s", e.toString())); loggedWarning = true;
private BufferedReader getReader(String solomonFile) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(solomonFile)); } catch (FileNotFoundException e1) { e1.printStackTrace(); logger.error(e1.toString()); System.exit(1); } return reader; }
} catch ( FileNotFoundException fnfe ) { logError( BaseMessages.getString( PKG, "JoinRows.Log.UnableToFindOrOpenTemporaryFile" ) + data.file[filenr] + "] : " + fnfe.toString() ); setErrors( 1 ); stopAll();
public void refresh() { File f = new File(MEMINFO_FILE); try (Scanner scanner = new Scanner(f,"UTF-8")) { parseFromScanner(scanner); } catch (FileNotFoundException ex) { throw new RuntimeException("File " + MEMINFO_FILE + " not found:" + ex.toString()); } }
protected String getFileSignature(File f) { String signature = ""; try { signature = getStreamSignature(new FileInputStream(f)); } catch (FileNotFoundException ex) { Log.e(LOG_TAG, ex.toString()); } return signature; }
protected String getFileSignature(File f) { String signature = ""; try { signature = getStreamSignature(new FileInputStream(f)); } catch (FileNotFoundException ex) { Log.e(LOG_TAG, ex.toString()); } return signature; }
private UptimeStats getUptimeAndCpuIdleTime() { UptimeStats uptime = new UptimeStats(0d, 0d); File f = new File(_uptimeFile); try (Scanner scanner = new Scanner(f,"UTF-8");) { String[] stats = scanner.useDelimiter("\\Z").next().split("\\s+"); uptime = new UptimeStats(Double.parseDouble(stats[0]), Double.parseDouble(stats[1])); } catch (FileNotFoundException ex) { s_logger.warn("File " + _uptimeFile + " not found:" + ex.toString()); } return uptime; }
Log.i(TAG,"FilNotFoundException, ex: " + fne.toString()); } catch(Exception ex) { Log.i(TAG,"Exception, ex: " + ex.toString());
System.out.println(e.toString());
public long getTemplateVirtualSize(String templatePath, String templateName) throws InternalErrorException { long virtualSize = 0; String templateFileFullPath = templatePath.endsWith(File.separator) ? templatePath : templatePath + File.separator; templateFileFullPath += templateName.endsWith(ImageFormat.VMDK.getFileExtension()) ? templateName : templateName + "." + ImageFormat.VMDK.getFileExtension(); try ( FileReader fileReader = new FileReader(templateFileFullPath); BufferedReader bufferedReader = new BufferedReader(fileReader); ) { Pattern regex = Pattern.compile("(RW|RDONLY|NOACCESS) (\\d+) (FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSDRM|VMFSRAW)"); String line = null; while((line = bufferedReader.readLine()) != null) { Matcher m = regex.matcher(line); if (m.find( )) { long sectors = Long.parseLong(m.group(2)); virtualSize = sectors * 512; break; } } } catch(FileNotFoundException ex) { String msg = "Unable to open file '" + templateFileFullPath + "' " + ex.toString(); s_logger.error(msg); throw new InternalErrorException(msg); } catch(IOException ex) { String msg = "Unable read open file '" + templateFileFullPath + "' " + ex.toString(); s_logger.error(msg); throw new InternalErrorException(msg); } s_logger.debug("vmdk file had size="+virtualSize); return virtualSize; }
private static Properties initProperties() { URL url = determineUrl(); Properties props = new Properties(); try { loadProperties(url, props); } catch (FileNotFoundException e) { // debug here and no stack trace, as this can happen normally if default jline.rc file is missing Log.debug("Unable to read configuration: ", e.toString()); } catch (IOException e) { Log.warn("Unable to read configuration from: ", url, e); } return props; }
Log.e(LOG_TAG, ex.toString());
} catch (final FileNotFoundException e) { s_logger.error("Failed to open " + snapshotDestPath + ". The error was: " + e.getMessage()); return new CopyCmdAnswer(e.toString()); } catch (final IOException e) { s_logger.error("Failed to create " + snapshotDestPath + ". The error was: " + e.getMessage());