/** * Creates a new configuration format exception. * <p> * {@link #UNKNOWN_LOCATION} is a legal value for both <code>line</code> and <code>column</code>. * See the documentation of {@link #getLineNumber() getLineNumber} and * {@link #getColumnNumber() getColumnNumber} for more information on location conventions. * </p> * @param message the error message. * @param line line at which the error occurred. * @param column column at which the error occurred. */ public ConfigurationFormatException(String message, int line, int column) { this(message); setLocationInformation(line, column); }
/** * Reads the content of <code>in</code> an passes build messages to <code>builder</code>. * @param in input stream from which to read the configuration data. * @param builder object to notify of build events. * @throws IOException if an I/O error occurs. * @throws ConfigurationFormatException if a configuration file format occurs. * @throws ConfigurationException if a non-specific error occurs. */ public void read(Reader in, ConfigurationBuilder builder) throws IOException, ConfigurationException, ConfigurationFormatException { this.builder = builder; locator = null; try {SAXParserFactory.newInstance().newSAXParser().parse(new InputSource(in), this);} catch(ParserConfigurationException e) {throw new ConfigurationException("Failed to create a SAX parser", e);} catch(SAXParseException e) {throw new ConfigurationFormatException(e.getMessage(), e.getLineNumber(), e.getColumnNumber());} catch(SAXException e) {throw new ConfigurationFormatException(e.getException() == null ? e : e.getException());} }
/** * Creates a new configuration format exception from an existing exception. * <p> * The existing exception will be embedded in the new one, but the new exception will have its own message. * </p> * <p> * {@link #UNKNOWN_LOCATION} is a legal value for both <code>line</code> and <code>column</code>. * See the documentation of {@link #getLineNumber() getLineNumber} and * {@link #getColumnNumber() getColumnNumber} for more information on location conventions. * </p> * @param message the detail message. * @param cause the exception to be wrapped in a <code>ConfigurationFormatException</code>. * @param line line at which the error occurred. * @param column column at which the error occurred. */ public ConfigurationFormatException(String message, Throwable cause, int line, int column) { this(message, cause); setLocationInformation(line, column); }
/** * Creates a new configuration format exception wrapping an existing exception. * <p> * The existing exception will be embedded in the new one, and its message will * become the default message for the <code>ConfigurationFormatException</code>. * </p> * <p> * {@link #UNKNOWN_LOCATION} is a legal value for both <code>line</code> and <code>column</code>. * See the documentation of {@link #getLineNumber() getLineNumber} and * {@link #getColumnNumber() getColumnNumber} for more information on location conventions. * </p> * @param cause the exception to be wrapped in a <code>ConfigurationFormatException</code>. * @param line line at which the error occurred. * @param column column at which the error occurred. */ public ConfigurationFormatException(Throwable cause, int line, int column) { this(cause); setLocationInformation(line, column); }