List<SaxEvent> saxEventList = recorder.getSaxEventList(); if (saxEventList.size() == 0) { return;
/** * Configures logback with the configuration XML read from an input source. * * @param inputSource the input source, containing the configuration XML * @throws JoranException */ private final void doConfigure(final InputSource inputSource) throws JoranException { long threshold = System.currentTimeMillis(); // if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) { // informContextOfURLUsedForConfiguration(getContext(), null); // } SaxEventRecorder recorder = new SaxEventRecorder(context); recorder.recordEvents(inputSource); doConfigure(recorder.getSaxEventList()); // no exceptions a this level StatusUtil statusUtil = new StatusUtil(context); if (statusUtil.noXMLParsingErrorsOccurred(threshold)) { addInfo("Registering current configuration as safe fallback point"); registerSafeConfiguration(recorder.getSaxEventList()); } }
public List<SaxEvent> doTest(String filename) throws Exception { SaxEventRecorder recorder = new SaxEventRecorder(context); FileInputStream fis = new FileInputStream(CoreTestConstants.TEST_DIR_PREFIX + "input/joran/"+ filename); recorder.recordEvents(fis); return recorder.getSaxEventList(); }
/** * 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); } }