[CXF-6092] Add a couple NPE guards
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2d246e70 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2d246e70 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2d246e70 Branch: refs/heads/3.0.x-fixes Commit: 2d246e708ce9d586477bed79db384e8876f7170f Parents: 1f860a9 Author: Daniel Kulp <[email protected]> Authored: Fri Nov 7 13:25:52 2014 -0500 Committer: Daniel Kulp <[email protected]> Committed: Fri Nov 7 13:58:49 2014 -0500 ---------------------------------------------------------------------- core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2d246e70/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java index 9114c66..775170c 100644 --- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java +++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java @@ -325,7 +325,9 @@ public class ClientImpl try { return invoke(oi, params, context, exchange); } finally { - responseContext.put(Thread.currentThread(), resp); + if (responseContext != null) { + responseContext.put(Thread.currentThread(), resp); + } } } public Object[] invoke(BindingOperationInfo oi, @@ -336,7 +338,7 @@ public class ClientImpl } finally { if (context != null) { Map<String, Object> resp = CastUtils.cast((Map<?, ?>)context.get(RESPONSE_CONTEXT)); - if (resp != null) { + if (resp != null && responseContext != null) { responseContext.put(Thread.currentThread(), resp); } } @@ -811,7 +813,7 @@ public class ClientImpl .getOutMessage() .get(Message.INVOCATION_CONTEXT)); resCtx = CastUtils.cast((Map<?, ?>)resCtx.get(RESPONSE_CONTEXT)); - if (resCtx != null) { + if (resCtx != null && responseContext != null) { responseContext.put(Thread.currentThread(), resCtx); } try {
