james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject 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
Date Mon, 02 Jul 2007 14:33:03 GMT
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:<test@example.com>,Foo! <foo@example.com>,Foo Bar
<foo2@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


Mime
View raw message