Search in sources :

Example 1 with InvalidFeatureDefinitionException

use of com.ibm.j9tools.om.InvalidFeatureDefinitionException in project openj9 by eclipse.

the class FeatureParser method parse.

/**
 * Parse passed input stream. Expects well formed XML adhering to the specified
 * schema. This method should not be called directly but rather via the FeatureIO.load
 * method.
 *
 * @param 	input		InputStream containing build spec XML to be parsed
 * @return	initialized instance of a Feature
 *
 * @throws 			InvalidFeatureDefinitionException
 */
public FeatureDefinition parse(InputStream input, String objectId, FlagDefinitions flagDefinitions) throws InvalidFeatureDefinitionException, IOException {
    this.flagDefinitions = flagDefinitions;
    this._feature = new FeatureDefinition();
    try {
        _parser.getXMLReader().parse(new InputSource(input));
    } catch (SAXException e) {
        // $NON-NLS-1$ //$NON-NLS-2$
        error(new SAXParseException(e.getMessage(), "", "", 0, 0));
    } finally {
        if (hasErrors() || hasWarnings()) {
            throw new InvalidFeatureDefinitionException(getErrors(), getWarnings(), objectId);
        }
    }
    return _feature;
}
Also used : InvalidFeatureDefinitionException(com.ibm.j9tools.om.InvalidFeatureDefinitionException) InputSource(org.xml.sax.InputSource) SAXParseException(org.xml.sax.SAXParseException) FeatureDefinition(com.ibm.j9tools.om.FeatureDefinition) SAXException(org.xml.sax.SAXException)

Aggregations

FeatureDefinition (com.ibm.j9tools.om.FeatureDefinition)1 InvalidFeatureDefinitionException (com.ibm.j9tools.om.InvalidFeatureDefinitionException)1 InputSource (org.xml.sax.InputSource)1 SAXException (org.xml.sax.SAXException)1 SAXParseException (org.xml.sax.SAXParseException)1