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:<[EMAIL PROTECTED]>,Foo! <[EMAIL PROTECTED]>,Foo
Bar <[EMAIL PROTECTED]>;", g.toString());
}
+
+ public void testEmptyQuotedStringBeforeDotAtomInLocalPart() throws
Exception {
+ /*
+ * This used to give a StringIndexOutOfBoundsException instead of the
expected
+ * ParseException
+ */
+ try {
+ AddressList.parse("\"\"[EMAIL PROTECTED]");
+ fail("ParseException expected");
+ } catch (ParseException pe) {
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]