Class SMIMEBoundaryNotFoundException

java.lang.Object
java.lang.Throwable
java.lang.Exception
javax.mail.MessagingException
org.bouncycastle.mail.smime.SMIMEBoundaryNotFoundException
All Implemented Interfaces:
Serializable

public class SMIMEBoundaryNotFoundException extends javax.mail.MessagingException
MessagingException thrown when the raw content of a multipart body part does not contain the expected number of MIME boundary lines - typically a multipart that is missing its closing --<boundary>-- line, so the part cannot be re-serialised for digest calculation (see github #2318).

The exception message carries structural diagnostics only (the boundary, the body part's Content-Type / Content-Disposition, the expected and found boundary-line counts, and the number of bytes consumed) and is safe to log or forward as-is. The last (non-empty) line read before the failure, which may contain message content and is therefore potentially confidential, is deliberately excluded from the message and is only available through getLastLineRead().

See Also:
  • Method Details

    • getBoundary

      public String getBoundary()
      Return the boundary line being searched for (with its leading --).
    • getParentContentType

      public String getParentContentType()
      Return the Content-Type of the body part whose raw content was being scanned, or null if it could not be determined.
    • getParentContentDisposition

      public String getParentContentDisposition()
      Return the Content-Disposition of the body part whose raw content was being scanned, or null if the header is absent or could not be read.
    • getExpectedBoundaries

      public int getExpectedBoundaries()
      Return the number of boundary lines the scan was looking for.
    • getFoundBoundaries

      public int getFoundBoundaries()
      Return the number of boundary lines actually seen before end-of-stream.
    • getBytesConsumed

      public long getBytesConsumed()
      Return the number of bytes consumed from the body part's raw input stream before end-of-stream, for correlation with a dump of the original message.
    • getLastLineRead

      public String getLastLineRead()
      Return the last non-empty line read before the scan hit end-of-stream, truncated to 200 characters, or null if no non-empty line was seen.

      This value is part of the message body and may be confidential. It is excluded from Throwable.getMessage() so that stack traces are safe to log by default; only forward it to sinks cleared for message content.