cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: Preventing possible ThreadLocalClientState NPE
Date Fri, 28 Feb 2014 16:38:10 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 9d387a1e4 -> b5a449b72


Preventing possible ThreadLocalClientState NPE


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

Branch: refs/heads/2.7.x-fixes
Commit: b5a449b72a821c49fa1d15ab7cdeaca03c443a64
Parents: 9d387a1
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Feb 28 16:08:43 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Feb 28 16:37:55 2014 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/client/ThreadLocalClientState.java   | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b5a449b7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ThreadLocalClientState.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ThreadLocalClientState.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ThreadLocalClientState.java
index c7ddf89..efe1401 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ThreadLocalClientState.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ThreadLocalClientState.java
@@ -121,6 +121,7 @@ public class ThreadLocalClientState implements ClientState {
             cs = new LocalClientState(initialState);
             state.put(Thread.currentThread(), cs);
             if (timeToKeepState > 0) {
+                prepareCheckpointMap();
                 long currentTime = System.currentTimeMillis();
                 checkpointMap.put(Thread.currentThread(), currentTime);
                 new CleanupThread(Thread.currentThread(), currentTime).start();
@@ -132,6 +133,12 @@ public class ThreadLocalClientState implements ClientState {
     public void setTimeToKeepState(long timeToKeepState) {
         this.timeToKeepState = timeToKeepState;
         if (timeToKeepState > 0) {
+            prepareCheckpointMap();
+        }
+    }
+
+    private void prepareCheckpointMap() {
+        if (checkpointMap == null) {
             checkpointMap = new ConcurrentHashMap<Thread, Long>();
         }
     }


Mime
View raw message