serge 01/09/28 22:03:39
Modified: src/java/org/apache/mailet MailAddress.java
Log:
Patch by Matthew Pangaro to suppose username@[yyy.yyy.yyy.yyy] address style as
reported in bugzilla.
Revision Changes Path
1.3 +12 -3 jakarta-james/src/java/org/apache/mailet/MailAddress.java
Index: MailAddress.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/mailet/MailAddress.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MailAddress.java 2001/08/04 02:52:08 1.2
+++ MailAddress.java 2001/09/29 05:03:39 1.3
@@ -153,11 +153,15 @@
* Return the host part.
*
* @return a <code>String</code> object representing the host part
- * of this email address.
- * @throws AddressException if the parse failed
+ * of this email address. If the host is of the dotNum form
+ * (e.g. [yyy.yyy.yyy.yyy]) then strip the braces first.
*/
public String getHost() {
- return host;
+ if (!(host.startsWith("[") && host.endsWith("]"))) {
+ return host;
+ } else {
+ return host.substring(1, host.length() -1);
+ }
}
/**
@@ -325,6 +329,11 @@
private String parseDotNum(String address) throws ParseException {
StringBuffer resultSB = new StringBuffer();
+ //we were passed the string with pos pointing the the [ char.
+ // take the first char ([), put it in the result buffer and increment pos
+ resultSB.append(address.charAt(pos));
+ pos++;
+
//<dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>
for (int octet = 0; octet < 4; octet++) {
//<snum> ::= one, two, or three digits representing a decimal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]