You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2008/02/26 02:28:14 UTC

svn commit: r631056 - /incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java

Author: jsdelfino
Date: Mon Feb 25 17:28:13 2008
New Revision: 631056

URL: http://svn.apache.org/viewvc?rev=631056&view=rev
Log:
Fixed IndexOutOfBoundsException resolving componentType files at the root of a contribution. Added a FIXME tag to track that assembly-xml should not depend on java.imports/exports.

Modified:
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java?rev=631056&r1=631055&r2=631056&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java Mon Feb 25 17:28:13 2008
@@ -68,20 +68,25 @@
         //If not found, delegate the resolution to the imports (in this case based on the java imports)
         //compute the package name from the componentType URI
         if (unresolved instanceof ComponentType) {
-            String packageName = uri.substring(0, uri.lastIndexOf("/"));
-            for (Import import_ : this.contribution.getImports()) {
-                if (import_ instanceof JavaImport) {
-                	JavaImport javaImport = (JavaImport)import_;
-                	//check the import location against the computed package name from the componentType URI
-                    if (javaImport.getPackage().equals(packageName)) {
-                        // Delegate the resolution to the import resolver
-                        resolved = javaImport.getModelResolver().resolveModel(ComponentType.class, (ComponentType)unresolved);
-                        if (!resolved.isUnresolved()) {
-                            return modelClass.cast(resolved);
+            //FIXME The core assembly model now depends on java imports to 
+            // resolve componentTypes of all kinds, this is not right at all!!!
+            int s = uri.lastIndexOf('/');
+            if (s != -1) {
+                String packageName = uri.substring(0, uri.lastIndexOf("/"));
+                for (Import import_ : this.contribution.getImports()) {
+                    if (import_ instanceof JavaImport) {
+                    	JavaImport javaImport = (JavaImport)import_;
+                    	//check the import location against the computed package name from the componentType URI
+                        if (javaImport.getPackage().equals(packageName)) {
+                            // Delegate the resolution to the import resolver
+                            resolved = javaImport.getModelResolver().resolveModel(ComponentType.class, (ComponentType)unresolved);
+                            if (!resolved.isUnresolved()) {
+                                return modelClass.cast(resolved);
+                            }
                         }
                     }
                 }
-            }        	
+            }
         }
 
         return (T)unresolved;



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org