Class MessageStripExceptions<M extends Message>

java.lang.Object
eu.bandm.tools.message.SingleSender<M>
eu.bandm.tools.message.MessagePasser<M>
eu.bandm.tools.message.MessageStripExceptions<M>
Type Parameters:
M - the type of the messages
All Implemented Interfaces:
MessageReceiver<M>

public class MessageStripExceptions<M extends Message> extends MessagePasser<M>
A filter which strips off all exceptions, or at least their stack traces. The Message object and the contained Exception object are altered, which may affect parallel references. Is useful for a slimmer appearance of print-outs.
  • Field Details

    • total

      protected boolean total
      Whether exceptions are stripped off totally. If false: only their stack trace is removed.
    • emptyStackTrace

      protected static final StackTraceElement[] emptyStackTrace
      Is used for replacement when stripping the stack trace.
  • Constructor Details

    • MessageStripExceptions

      public MessageStripExceptions(@Opt @Opt MessageReceiver<? super M> d, boolean total)
      Only constructor.
      Parameters:
      d - the target of this filter
      total - whether exceptions are stripped off totally, or only their stack trace.
  • Method Details

    • receive

      public void receive(M m)
      Propagate the message after removing the exception (total=true) or only its stack trace. The Message object and the contained Exception object are altered, which may affect parallel references.
      Specified by:
      receive in interface MessageReceiver<M extends Message>
      Overrides:
      receive in class MessagePasser<M extends Message>
      Parameters:
      m - the message to receive.