You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/09/06 00:24:06 UTC

svn commit: r573085 - in /incubator/tuscany/java/sca/modules: implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/

Author: rfeng
Date: Wed Sep  5 15:24:01 2007
New Revision: 573085

URL: http://svn.apache.org/viewvc?rev=573085&view=rev
Log:
Fix for TUSCANY-1517

Modified:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetMethodNotFoundException.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java?rev=573085&r1=573084&r2=573085&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java Wed Sep  5 15:24:01 2007
@@ -141,7 +141,8 @@
                 Class<?> businessInterface = element.getType();
                 ObjectFactory<?> factory = null;
                 if (CallableReference.class.isAssignableFrom(element.getType())) {
-                    businessInterface = JavaIntrospectionHelper.getBusinessInterface(element.getType(), element.getGenericType());
+                    businessInterface =
+                        JavaIntrospectionHelper.getBusinessInterface(element.getType(), element.getGenericType());
                     factory =
                         new CallableReferenceObjectFactory(new CallbackWireObjectFactory(businessInterface,
                                                                                          proxyFactory, wires));
@@ -268,7 +269,11 @@
                 return invoker;
             }
         } catch (NoSuchMethodException e) {
-            throw new TargetMethodNotFoundException(operation);
+            throw new TargetMethodNotFoundException("No matching method is found for operation " + operation.getName()
+                + " in the implementation ("
+                + implClass
+                + ") of component "
+                + component.getURI(), e, operation);
         }
 
     }

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetMethodNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetMethodNotFoundException.java?rev=573085&r1=573084&r2=573085&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetMethodNotFoundException.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetMethodNotFoundException.java Wed Sep  5 15:24:01 2007
@@ -25,17 +25,14 @@
  * @version $Rev$ $Date$
  */
 public class TargetMethodNotFoundException extends TargetInvokerCreationException {
-    /**
-     * 
-     */
     private static final long serialVersionUID = -8565552977647191863L;
     private Operation operation;
 
     /**
      * @param operation
      */
-    public TargetMethodNotFoundException(Operation operation) {
-        super("Target method not found for operation");
+    public TargetMethodNotFoundException(String message, Throwable e, Operation operation) {
+        super(message, e);
         this.operation = operation;
     }
 

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java?rev=573085&r1=573084&r2=573085&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java Wed Sep  5 15:24:01 2007
@@ -48,16 +48,18 @@
      * @throws NoSuchMethodException if no such method exists
      * @Deprecated
      */
-    public static  Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
+    public static Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
         String name = operation.getName();
         Interface interface1 = operation.getInterface();
-        if(interface1!=null && interface1.isRemotable()) {
-            for(Method m: implClass.getMethods()) {
-                if(m.getName().equals(name)) {
+        if (interface1 != null && interface1.isRemotable()) {
+            for (Method m : implClass.getMethods()) {
+                if (m.getName().equals(name)) {
                     return m;
                 }
             }
-            throw new NoSuchMethodException(name);
+            throw new NoSuchMethodException("No matching method for operation " + operation.getName()
+                + " is found on "
+                + implClass);
         }
         Class<?>[] paramTypes = getPhysicalTypes(operation);
         return implClass.getMethod(name, paramTypes);
@@ -66,9 +68,9 @@
     /**
      * @Deprecated
      */
-    private static  Class<?>[] getPhysicalTypes(Operation operation) {
+    private static Class<?>[] getPhysicalTypes(Operation operation) {
         DataType<List<DataType>> inputType = operation.getInputType();
-        if(inputType==null) {
+        if (inputType == null) {
             return new Class<?>[] {};
         }
         List<DataType> types = inputType.getLogical();
@@ -76,7 +78,7 @@
         for (int i = 0; i < javaTypes.length; i++) {
             Type physical = types.get(i).getPhysical();
             if (physical instanceof Class<?>) {
-                javaTypes[i] = (Class<?>) physical;
+                javaTypes[i] = (Class<?>)physical;
             } else {
                 throw new UnsupportedOperationException();
             }
@@ -106,7 +108,7 @@
      * 
      * @return true if the operation matches, false if does not
      */
-    private static  boolean match(Operation operation, Method method) {
+    private static boolean match(Operation operation, Method method) {
         Class<?>[] params = method.getParameterTypes();
         DataType<List<DataType>> inputType = operation.getInputType();
         List<DataType> types = inputType.getLogical();
@@ -124,6 +126,5 @@
         return found;
 
     }
-
 
 }



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