private InputStream getInputStreamByFilePath(String pathToFile) { try { return new FileInputStream(pathToFile); } catch (IOException ioe) { optionalWarning("File [" + pathToFile + "] does not exist."); return null; } }
InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]"); return null; } }
/** * Opens the given URL, logging any exceptions * @param url URL of file/resource to open * @return an input stream to the URL; or {@code null} if the URL could not be opened */ private InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]", e); return null; } }
InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]"); return null; } }
InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]"); return null; } }
InputStream openURL(URL url) { try { return url.openStream(); } catch (IOException e) { optionalWarning("Failed to open [" + url.toString() + "]"); return null; } }
URL resourceAsURL(String resourceAttribute) { URL url = Loader.getResourceBySelfClassLoader(resourceAttribute); if (url == null) { optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]"); return null; } else return url; }
URL resourceAsURL(String resourceAttribute) { URL url = Loader.getResourceBySelfClassLoader(resourceAttribute); if (url == null) { optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]"); return null; } else return url; }
URL resourceAsURL(String resourceAttribute) { URL url = Loader.getResourceBySelfClassLoader(resourceAttribute); if (url == null) { optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]"); return null; } else return url; }
URL resourceAsURL(String resourceAttribute) { URL url = Loader.getResourceBySelfClassLoader(resourceAttribute); if (url == null) { optionalWarning("Could not find resource corresponding to [" + resourceAttribute + "]"); return null; } else return url; }
/** * Processes an include * @param ic context * @param url URL to file/resource being included */ @Override protected void processInclude(InterpretationContext ic, URL url) throws JoranException { InputStream in = openURL(url); try { if (in != null) { // add URL to watch list in case the "scan" flag is true, in // which case this URL is periodically checked for changes ConfigurationWatchListUtil.addToWatchList(getContext(), url); // parse the include SaxEventRecorder recorder = createRecorder(in, url); recorder.setContext(getContext()); recorder.recordEvents(in); // remove the leading/trailing tags (<included> or <configuration>) trimHeadAndTail(recorder); ic.getJoranInterpreter().getEventPlayer().addEventsDynamically(recorder.getSaxEventList(), this.eventOffset); } } catch (JoranException e) { optionalWarning("Failed processing [" + url.toString() + "]", e); } finally { close(in); } }