From 121b1269dedae1e8d4843668e82d3c86960b46eb Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 16 Mar 2011 10:27:16 +0000 Subject: Be a bit more careful about dereferencing the DomainRegistryFactory endpointRegistries collection. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1082114 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/core/invocation/AsyncResponseInvoker.java | 12 ++++++++---- 1 file changed, 8 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/invocation/AsyncResponseInvoker.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java index 1186da72f0..87b8da62a9 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AsyncResponseInvoker.java @@ -337,11 +337,15 @@ public class AsyncResponseInvoker implements InvokerAsyncResponse, Serializab } // end for } // end if - // if there was no domainName to match, simply return the first EndpointRegistry... - EndpointRegistry endpointRegistry = (EndpointRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; + // if there was no domainName to match, simply return the first EndpointRegistry if there is one... + + if (domainRegistryFactory.getEndpointRegistries().size() > 0){ + EndpointRegistry endpointRegistry = (EndpointRegistry) domainRegistryFactory.getEndpointRegistries().toArray()[0]; + return endpointRegistry; + } else { + return null; + } - - return endpointRegistry; } // end method } // end class -- cgit v1.2.3