summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-12 19:19:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-10-12 19:19:18 +0000
commit505393fe9d7d5a877570f5ea0e6be925383130ba (patch)
treee14c25ea941221b6b168afbfb66d010178efad6b
parent1765edfcd534f3c08534924477a62fb0e250284f (diff)
TUSCANY-3961 - modify so we don't rely on internal exception throwing
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1182535 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
index 5dc0e40684..e7c67a5477 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
@@ -318,9 +318,10 @@ public class EndpointReferenceBuilderImpl {
// parts in the uri.
EndpointReference endpointRef = createEndpointRef(component, reference, binding, null, false);
Endpoint endpoint = null;
- try {
- getSCATargetParts(uri);
+
+ String[] parts = getSCATargetParts(uri);
+ if (parts != null){
// the target uri might be an SCA target so create an endpoint
// so that the binder can test it against the fully populated
// registry
@@ -330,8 +331,8 @@ public class EndpointReferenceBuilderImpl {
// if it's an SCA binding we store it to influence the matching at runtime
endpointRef.setBinding(binding);
}
- endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI);
- } catch (Exception ex) {
+ endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI);
+ } else {
// the target string definitely isn't an SCA target string
// so we can assume here that the user has configured a
// resolved binding
@@ -671,7 +672,7 @@ public class EndpointReferenceBuilderImpl {
private String[] getSCATargetParts(String targetName){
String[] parts = targetName.split("/");
if (parts.length < 1 || parts.length > 3) {
- throw new IllegalArgumentException("Invalid target URI: " + targetName);
+ return null;
}
return parts;
}
@@ -691,6 +692,10 @@ public class EndpointReferenceBuilderImpl {
private Endpoint createEndpoint(Component component, String targetName) {
String[] parts = getSCATargetParts(targetName);
+ if (parts == null){
+ throw new IllegalArgumentException("Invalid target URI: " + targetName);
+ }
+
// Find the parent uri
String uri = component.getURI();
int index = uri.lastIndexOf('/');