James Mime4j
  1. James Mime4j
  2. MIME4J-202

mimeMessage.getTo() throws IllegarArgumentException unexpectedly

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7.1
    • Component/s: dom
    • Labels:
      None
    • Environment:
      Java 6

      Description

      After upgrading to 0.7 I'm getting following problem:

      The message I'm trying to parse contain following to field:

       
          To: "BiZ" <>
      

      Using DOM parser I call mimeMessage.getTo() where mimeMessage is parsed mimeMessage object and getting following:

       
      java.lang.IllegalArgumentException: null
          at org.apache.james.mime4j.dom.address.Mailbox.<init>(Mailbox.java:59) ~[na:na]
          at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseMailboxAddress(LenientAddressBuilder.java:139) ~[na:na]
          at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseAddress(LenientAddressBuilder.java:264) ~[na:na]
          at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseAddressList(LenientAddressBuilder.java:303) ~[na:na]
          at org.apache.james.mime4j.field.AddressListFieldLenientImpl.parse(AddressListFieldLenientImpl.java:71) ~[na:na]
          at org.apache.james.mime4j.field.AddressListFieldLenientImpl.getAddressList(AddressListFieldLenientImpl.java:51) ~[na:na]
          at org.apache.james.mime4j.message.AbstractMessage.getAddressList(AbstractMessage.java:470) ~[na:na]
          at org.apache.james.mime4j.message.AbstractMessage.getTo(AbstractMessage.java:239) ~[na:na]
          ...
      

      According to getTo() description it should return AddressList or null in case if To not present. The case above is a bit tricky. But I would prefer to get back whatever possible, i.e. AddressList with only name field. In any case, it should not throw IAE.

        Activity

        Rustam Aliyev created issue -
        Stefano Bagnara made changes -
        Field Original Value New Value
        Fix Version/s 0.7.1 [ 12317596 ]
        Oleg Kalnichevski made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Rustam Aliyev
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development