From 8c883a81853cfacce62af5cdc98d7fd7331d229e Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 10 Sep 2012 22:14:52 +0000 Subject: Fix NPE as the autowire is Boolean and the value can be null. The autoboxing will throw NPE. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1383128 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/core/runtime/impl/EndpointReferenceBinderImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index 4ce163f389..5118571e1f 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -495,14 +495,15 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { } // TUSCANY-4069 if no binding specified on reference then use service binding.sca if that exists - if (endpointReference.getBinding() == null && endpointReference.getReference().getAutowire() == true){ - for (Endpoint endpoint : matchedEndpoints){ - if (endpoint.getBinding() instanceof SCABinding){ + if (endpointReference.getBinding() == null && Boolean.TRUE.equals(endpointReference.getReference() + .getAutowire())) { + for (Endpoint endpoint : matchedEndpoints) { + if (endpoint.getBinding() instanceof SCABinding) { matchedEndpoint = endpoint; break; } } - } + } if (matchedEndpoint == null) { // just take the first matched endpoint from the list -- cgit v1.2.3