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
This commit is contained in:
rfeng 2012-09-10 22:14:52 +00:00
parent e4660cb019
commit 8c883a8185

View file

@ -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