List of usage examples for java.io FileNotFoundException addSuppressed
public final synchronized void addSuppressed(Throwable exception)
From source file:org.apache.asterix.common.config.AsterixPropertiesAccessor.java
private AsterixConfiguration configure(String fileName) throws IOException, AsterixException { try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)) { if (is != null) { return configure(is, fileName); }//www . j a va2s .c o m } try (FileInputStream is = new FileInputStream(fileName)) { return configure(is, fileName); } catch (FileNotFoundException fnf1) { LOGGER.warn( "Failed to get configuration file " + fileName + " as FileInputStream. FileNotFoundException"); LOGGER.warn("Attempting to get default configuration file " + GlobalConfig.DEFAULT_CONFIG_FILE_NAME + " as FileInputStream"); try (FileInputStream fis = new FileInputStream(GlobalConfig.DEFAULT_CONFIG_FILE_NAME)) { return configure(fis, GlobalConfig.DEFAULT_CONFIG_FILE_NAME); } catch (FileNotFoundException fnf2) { fnf1.addSuppressed(fnf2); throw new AsterixException("Could not find configuration file " + fileName, fnf1); } } }