com.sun.istack.internal.SAXParseException2 Java Examples

The following examples show how to use com.sun.istack.internal.SAXParseException2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnmarshallingContext.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #2
Source File: SchemaCompilerImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #3
Source File: UnmarshallingContext.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #4
Source File: UnmarshallingContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #5
Source File: UnmarshallingContext.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #6
Source File: SchemaCompilerImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #7
Source File: UnmarshallingContext.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #8
Source File: SchemaCompilerImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #9
Source File: SchemaCompilerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #10
Source File: SchemaCompilerImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #11
Source File: UnmarshallingContext.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #12
Source File: UnmarshallingContext.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #13
Source File: UnmarshallingContext.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Reports an error to the user, and asks if s/he wants
 * to recover. If the canRecover flag is false, regardless
 * of the client instruction, an exception will be thrown.
 *
 * Only if the flag is true and the user wants to recover from an error,
 * the method returns normally.
 *
 * The thrown exception will be catched by the unmarshaller.
 */
public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException {
    ValidationEventHandler eventHandler = parent.getEventHandler();

    boolean recover = eventHandler.handleEvent(event);

    // if the handler says "abort", we will not return the object
    // from the unmarshaller.getResult()
    if(!recover)    aborted = true;

    if( !canRecover || !recover )
        throw new SAXParseException2( event.getMessage(), locator,
            new UnmarshalException(
                event.getMessage(),
                event.getLinkedException() ) );
}
 
Example #14
Source File: SchemaCompilerImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #15
Source File: SchemaCompilerImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void parseSchema( String systemId, Element element ) {
    checkAbsoluteness(systemId);
    try {
        DOMScanner scanner = new DOMScanner();

        // use a locator that sets the system ID correctly
        // so that we can resolve relative URLs in most of the case.
        // it still doesn't handle xml:base and XInclude and all those things
        // correctly. There's just no way to make all those things work with DOM!
        LocatorImpl loc = new LocatorImpl();
        loc.setSystemId(systemId);
        scanner.setLocator(loc);

        scanner.setContentHandler(getParserHandler(systemId));
        scanner.scan(element);
    } catch (SAXException e) {
        // since parsing DOM shouldn't cause a SAX exception
        // and our handler will never throw it, it's not clear
        // if this will ever happen.
        fatalError(new SAXParseException2(
            e.getMessage(), null, systemId,-1,-1, e));
    }
}
 
Example #16
Source File: Internalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void reportError(Element errorSource,
                         String formattedMsg, Exception nestedException) {

    SAXParseException e = new SAXParseException2(formattedMsg,
            forest.locatorTable.getStartLocation(errorSource),
            nestedException);
    errorReceiver.error(e);
}
 
Example #17
Source File: StAXSource.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void parse() throws SAXException {
    // parses from a StAX reader and generates SAX events which
    // go through the repeater and are forwarded to the appropriate
    // component
    try {
        reader.bridge();
    } catch( XMLStreamException e ) {
        // wrap it in a SAXException
        SAXParseException se =
            new SAXParseException2(
                e.getMessage(),
                null,
                null,
                e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
                e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
                e);

        // if the consumer sets an error handler, it is our responsibility
        // to notify it.
        if(errorHandler!=null)
            errorHandler.fatalError(se);

        // this is a fatal error. Even if the error handler
        // returns, we will abort anyway.
        throw se;

    } finally {
        try {
            staxReader.close();
        } catch(XMLStreamException xe) {
            //falls through. Not much can be done.
        }
    }
}
 
Example #18
Source File: Internalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void reportError( Element errorSource,
    String formattedMsg, Exception nestedException ) {

    SAXParseException e = new SAXParseException2( formattedMsg,
        forest.locatorTable.getStartLocation(errorSource),
        nestedException );
    errorHandler.error(e);
}
 
Example #19
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError( Element errorSource,
    String formattedMsg, Exception nestedException ) {

    SAXParseException e = new SAXParseException2( formattedMsg,
        forest.locatorTable.getStartLocation(errorSource),
        nestedException );
    errorHandler.error(e);
}
 
Example #20
Source File: SCDBasedBindingSet.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError( Element errorSource,
                          String formattedMsg, Exception nestedException ) {

    SAXParseException e = new SAXParseException2( formattedMsg,
        forest.locatorTable.getStartLocation(errorSource),
        nestedException );
    errorReceiver.error(e);
}
 
Example #21
Source File: SCDBasedBindingSet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void reportError( Element errorSource,
                          String formattedMsg, Exception nestedException ) {

    SAXParseException e = new SAXParseException2( formattedMsg,
        forest.locatorTable.getStartLocation(errorSource),
        nestedException );
    errorReceiver.error(e);
}
 
