code: protected XmlMappingException convertCastorException(XMLException ex, boolean marshalling) {
  		if (ex instanceof ValidationException) {
  			return new ValidationFailureException("Castor validation exception", ex);
  		}
  		else if (ex instanceof MarshalException) {
  			if (marshalling) {
  				return new MarshallingFailureException("Castor marshalling exception", ex);
  			}
  			else {
  				return new UnmarshallingFailureException("Castor unmarshalling exception", ex);
  			}
  		}
  		else {
  			// fallback
  			return new UncategorizedMappingException("Unknown Castor exception", ex);
  		}
  	}
docs: Convert the given {@code XMLException} 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 Castor itself does not make this distinction in its exception hierarchy.
  @param ex Castor {@code XMLException} that occurred
  @param marshalling indicates whether the exception occurs during marshalling ({@code true}),
  or unmarshalling ({@code false})
  @return the corresponding {@code XmlMappingException}