mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-11-26 02:30:39 -06:00
nosqlbench-1966 ArrayIndexOutOfBoundsException in ArgsComparator during resolveFunctions call
This commit is contained in:
parent
883cde6fae
commit
014c82dc51
@ -89,7 +89,7 @@ public class NBSession extends NBHeartbeatComponent implements Function<List<Cmd
|
||||
|
||||
try (ResultContext results = new ResultContext(collector).ok()) {
|
||||
for (Cmd cmd : assembledCommands) {
|
||||
String explanation = " in context " + cmd.getTargetContext() + ", command '" + cmd.toString() + "'";
|
||||
String explanation = "in container '" + cmd.getTargetContext() + "', command '" + cmd.toString() + "'";
|
||||
try (NBInvokableCommand command = NBCommandAssembly.resolve(cmd,this::getContext)) {
|
||||
NBCommandParams params = NBCommandAssembly.paramsFor(cmd);
|
||||
NBBufferedContainer container = getContext(cmd.getTargetContext());
|
||||
|
@ -83,8 +83,14 @@ public class ArgsComparator implements Comparator<Constructor<?>> {
|
||||
int paramLen = ctor.getParameterCount();
|
||||
int argsLen = arguments.length;
|
||||
|
||||
if (paramLen!=argsLen && !ctor.isVarArgs()) {
|
||||
return MATCHRANK.INCOMPATIBLE;
|
||||
if (ctor.isVarArgs()) {
|
||||
if (argsLen<paramLen-1) {
|
||||
return MATCHRANK.INCOMPATIBLE;
|
||||
}
|
||||
} else {
|
||||
if (paramLen!=argsLen) {
|
||||
return MATCHRANK.INCOMPATIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
int len = arguments.length; // only consider varargs if some provided
|
||||
@ -94,7 +100,8 @@ public class ArgsComparator implements Comparator<Constructor<?>> {
|
||||
Class<?>[] atypes = Arrays.stream(arguments).map(Object::getClass).toArray(i -> new Class<?>[i]);
|
||||
|
||||
for (int position = 0; position < len; position++) {
|
||||
Class<?> ptype = ptypes[position];
|
||||
|
||||
Class<?> ptype = (position<ptypes.length) ? ptypes[position] : ptypes[ptypes.length-1];
|
||||
Class<?> atype = (position<atypes.length) ? atypes[position] : atypes[atypes.length-1];
|
||||
Class<?> across = WRAPPER_TYPE_MAP.get(atype);
|
||||
Class<?> pcross = WRAPPER_TYPE_MAP.get(ptype);
|
||||
|
Loading…
Reference in New Issue
Block a user