JAMES-2251 Don't convert logBuffer to a String twice

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/9a06f408
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/9a06f408
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/9a06f408

Branch: refs/heads/master
Commit: 9a06f4081691f0c13dda2b138c3bcb72fc8e700b
Parents: 4a58c3e
Author: Daniel Trebbien <[email protected]>
Authored: Mon Oct 30 12:09:55 2017 -0400
Committer: Antoine Duprat <[email protected]>
Committed: Tue Dec 12 09:47:37 2017 +0100

----------------------------------------------------------------------
 .../mailrepository/jdbc/JDBCMailRepository.java    | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/9a06f408/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
----------------------------------------------------------------------
diff --git 
a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
 
b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
index d1ad86c..c18bdd4 100644
--- 
a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
+++ 
b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
@@ -265,7 +265,7 @@ public class JDBCMailRepository extends 
AbstractMailRepository {
                 LOGGER.debug(logBuf);
             }
         } catch (Exception e) {
-            final String message = "Failed to retrieve Store component:" + 
e.getMessage();
+            String message = "Failed to retrieve Store component:" + 
e.getMessage();
             LOGGER.error(message, e);
             throw new ConfigurationException(message, e);
         }
@@ -365,18 +365,21 @@ public class JDBCMailRepository extends 
AbstractMailRepository {
 
         if (hasUpdateMessageAttributesSQL && !hasRetrieveMessageAttributesSQL) 
{
             logBuffer.append("JDBC Mail Attributes support was activated for 
update but not for retrieval" + "(found 'updateMessageAttributesSQL' but not 
'retrieveMessageAttributesSQL'" + "in table '").append(tableName).append("').");
-            LOGGER.error(logBuffer.toString());
-            throw new SQLException(logBuffer.toString());
+            String logBufferAsString = logBuffer.toString();
+            LOGGER.error(logBufferAsString);
+            throw new SQLException(logBufferAsString);
         }
         if (!hasUpdateMessageAttributesSQL && hasRetrieveMessageAttributesSQL) 
{
             logBuffer.append("JDBC Mail Attributes support was activated for 
retrieval but not for update" + "(found 'retrieveMessageAttributesSQL' but not 
'updateMessageAttributesSQL'" + "in table '").append(tableName).append("'.");
-            LOGGER.error(logBuffer.toString());
-            throw new SQLException(logBuffer.toString());
+            String logBufferAsString = logBuffer.toString();
+            LOGGER.error(logBufferAsString);
+            throw new SQLException(logBufferAsString);
         }
         if (!hasMessageAttributesColumn && (hasUpdateMessageAttributesSQL || 
hasRetrieveMessageAttributesSQL)) {
             logBuffer.append("JDBC Mail Attributes support was activated but 
column '").append(attributesColumnName).append("' is missing in table 
'").append(tableName).append("'.");
-            LOGGER.error(logBuffer.toString());
-            throw new SQLException(logBuffer.toString());
+            String logBufferAsString = logBuffer.toString();
+            LOGGER.error(logBufferAsString);
+            throw new SQLException(logBufferAsString);
         }
         if (hasUpdateMessageAttributesSQL && hasRetrieveMessageAttributesSQL) {
             jdbcMailAttributesReady = true;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to