summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x')
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
index d737b839ba..733880a9b3 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
@@ -200,6 +200,11 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
return bindingInvocationChain;
}
+ /**
+ * A dummy invocation chain representing null as ConcurrentHashMap doesn't allow null values
+ */
+ private static final InvocationChain NULL_CHAIN = new InvocationChainImpl(null, null, false, null);
+
public InvocationChain getInvocationChain(Operation operation) {
InvocationChain cached = invocationChainMap.get(operation);
if (cached == null) {
@@ -211,9 +216,13 @@ public class RuntimeEndpointImpl extends EndpointImpl implements RuntimeEndpoint
return chain;
}
}
- invocationChainMap.put(operation, null);
+ // Cache it with the NULL_CHAIN to avoid NPE
+ invocationChainMap.put(operation, NULL_CHAIN);
return null;
} else {
+ if (cached == NULL_CHAIN) {
+ cached = null;
+ }
return cached;
}
}