[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/1bde7c9a Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1bde7c9a Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1bde7c9a Branch: refs/heads/2.7.x-fixes Commit: 1bde7c9a31a473bf73ad246c2f3d3996cae7d09b Parents: d951a5d Author: Daniel Kulp <[email protected]> Authored: Fri Nov 7 13:25:52 2014 -0500 Committer: Daniel Kulp <[email protected]> Committed: Fri Nov 7 14:44:06 2014 -0500 ---------------------------------------------------------------------- api/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/1bde7c9a/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java index 4971677..bab6091 100644 --- a/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java +++ b/api/src/main/java/org/apache/cxf/endpoint/ClientImpl.java @@ -381,7 +381,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, @@ -392,7 +394,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); } } @@ -858,7 +860,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 {
