James Mime4j
  1. James Mime4j
  2. MIME4J-152

Zero parts multipart messages are parsed as 1 empty part multipart messages

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: None
    • Labels:
      None

      Description

      Mime4j currenlty parse a message having only the start boundary as an empty message (zero parts) but at the same time parse a message with no boundary (no start and no end) as a message with 1 empty part.

      This is clearly wrong.

      We also already have a missing-inner-boundary.msg in our testsuite but the expectation files are wrong.

        Activity

        Hide
        Stefano Bagnara added a comment -

        The original test with fixed expected results, and 2 new test messages to prove different scenarios and prove the previous inconsistency.

        Show
        Stefano Bagnara added a comment - The original test with fixed expected results, and 2 new test messages to prove different scenarios and prove the previous inconsistency.
        Hide
        Stefano Bagnara added a comment -

        It seems MimeEntity have very similar code for EntityStates.T_PREAMBLE and T_IN_BODYPART states.
        Analyzing the minor differences (trying to clean up code) I found out this bug.

        It can be easily solved by remove any code from T_PREABLE and leave the switch/case fallback to T_IN_BODYPART.
        case EntityStates.T_PREAMBLE:
        // removed specific code. Fallback to T_IN_BODYPART that
        // better handle missing parts.
        case T_IN_BODYPART:

        (PS: maybe we don't need the T_IN_BODYPART state anymore and we could use the T_PREABLE instead..)

        Show
        Stefano Bagnara added a comment - It seems MimeEntity have very similar code for EntityStates.T_PREAMBLE and T_IN_BODYPART states. Analyzing the minor differences (trying to clean up code) I found out this bug. It can be easily solved by remove any code from T_PREABLE and leave the switch/case fallback to T_IN_BODYPART. case EntityStates.T_PREAMBLE: // removed specific code. Fallback to T_IN_BODYPART that // better handle missing parts. case T_IN_BODYPART: (PS: maybe we don't need the T_IN_BODYPART state anymore and we could use the T_PREABLE instead..)
        Hide
        Stefano Bagnara added a comment -

        It seems we can remove T_IN_MESSAGE and T_IN_BODYPART states and simply EntityStates.T_BODY (instead of T_IN_MESSAGE) and EntityStates.T_PREAMBLE (instead of T_IN_BODYPART). At least this work fine in my uncommitted code.

        Show
        Stefano Bagnara added a comment - It seems we can remove T_IN_MESSAGE and T_IN_BODYPART states and simply EntityStates.T_BODY (instead of T_IN_MESSAGE) and EntityStates.T_PREAMBLE (instead of T_IN_BODYPART). At least this work fine in my uncommitted code.
        Hide
        Stefano Bagnara added a comment -

        Merged from cycleclean.

        Show
        Stefano Bagnara added a comment - Merged from cycleclean.

          People

          • Assignee:
            Stefano Bagnara
            Reporter:
            Stefano Bagnara
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development