/** * Returns the error handler to be used when parsing configuration * documents. Subclasses can override this method to provide custom * error handling. * * @since Apache Jackrabbit 2.0 * @return error handler */ protected ErrorHandler getErrorHandler() { return new ConfigurationErrorHandler(); }
/** * This method is called when there is a warning parsing the configuration file. * The relevant information is written to the log file. */ public void warning(SAXParseException exception) throws SAXException { log("Warning", exception); }
/** * Returns the error handler to be used when parsing configuration * documents. Subclasses can override this method to provide custom * error handling. * * @since Apache Jackrabbit 2.0 * @return error handler */ protected ErrorHandler getErrorHandler() { return new ConfigurationErrorHandler(); }
/** * This method is called when there is an error parsing the configuration file. * The relevant information is written to the log file. */ public void error(SAXParseException exception) throws SAXException { log("Warning", exception); }
private static Element parseXML(InputSource xml, boolean validate) throws ConfigurationException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); DocumentBuilder builder = factory.newDocumentBuilder(); if (validate) { builder.setErrorHandler(new ConfigurationErrorHandler()); } builder.setEntityResolver(ConfigurationEntityResolver.INSTANCE); Document document = builder.parse(xml); return document.getDocumentElement(); } catch (ParserConfigurationException e) { throw new ConfigurationException("Unable to create configuration XML parser", e); } catch (SAXParseException e) { throw new ConfigurationException("Configuration file syntax error. (Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber() + ")", e); } catch (SAXException e) { throw new ConfigurationException("Configuration file syntax error. ", e); } catch (IOException e) { throw new ConfigurationException("Configuration file could not be read.", e); } }
/** * This method is called when there is a fatal error parsing the configuration file. * The relevant information is written to the log file. */ public void fatalError(SAXParseException exception) throws SAXException { log("Fatal error", exception); throw exception; }
private static Element parseXML(InputSource xml, boolean validate) throws ConfigurationException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); DocumentBuilder builder = factory.newDocumentBuilder(); if (validate) { builder.setErrorHandler(new ConfigurationErrorHandler()); } builder.setEntityResolver(ConfigurationEntityResolver.INSTANCE); Document document = builder.parse(xml); return document.getDocumentElement(); } catch (ParserConfigurationException e) { throw new ConfigurationException("Unable to create configuration XML parser", e); } catch (SAXParseException e) { throw new ConfigurationException("Configuration file syntax error. (Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber() + ")", e); } catch (SAXException e) { throw new ConfigurationException("Configuration file syntax error. ", e); } catch (IOException e) { throw new ConfigurationException("Configuration file could not be read.", e); } } }
/** * This method is called when there is an error parsing the configuration file. * The relevant information is written to the log file. */ public void error(SAXParseException exception) throws SAXException { log("Warning", exception); }
private static Element parseXML(InputSource xml, boolean validate) throws ConfigurationException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(validate); DocumentBuilder builder = factory.newDocumentBuilder(); if (validate) { builder.setErrorHandler(new ConfigurationErrorHandler()); } builder.setEntityResolver(ConfigurationEntityResolver.INSTANCE); Document document = builder.parse(xml); return document.getDocumentElement(); } catch (ParserConfigurationException e) { throw new ConfigurationException("Unable to create configuration XML parser", e); } catch (SAXParseException e) { throw new ConfigurationException("Configuration file syntax error. (Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber() + ")", e); } catch (SAXException e) { throw new ConfigurationException("Configuration file syntax error. ", e); } catch (IOException e) { throw new ConfigurationException("Configuration file could not be read.", e); } }
/** * This method is called when there is a fatal error parsing the configuration file. * The relevant information is written to the log file. */ public void fatalError(SAXParseException exception) throws SAXException { log("Fatal error", exception); throw exception; }
/** * This method is called when there is a warning parsing the configuration file. * The relevant information is written to the log file. */ public void warning(SAXParseException exception) throws SAXException { log("Warning", exception); }