private void validationError(String message, Location location, Throwable cause) throws JAXBException {
validationError(message, new ValidationEventLocatorImpl(location), cause);
}
private void validationError(String message, ValidationEventLocatorImpl locator, Throwable cause) throws JAXBException {
ValidationEventHandler validationEventHandler = null;
if (marshaller != null) {
validationEventHandler = marshaller.getEventHandler();
} else if (unmarshaller != null) {
validationEventHandler = unmarshaller.getEventHandler();
}
if (validationEventHandler == null || !validationEventHandler.handleEvent(new ValidationEventImpl(ValidationEvent.ERROR, message, locator, cause))) {
throw new UnmarshalException(message, cause);
}
}