/** * Converts the given <code>JAXBException</code> to an appropriate exception from the * <code>org.springframework.oxm</code> hierarchy. * * @param ex <code>JAXBException</code> that occured * @return the corresponding <code>XmlMappingException</code> */ public static XmlMappingException convertJaxbException(JAXBException ex) { if (ex instanceof MarshalException) { return new JaxbMarshallingFailureException((MarshalException) ex); } else if (ex instanceof UnmarshalException) { return new JaxbUnmarshallingFailureException((UnmarshalException) ex); } else if (ex instanceof ValidationException) { return new JaxbValidationFailureException((ValidationException) ex); } // fallback return new JaxbSystemException(ex); }