org.jibx.runtime.ValidationException Java Examples

The following examples show how to use org.jibx.runtime.ValidationException. 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: JibxMarshaller.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Convert the given {@code JiBXException} to an appropriate exception from the
 * {@code org.springframework.oxm} hierarchy.
 * <p>A boolean flag is used to indicate whether this exception occurs during marshalling or
 * unmarshalling, since JiBX itself does not make this distinction in its exception hierarchy.
 * @param ex {@code JiBXException} that occurred
 * @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
 * or unmarshalling ({@code false})
 * @return the corresponding {@code XmlMappingException}
 */
public XmlMappingException convertJibxException(JiBXException ex, boolean marshalling) {
	if (ex instanceof ValidationException) {
		return new ValidationFailureException("JiBX validation exception", ex);
	}
	else {
		if (marshalling) {
			return new MarshallingFailureException("JiBX marshalling exception", ex);
		}
		else {
			return new UnmarshallingFailureException("JiBX unmarshalling exception", ex);
		}
	}
}
 
Example #2
Source File: JibxMarshaller.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Convert the given {@code JiBXException} to an appropriate exception from the
 * {@code org.springframework.oxm} hierarchy.
 * <p>A boolean flag is used to indicate whether this exception occurs during marshalling or
 * unmarshalling, since JiBX itself does not make this distinction in its exception hierarchy.
 * @param ex {@code JiBXException} that occurred
 * @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
 * or unmarshalling ({@code false})
 * @return the corresponding {@code XmlMappingException}
 */
public XmlMappingException convertJibxException(JiBXException ex, boolean marshalling) {
	if (ex instanceof ValidationException) {
		return new ValidationFailureException("JiBX validation exception", ex);
	}
	else {
		if (marshalling) {
			return new MarshallingFailureException("JiBX marshalling exception", ex);
		}
		else {
			return new UnmarshallingFailureException("JiBX unmarshalling exception", ex);
		}
	}
}
 
Example #3
Source File: JibxMarshaller.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Convert the given {@code JiBXException} to an appropriate exception from the
 * {@code org.springframework.oxm} hierarchy.
 * <p>A boolean flag is used to indicate whether this exception occurs during marshalling or
 * unmarshalling, since JiBX itself does not make this distinction in its exception hierarchy.
 * @param ex {@code JiBXException} that occured
 * @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
 * or unmarshalling ({@code false})
 * @return the corresponding {@code XmlMappingException}
 */
public XmlMappingException convertJibxException(JiBXException ex, boolean marshalling) {
	if (ex instanceof ValidationException) {
		return new ValidationFailureException("JiBX validation exception", ex);
	}
	else {
		if (marshalling) {
			return new MarshallingFailureException("JiBX marshalling exception", ex);
		}
		else {
			return new UnmarshallingFailureException("JiBX unmarshalling exception", ex);
		}
	}
}