cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf git commit: CXF-7381 - DateFormat in MapEventLogger in the STS is not thread safe
Date Wed, 24 May 2017 09:28:30 GMT
Repository: cxf
Updated Branches:
  refs/heads/master c2517eb55 -> ee62e3c37


CXF-7381 - DateFormat in MapEventLogger in the STS is not thread safe


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ee62e3c3
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ee62e3c3
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ee62e3c3

Branch: refs/heads/master
Commit: ee62e3c371cd7d41796cba09f110f5cff12f5060
Parents: c2517eb
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed May 24 10:28:16 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed May 24 10:28:16 2017 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/sts/event/map/MapEventLogger.java    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/ee62e3c3/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/map/MapEventLogger.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/map/MapEventLogger.java
b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/map/MapEventLogger.java
index bc5bc2d..f321948 100644
--- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/map/MapEventLogger.java
+++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/event/map/MapEventLogger.java
@@ -37,7 +37,7 @@ public class MapEventLogger implements MapEventListener {
     private boolean logStacktrace;
     private boolean logFieldname;
     private Level logLevel = Level.FINE;
-    private DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
+    private String format;
 
     public MapEventLogger() {
         fieldOrder.add(KEYS.TIME.name());
@@ -86,6 +86,12 @@ public class MapEventLogger implements MapEventListener {
         if (value instanceof String) {
             return (String) value;
         } else if (value instanceof Date) {
+            DateFormat dateFormat = null;
+            if (format != null) {
+                dateFormat = new SimpleDateFormat(format);
+            } else {
+                dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
+            }
             return dateFormat.format(value);
         } else {
             return (value == null) ? "<null>" : value.toString();
@@ -116,8 +122,8 @@ public class MapEventLogger implements MapEventListener {
         this.logFieldname = logFieldname;
     }
 
-    public void setDateFormat(String format) {
-        this.dateFormat = new SimpleDateFormat(format);
+    public void setDateFormat(String dateFormat) {
+        this.format = dateFormat;
     }
 
     public String getLogLevel() {


Mime
View raw message