@Override public Object unmarshal(Source source, @Nullable MimeContainer mimeContainer) throws XmlMappingException { source = processSource(source); try { Unmarshaller unmarshaller = createUnmarshaller(); if (this.mtomEnabled && mimeContainer != null) { unmarshaller.setAttachmentUnmarshaller(new Jaxb2AttachmentUnmarshaller(mimeContainer)); } if (StaxUtils.isStaxSource(source)) { return unmarshalStaxSource(unmarshaller, source); } else if (this.mappedClass != null) { return unmarshaller.unmarshal(source, this.mappedClass).getValue(); } else { return unmarshaller.unmarshal(source); } } catch (NullPointerException ex) { if (!isSupportDtd()) { throw new UnmarshallingFailureException("NPE while unmarshalling: " + "This can happen due to the presence of DTD declarations which are disabled.", ex); } throw ex; } catch (JAXBException ex) { throw convertJaxbException(ex); } }
Unmarshaller unmarshaller = createUnmarshaller(); if (this.mtomEnabled && mimeContainer != null) { unmarshaller.setAttachmentUnmarshaller(new Jaxb2AttachmentUnmarshaller(mimeContainer));
public Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMappingException { try { Unmarshaller unmarshaller = createUnmarshaller(); if (mtomEnabled && mimeContainer != null) { unmarshaller.setAttachmentUnmarshaller(new Jaxb2AttachmentUnmarshaller(mimeContainer)); } if (TraxUtils.isStaxSource(source)) { return unmarshalStaxSource(unmarshaller, source); } else { return unmarshaller.unmarshal(source); } } catch (JAXBException ex) { throw convertJaxbException(ex); } }
@Override public byte[] getAttachmentAsByteArray(String cid) { try { DataHandler dataHandler = getAttachmentAsDataHandler(cid); return FileCopyUtils.copyToByteArray(dataHandler.getInputStream()); } catch (IOException ex) { throw new UnmarshallingFailureException("Couldn't read attachment", ex); } }
@Override public byte[] getAttachmentAsByteArray(String cid) { try { DataHandler dataHandler = getAttachmentAsDataHandler(cid); return FileCopyUtils.copyToByteArray(dataHandler.getInputStream()); } catch (IOException ex) { throw new JaxbUnmarshallingFailureException(ex); } }
@Override public byte[] getAttachmentAsByteArray(String cid) { try { DataHandler dataHandler = getAttachmentAsDataHandler(cid); return FileCopyUtils.copyToByteArray(dataHandler.getInputStream()); } catch (IOException ex) { throw new UnmarshallingFailureException("Couldn't read attachment", ex); } }