You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pk...@apache.org on 2011/03/30 08:40:15 UTC

svn commit: r1086855 - /felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java

Author: pkriens
Date: Wed Mar 30 06:40:15 2011
New Revision: 1086855

URL: http://svn.apache.org/viewvc?rev=1086855&view=rev
Log:
FELIX-2984 Invalid handling of parameters (options were ok). It works now and the tests are running but I am not confident this code is correct yet. Will probably have to rewrite this.

Modified:
    felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java

Modified: felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java?rev=1086855&r1=1086854&r2=1086855&view=diff
==============================================================================
--- felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java (original)
+++ felix/trunk/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java Wed Mar 30 06:40:15 2011
@@ -107,7 +107,13 @@ public final class Reflective
 
                 Object[] parms = new Object[types.length];
                 int local = coerce(session, target, m, types, parms, xargs);
-                if ((local >= xargs.size()) && (local >= types.length))
+
+                // FELIX-2894 xargs can contain parameters thus the size
+		// does not match the available slots. I think someone
+		// copied the xargs list in coerce but that left xargs
+		// having an incorrect length
+ 
+                if (/*(local >= xargs.size()) && */(local >= types.length))
                 {
                     boolean exact = ((local == xargs.size()) && (local == types.length));
                     if (exact || (local > match))
@@ -236,12 +242,14 @@ public final class Reflective
                                 {
                                     if (name.equals(item))
                                     {
-                                        if (param.presentValue() == null)
+					// FELIX-2984 annotations never return null, the Parameter annotation
+					// returns UNSPECIFIED
+                                        if (param.presentValue() == null || param.presentValue().equals(Parameter.UNSPECIFIED))
                                         {
-                                            itArgs.remove();
+                                            itArgs.remove(); // parameter name
                                             assert itArgs.hasNext();
-                                            Object value = itArgs.next();
-                                            itArgs.remove();
+                                            Object value = itArgs.next(); // the value
+                                            itArgs.remove(); // remove it
                                             out[argIndex] = coerce(session, target,
                                                 types[argIndex], value);
                                         }
@@ -446,4 +454,4 @@ public final class Reflective
         return NO_MATCH;
     }
 
-}
\ No newline at end of file
+}