james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rustam Aliyev (JIRA)" <mime4j-...@james.apache.org>
Subject [jira] [Created] (MIME4J-202) mimeMessage.getTo() throws IllegarArgumentException unexpectedly
Date Fri, 12 Aug 2011 09:12:27 GMT
mimeMessage.getTo() throws IllegarArgumentException unexpectedly

                 Key: MIME4J-202
                 URL: https://issues.apache.org/jira/browse/MIME4J-202
             Project: JAMES Mime4j
          Issue Type: Bug
          Components: dom
    Affects Versions: 0.7
         Environment: Java 6
            Reporter: Rustam Aliyev
            Priority: Minor

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)
    at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseAddress(LenientAddressBuilder.java:264)
    at org.apache.james.mime4j.field.address.LenientAddressBuilder.parseAddressList(LenientAddressBuilder.java:303)
    at org.apache.james.mime4j.field.AddressListFieldLenientImpl.parse(AddressListFieldLenientImpl.java:71)
    at org.apache.james.mime4j.field.AddressListFieldLenientImpl.getAddressList(AddressListFieldLenientImpl.java:51)
    at org.apache.james.mime4j.message.AbstractMessage.getAddressList(AbstractMessage.java:470)
    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. 

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message