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:39:29 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.6.x-fixes 6e3e2f262 -> 83e2376b4


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/83e2376b
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/83e2376b
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/83e2376b

Branch: refs/heads/2.6.x-fixes
Commit: 83e2376b471d89b4fe6a7313fa76966ca77ff50a
Parents: 6e3e2f2
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:39:09 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/83e2376b/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 6b5ddc5..35bc93f 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