List of usage examples for org.springframework.oxm MarshallingFailureException getMostSpecificCause
public Throwable getMostSpecificCause()
From source file:no.digipost.signature.client.asice.manifest.ManifestCreator.java
public Manifest createManifest(JOB job, Sender sender) { Object xmlManifest = buildXmlManifest(job, sender); try (ByteArrayOutputStream manifestStream = new ByteArrayOutputStream()) { marshal(xmlManifest, manifestStream); return new Manifest(manifestStream.toByteArray()); } catch (MarshallingFailureException e) { if (e.getMostSpecificCause() instanceof SAXParseException) { throw new XmlValidationException("Unable to validate generated Manifest XML. " + "This typically happens if one or more values are not in accordance with the XSD. " + "You may inspect the cause (by calling getCause()) to see which constraint has been violated.", (SAXParseException) e.getMostSpecificCause()); }/*from w w w . ja v a 2s . c o m*/ throw e; } catch (IOException e) { throw new RuntimeIOException(e); } }
From source file:no.difi.sdp.client.asice.manifest.CreateManifest.java
public Manifest createManifest(Forsendelse forsendelse) { SDPManifest sdpManifest = sdpBuilder.createManifest(forsendelse); ByteArrayOutputStream manifestStream = new ByteArrayOutputStream(); try {/*ww w . ja v a2 s .com*/ marshaller.marshal(sdpManifest, new StreamResult(manifestStream)); return new Manifest(manifestStream.toByteArray()); } catch (MarshallingFailureException e) { if (e.getMostSpecificCause() instanceof SAXParseException) { throw new XmlValideringException( "Kunne ikke validere generert Manifest XML. Sjekk at alle pkrevde input er satt og ikke er null", SendException.AntattSkyldig.KLIENT, (SAXParseException) e.getMostSpecificCause()); } throw e; } }