From 9b8888c014f40a6dea81659e47592a1a54e898cb Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 28 Jun 2011 21:12:46 +0000 Subject: [PATCH] Fix bug in removeQuotes git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1722 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/util/StringUtil.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/java/davmail/util/StringUtil.java b/src/java/davmail/util/StringUtil.java index a7b7ea39..f24a9fd1 100644 --- a/src/java/davmail/util/StringUtil.java +++ b/src/java/davmail/util/StringUtil.java @@ -388,18 +388,21 @@ public final class StringUtil { /** * Remove quotes if present on value. + * * @param value input value * @return unquoted string */ public static String removeQuotes(String value) { String result = value; - if (result.startsWith("\"") || result.startsWith("{") || result.startsWith("(")) { - result = result.substring(1); - } - if (result.endsWith("\"") || result.endsWith("}") || result.endsWith(")")) { - result = result.substring(0, result.length() - 1); + if (result != null) { + if (result.startsWith("\"") || result.startsWith("{") || result.startsWith("(")) { + result = result.substring(1); + } + if (result.endsWith("\"") || result.endsWith("}") || result.endsWith(")")) { + result = result.substring(0, result.length() - 1); + } } return result; } - + }