From 1ffd5bc279cc24eca5b1d8dc7a47d95ab2992b4f Mon Sep 17 00:00:00 2001 From: mguessan Date: Wed, 2 Feb 2011 22:59:37 +0000 Subject: [PATCH] EWS: Fix 3165749, exception with quotes in meeting subject and EWS git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1617 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/util/StringUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/java/davmail/util/StringUtil.java b/src/java/davmail/util/StringUtil.java index d0e7a4a9..6f8e5e0d 100644 --- a/src/java/davmail/util/StringUtil.java +++ b/src/java/davmail/util/StringUtil.java @@ -132,6 +132,8 @@ public final class StringUtil { private static final Pattern LT_PATTERN = Pattern.compile("<"); private static final Pattern GT_PATTERN = Pattern.compile(">"); + private static final Pattern QUOTE_PATTERN = Pattern.compile("\""); + private static final Pattern URLENCODED_AMP_PATTERN = Pattern.compile("%26"); private static final Pattern ENCODED_AMP_PATTERN = Pattern.compile("&"); @@ -194,6 +196,9 @@ public final class StringUtil { if (name.indexOf('>') >= 0) { result = GT_PATTERN.matcher(result).replaceAll(">"); } + if (name.indexOf('"') >= 0) { + result = QUOTE_PATTERN.matcher(result).replaceAll("""); + } } return result; } @@ -273,6 +278,9 @@ public final class StringUtil { if (result.indexOf('>') >= 0) { result = GT_PATTERN.matcher(result).replaceAll("%3E"); } + if (result.indexOf('"') >= 0) { + result = QUOTE_PATTERN.matcher(result).replaceAll("%22"); + } return result; }