@Test public void testRoundTripWithNull() throws Exception { try{ AdaptrisMessage message = messageFactory.newMessage(PAYLOAD_ID[0], STANDARD_PAYLOAD[0], ENCODING); message.addMetadata(METADATA_KEY, METADATA_VALUE); message.addObjectHeader(CoreConstants.OBJ_METADATA_EXCEPTION, new Exception(testName.getMethodName())); mimeEncoder.writeMessage(message, null); fail(); } catch (CoreException e) { } }
@Override public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException { try { MultiPartOutput output = new MultiPartOutput(msg.getUniqueId()); if (msg instanceof MultiPayloadAdaptrisMessage) { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); output.addPart(payloadAsMimePart(message), PAYLOAD_CONTENT_ID + "/" + id); } } else { output.addPart(payloadAsMimePart(msg), PAYLOAD_CONTENT_ID); } output.addPart(getMetadata(msg), getMetadataEncoding(), METADATA_CONTENT_ID); if (msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION)) { output.addPart(asMimePart((Exception) msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION)), EXCEPTION_CONTENT_ID); } output.writeTo(target); } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } }
MultiPayloadMessageMimeEncoder extends MimeEncoderImpl<OutputStream, InputStream> { @Override public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException { try { MultiPartOutput output = new MultiPartOutput(msg.getUniqueId()); if (msg instanceof MultiPayloadAdaptrisMessage) { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); output.addPart(payloadAsMimePart(message), PAYLOAD_CONTENT_ID + "/" + id); } } else { output.addPart(payloadAsMimePart(msg), PAYLOAD_CONTENT_ID); } output.addPart(getMetadata(msg), getMetadataEncoding(), METADATA_CONTENT_ID); if (msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION)) { output.addPart(asMimePart((Exception) msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION)), EXCEPTION_CONTENT_ID); } output.writeTo(target); } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } }
MultiPayloadMessageMimeEncoder extends MimeEncoderImpl<OutputStream, InputStream> { @Override public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException { try { MultiPartOutput output = new MultiPartOutput(msg.getUniqueId()); if (msg instanceof MultiPayloadAdaptrisMessage) { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); output.addPart(payloadAsMimePart(message), PAYLOAD_CONTENT_ID + "/" + id); } } else { output.addPart(payloadAsMimePart(msg), PAYLOAD_CONTENT_ID); } output.addPart(getMetadata(msg), getMetadataEncoding(), METADATA_CONTENT_ID); if (msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION)) { output.addPart(asMimePart((Exception) msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION)), EXCEPTION_CONTENT_ID); } output.writeTo(target); } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } MultiPayloadMessageMimeEncoder(); }
MultiPayloadMessageMimeEncoder extends MimeEncoderImpl<OutputStream, InputStream> { @Override public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException { try { MultiPartOutput output = new MultiPartOutput(msg.getUniqueId()); if (msg instanceof MultiPayloadAdaptrisMessage) { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); output.addPart(payloadAsMimePart(message), PAYLOAD_CONTENT_ID + "/" + id); } } else { output.addPart(payloadAsMimePart(msg), PAYLOAD_CONTENT_ID); } output.addPart(getMetadata(msg), getMetadataEncoding(), METADATA_CONTENT_ID); if (msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION)) { output.addPart(asMimePart((Exception) msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION)), EXCEPTION_CONTENT_ID); } output.writeTo(target); } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } MultiPayloadMessageMimeEncoder(); @Override void writeMessage(AdaptrisMessage msg, OutputStream target); @Override AdaptrisMessage readMessage(InputStream source); }
MultiPayloadMessageMimeEncoder extends MimeEncoderImpl<OutputStream, InputStream> { @Override public void writeMessage(AdaptrisMessage msg, OutputStream target) throws CoreException { try { MultiPartOutput output = new MultiPartOutput(msg.getUniqueId()); if (msg instanceof MultiPayloadAdaptrisMessage) { MultiPayloadAdaptrisMessage message = (MultiPayloadAdaptrisMessage)msg; for (String id : message.getPayloadIDs()) { message.switchPayload(id); output.addPart(payloadAsMimePart(message), PAYLOAD_CONTENT_ID + "/" + id); } } else { output.addPart(payloadAsMimePart(msg), PAYLOAD_CONTENT_ID); } output.addPart(getMetadata(msg), getMetadataEncoding(), METADATA_CONTENT_ID); if (msg.getObjectHeaders().containsKey(CoreConstants.OBJ_METADATA_EXCEPTION)) { output.addPart(asMimePart((Exception) msg.getObjectHeaders().get(CoreConstants.OBJ_METADATA_EXCEPTION)), EXCEPTION_CONTENT_ID); } output.writeTo(target); } catch (Exception e) { throw ExceptionHelper.wrapCoreException(e); } } MultiPayloadMessageMimeEncoder(); @Override void writeMessage(AdaptrisMessage msg, OutputStream target); @Override AdaptrisMessage readMessage(InputStream source);  }