Example #22
Source File: WSDLModeler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void reportError(Entity entity,
    String formattedMsg, Exception nestedException ) {
    Locator locator = (entity == null)?null:entity.getLocator();

    SAXParseException e = new SAXParseException2( formattedMsg,
        locator,
        nestedException );
    errReceiver.error(e);
}
 
Example #23
Source File: StAXSource.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void parse() throws SAXException {
    // parses from a StAX reader and generates SAX events which
    // go through the repeater and are forwarded to the appropriate
    // component
    try {
        reader.bridge();
    } catch( XMLStreamException e ) {
        // wrap it in a SAXException
        SAXParseException se =
            new SAXParseException2(
                e.getMessage(),
                null,
                null,
                e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
                e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
                e);

        // if the consumer sets an error handler, it is our responsibility
        // to notify it.
        if(errorHandler!=null)
            errorHandler.fatalError(se);

        // this is a fatal error. Even if the error handler
        // returns, we will abort anyway.
        throw se;

    } finally {
        try {
            staxReader.close();
        } catch(XMLStreamException xe) {
            //falls through. Not much can be done.
        }
    }
}
 
Example #24
Source File: StAXSource.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void parse() throws SAXException {
    // parses from a StAX reader and generates SAX events which
    // go through the repeater and are forwarded to the appropriate
    // component
    try {
        reader.bridge();
    } catch( XMLStreamException e ) {
        // wrap it in a SAXException
        SAXParseException se =
            new SAXParseException2(
                e.getMessage(),
                null,
                null,
                e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
                e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
                e);

        // if the consumer sets an error handler, it is our responsibility
        // to notify it.
        if(errorHandler!=null)
            errorHandler.fatalError(se);

        // this is a fatal error. Even if the error handler
        // returns, we will abort anyway.
        throw se;

    } finally {
        try {
            staxReader.close();
        } catch(XMLStreamException xe) {
            //falls through. Not much can be done.
        }
    }
}
 
Example #25
Source File: Internalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError(Element errorSource,
                         String formattedMsg, Exception nestedException) {

    SAXParseException e = new SAXParseException2(formattedMsg,
            forest.locatorTable.getStartLocation(errorSource),
            nestedException);
    errorReceiver.error(e);
}
 
Example #26
Source File: Internalizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError(Element errorSource,
                         String formattedMsg, Exception nestedException) {

    SAXParseException e = new SAXParseException2(formattedMsg,
            forest.locatorTable.getStartLocation(errorSource),
            nestedException);
    errorReceiver.error(e);
}
 
Example #27
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError(Element errorSource,
                         String formattedMsg, Exception nestedException) {

    SAXParseException e = new SAXParseException2(formattedMsg,
            forest.locatorTable.getStartLocation(errorSource),
            nestedException);
    errorReceiver.error(e);
}
 
Example #28
Source File: StAXSource.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void parse() throws SAXException {
    // parses from a StAX reader and generates SAX events which
    // go through the repeater and are forwarded to the appropriate
    // component
    try {
        reader.bridge();
    } catch( XMLStreamException e ) {
        // wrap it in a SAXException
        SAXParseException se =
            new SAXParseException2(
                e.getMessage(),
                null,
                null,
                e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
                e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
                e);

        // if the consumer sets an error handler, it is our responsibility
        // to notify it.
        if(errorHandler!=null)
            errorHandler.fatalError(se);

        // this is a fatal error. Even if the error handler
        // returns, we will abort anyway.
        throw se;

    } finally {
        try {
            staxReader.close();
        } catch(XMLStreamException xe) {
            //falls through. Not much can be done.
        }
    }
}
 
Example #29
Source File: Internalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void reportError( Element errorSource,
    String formattedMsg, Exception nestedException ) {

    SAXParseException e = new SAXParseException2( formattedMsg,
        forest.locatorTable.getStartLocation(errorSource),
        nestedException );
    errorHandler.error(e);
}
 
Example #30
Source File: StAXSource.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void parse() throws SAXException {
    // parses from a StAX reader and generates SAX events which
    // go through the repeater and are forwarded to the appropriate
    // component
    try {
        reader.bridge();
    } catch( XMLStreamException e ) {
        // wrap it in a SAXException
        SAXParseException se =
            new SAXParseException2(
                e.getMessage(),
                null,
                null,
                e.getLocation() == null ? -1 : e.getLocation().getLineNumber(),
                e.getLocation() == null ? -1 : e.getLocation().getColumnNumber(),
                e);

        // if the consumer sets an error handler, it is our responsibility
        // to notify it.
        if(errorHandler!=null)
            errorHandler.fatalError(se);

        // this is a fatal error. Even if the error handler
        // returns, we will abort anyway.
        throw se;

    } finally {
        try {
            staxReader.close();
        } catch(XMLStreamException xe) {
            //falls through. Not much can be done.
        }
    }
}