tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1182535 - /tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
Date Wed, 12 Oct 2011 19:19:19 GMT
Author: slaws
Date: Wed Oct 12 19:19:18 2011
New Revision: 1182535

URL: http://svn.apache.org/viewvc?rev=1182535&view=rev
Log:
TUSCANY-3961 - modify so we don't rely on internal exception throwing

Modified:
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java?rev=1182535&r1=1182534&r2=1182535&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
Wed Oct 12 19:19:18 2011
@@ -318,9 +318,10 @@ public class EndpointReferenceBuilderImp
                     // 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 EndpointReferenceBuilderImp
                             // 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 EndpointReferenceBuilderImp
     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 EndpointReferenceBuilderImp
     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('/');



Mime
View raw message