Search in sources :

Example 6 with ValidationEventImpl

use of javax.xml.bind.helpers.ValidationEventImpl in project OpenAM by OpenRock.

the class Util method handleTypeMismatchError.

/**
     * Reports that the type of an object in a property is unexpected.  
     */
public static void handleTypeMismatchError(XMLSerializer serializer, Object parentObject, String fieldName, Object childObject) throws AbortSerializationException {
    ValidationEvent ve = new ValidationEventImpl(// maybe it should be a fatal error.
    ValidationEvent.ERROR, Messages.format(Messages.ERR_TYPE_MISMATCH, getUserFriendlyTypeName(parentObject), fieldName, getUserFriendlyTypeName(childObject)), new ValidationEventLocatorExImpl(parentObject, fieldName));
    serializer.reportError(ve);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEvent(javax.xml.bind.ValidationEvent) ValidationEventLocatorExImpl(com.sun.xml.bind.util.ValidationEventLocatorExImpl)

Example 7 with ValidationEventImpl

use of javax.xml.bind.helpers.ValidationEventImpl in project OpenAM by OpenRock.

the class ErrorHandlerAdaptor method propagateEvent.

private void propagateEvent(int severity, SAXParseException saxException) throws SAXException {
    // get location info:
    //     sax locators simply use the location info embedded in the 
    //     sax exception, dom locators keep a reference to their DOMScanner
    //     and call back to figure out where the error occurred.
    ValidationEventLocator vel = locator.getLocation(saxException);
    ValidationEventImpl ve = new ValidationEventImpl(severity, saxException.getMessage(), vel);
    Exception e = saxException.getException();
    if (e != null) {
        ve.setLinkedException(e);
    } else {
        ve.setLinkedException(saxException);
    }
    // call the client's event handler.
    host.handleEvent(ve, severity != ValidationEvent.FATAL_ERROR);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEventLocator(javax.xml.bind.ValidationEventLocator) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Example 8 with ValidationEventImpl

use of javax.xml.bind.helpers.ValidationEventImpl in project OpenAM by OpenRock.

the class Util method handleTypeMismatchError.

/**
     * Reports that the type of an object in a property is unexpected.  
     */
public static void handleTypeMismatchError(XMLSerializer serializer, Object parentObject, String fieldName, Object childObject) throws AbortSerializationException {
    ValidationEvent ve = new ValidationEventImpl(// maybe it should be a fatal error.
    ValidationEvent.ERROR, Messages.format(Messages.ERR_TYPE_MISMATCH, getUserFriendlyTypeName(parentObject), fieldName, getUserFriendlyTypeName(childObject)), new ValidationEventLocatorExImpl(parentObject, fieldName));
    serializer.reportError(ve);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEvent(javax.xml.bind.ValidationEvent) ValidationEventLocatorExImpl(com.sun.xml.bind.util.ValidationEventLocatorExImpl)

Example 9 with ValidationEventImpl

use of javax.xml.bind.helpers.ValidationEventImpl in project OpenAM by OpenRock.

the class ErrorHandlerAdaptor method propagateEvent.

private void propagateEvent(int severity, SAXParseException saxException) throws SAXException {
    // get location info:
    //     sax locators simply use the location info embedded in the 
    //     sax exception, dom locators keep a reference to their DOMScanner
    //     and call back to figure out where the error occurred.
    ValidationEventLocator vel = locator.getLocation(saxException);
    ValidationEventImpl ve = new ValidationEventImpl(severity, saxException.getMessage(), vel);
    Exception e = saxException.getException();
    if (e != null) {
        ve.setLinkedException(e);
    } else {
        ve.setLinkedException(saxException);
    }
    // call the client's event handler.
    host.handleEvent(ve, severity != ValidationEvent.FATAL_ERROR);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEventLocator(javax.xml.bind.ValidationEventLocator) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException)

Example 10 with ValidationEventImpl

use of javax.xml.bind.helpers.ValidationEventImpl in project OpenAM by OpenRock.

the class Util method handleTypeMismatchError.

/**
     * Reports that the type of an object in a property is unexpected.  
     */
public static void handleTypeMismatchError(XMLSerializer serializer, Object parentObject, String fieldName, Object childObject) throws AbortSerializationException {
    ValidationEvent ve = new ValidationEventImpl(// maybe it should be a fatal error.
    ValidationEvent.ERROR, Messages.format(Messages.ERR_TYPE_MISMATCH, getUserFriendlyTypeName(parentObject), fieldName, getUserFriendlyTypeName(childObject)), new ValidationEventLocatorExImpl(parentObject, fieldName));
    serializer.reportError(ve);
}
Also used : ValidationEventImpl(javax.xml.bind.helpers.ValidationEventImpl) ValidationEvent(javax.xml.bind.ValidationEvent) ValidationEventLocatorExImpl(com.sun.xml.bind.util.ValidationEventLocatorExImpl)

Aggregations

ValidationEventImpl (javax.xml.bind.helpers.ValidationEventImpl)10 ValidationEventLocatorExImpl (com.sun.xml.bind.util.ValidationEventLocatorExImpl)5 ValidationEvent (javax.xml.bind.ValidationEvent)5 ValidationEventLocator (javax.xml.bind.ValidationEventLocator)5 SAXException (org.xml.sax.SAXException)5 SAXParseException (org.xml.sax.SAXParseException)5