From b572c8e065c827980b0f639d42b9080b12afa369 Mon Sep 17 00:00:00 2001 From: Bao-Long Nguyen-Trong Date: Thu, 25 Jun 2009 17:05:50 +0000 Subject: [PATCH] Fixed issue 497 --- src/com/android/email/mail/Address.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/com/android/email/mail/Address.java b/src/com/android/email/mail/Address.java index 0feea1c63..1420ad7f7 100644 --- a/src/com/android/email/mail/Address.java +++ b/src/com/android/email/mail/Address.java @@ -28,6 +28,12 @@ public class Address { public Address(String address, String personal) { this.mAddress = address; + if ("".equals(personal)) { + personal = null; + } + if (personal!=null) { + personal = personal.trim(); + } this.mPersonal = personal; } @@ -48,6 +54,12 @@ public class Address { } public void setPersonal(String personal) { + if ("".equals(personal)) { + personal = null; + } + if (personal!=null) { + personal = personal.trim(); + } this.mPersonal = personal; } @@ -127,11 +139,11 @@ public class Address { public String toString() { if (mPersonal != null) { - // if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) { - return "\"" + mPersonal+ "\" " + " <" + mAddress + ">"; - // } else { - // return mPersonal + " <" + mAddress + ">"; - // } + // if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) { + return Utility.quoteString(mPersonal) + " <" + mAddress + ">"; + // } else { + // return mPersonal + " <" + mAddress + ">"; + // } } else { return mAddress; }