Skip to content

Commit 426f106

Browse files
author
Laurent Gougeon
committed
Fixed getPositionForKey method (should be based on allowedOptions).
1 parent e80d28f commit 426f106

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/ecmwf/common/database/SQLParameterParser.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,15 @@ private String getSQLStatement(final String keyName, final String operator, fina
403403
}
404404

405405
/**
406-
* Gets the position for key.
406+
* Gets the position for key. Return -1 if not found.
407407
*
408408
* @param keyName
409409
* the key name
410410
*
411411
* @return the position for key
412412
*/
413413
private int getPositionForKey(final String keyName) {
414-
return IntStream.range(0, params.size()).filter(i -> params.keySet().toArray()[i].equals(keyName)).findFirst()
414+
return IntStream.range(0, allowedOptions.size()).filter(i -> allowedOptions.get(i).equals(keyName)).findAny()
415415
.orElse(-1);
416416
}
417417

0 commit comments

Comments
 (0)