javax.xml.bind.helpers.ValidationEventLocatorImpl Java Examples

The following examples show how to use javax.xml.bind.helpers.ValidationEventLocatorImpl. 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: XMLSerializer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #2
Source File: StAXConnector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #3
Source File: XMLSerializer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #4
Source File: XMLSerializer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #5
Source File: StAXConnector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #6
Source File: XMLSerializer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #7
Source File: XMLSerializer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #8
Source File: StAXConnector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #9
Source File: XMLSerializer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #10
Source File: XMLSerializer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #11
Source File: StAXConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #12
Source File: XMLSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #13
Source File: XMLSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #14
Source File: StAXConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #15
Source File: XMLSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #16
Source File: XMLSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #17
Source File: XMLSerializer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #18
Source File: StAXConnector.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #19
Source File: XMLSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #20
Source File: XMLSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #21
Source File: XMLSerializer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public String onIDREF( Object obj ) throws SAXException {
    String id;
    try {
        id = getIdFromObject(obj);
    } catch (JAXBException e) {
        reportError(null,e);
        return null; // recover by returning null
    }
    idReferencedObjects.add(obj);
    if(id==null) {
        reportError( new NotIdentifiableEventImpl(
            ValidationEvent.ERROR,
            Messages.NOT_IDENTIFIABLE.format(),
            new ValidationEventLocatorImpl(obj) ) );
    }
    return id;
}
 
Example #22
Source File: XMLSerializer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void reconcileID() throws SAXException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);

    for( Object idObj : idReferencedObjects ) {
        try {
            String id = getIdFromObject(idObj);
            reportError( new NotIdentifiableEventImpl(
                ValidationEvent.ERROR,
                Messages.DANGLING_IDREF.format(id),
                new ValidationEventLocatorImpl(idObj) ) );
        } catch (JAXBException e) {
            // this error should have been reported already. just ignore here.
        }
    }

    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
 
Example #23
Source File: StAXConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #24
Source File: StAXConnector.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected final void handleStartDocument(NamespaceContext nsc) throws SAXException {
    visitor.startDocument(new LocatorEx() {
        public ValidationEventLocator getLocation() {
            return new ValidationEventLocatorImpl(this);
        }
        public int getColumnNumber() {
            return getCurrentLocation().getColumnNumber();
        }
        public int getLineNumber() {
            return getCurrentLocation().getLineNumber();
        }
        public String getPublicId() {
            return getCurrentLocation().getPublicId();
        }
        public String getSystemId() {
            return getCurrentLocation().getSystemId();
        }
    },nsc);
}
 
Example #25
Source File: XMLSerializer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}
 
Example #26
Source File: JAXBValidator.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
private void handleValidationEvent(SAXParseException exception, int severity) throws SAXException {
	if (!validationEventHandler.handleEvent(
			new ValidationEventImpl(
					severity,
					exception.getMessage(),
					new ValidationEventLocatorImpl(),
					exception.getCause())))
		throw exception;
}
 
Example #27
Source File: XMLSerializer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}
 
Example #28
Source File: XMLSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}
 
Example #29
Source File: XMLSerializer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}
 
Example #30
Source File: XMLSerializer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Called when a referenced object doesn't have an ID.
 */
public void errorMissingId(Object obj) throws SAXException {
    reportError( new ValidationEventImpl(
        ValidationEvent.ERROR,
        Messages.MISSING_ID.format(obj),
        new ValidationEventLocatorImpl(obj)) );
}