You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ni...@apache.org on 2007/07/02 16:33:03 UTC

svn commit: r552505 - in /james/mime4j/trunk/src: main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt test/java/org/apache/james/mime4j/field/address/AddressTest.java

Author: niklas
Date: Mon Jul  2 07:33:02 2007
New Revision: 552505

URL: http://svn.apache.org/viewvc?view=rev&rev=552505
Log:
Fixed a StringIndexOutOfBoundsException when parsing addresses with local parts containing an empty quoted-string followed by a dot-atom.

Modified:
    james/mime4j/trunk/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
    james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java

Modified: james/mime4j/trunk/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt?view=diff&rev=552505&r1=552504&r2=552505
==============================================================================
--- james/mime4j/trunk/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt (original)
+++ james/mime4j/trunk/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt Mon Jul  2 07:33:02 2007
@@ -183,7 +183,7 @@
 	( t=<DOTATOM> | t=<QUOTEDSTRING> )
 	(	[t="."]
 		{
-			if (t.image.charAt(t.image.length() - 1) != '.' || t.kind == AddressListParserConstants.QUOTEDSTRING)
+			if ( t.kind == AddressListParserConstants.QUOTEDSTRING || t.image.charAt(t.image.length() - 1) != '.')
 				throw new ParseException("Words in local part must be separated by '.'");
 		}
 		(	t=<DOTATOM> | t=<QUOTEDSTRING> )

Modified: james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?view=diff&rev=552505&r1=552504&r2=552505
==============================================================================
--- james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java (original)
+++ james/mime4j/trunk/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java Mon Jul  2 07:33:02 2007
@@ -353,4 +353,16 @@
         Group g = new Group("group", new MailboxList(al, false));
         assertEquals("group:<te...@example.com>,Foo! <fo...@example.com>,Foo Bar <fo...@example.com>;", g.toString());
     }
+    
+    public void testEmptyQuotedStringBeforeDotAtomInLocalPart() throws Exception {
+        /*
+         * This used to give a StringIndexOutOfBoundsException instead of the expected
+         * ParseException
+         */
+        try {
+            AddressList.parse("\"\"bar@bar.com");
+            fail("ParseException expected");
+        } catch (ParseException pe) {
+        }
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org