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.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1086855 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java
index 7df0e17..5d3d21f 100644
--- a/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java
+++ b/gogo/runtime/src/main/java/org/apache/felix/gogo/runtime/Reflective.java
@@ -107,7 +107,13 @@
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 @@
{
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 @@
return NO_MATCH;
}
-}
\ No newline at end of file
+}