Bugfix in LightOptionParser when handling undefined options.

This commit is contained in:
Jonathan Bernard 2013-08-18 15:43:48 -05:00
parent 3668a9e112
commit 3fcc28d4ed
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#Sat, 10 Aug 2013 00:00:58 -0500 #Sun, 18 Aug 2013 15:42:51 -0500
name=jdb-util name=jdb-util
version=2.0 version=2.1
lib.local=true lib.local=true
build.number=2 build.number=0

View File

@ -28,12 +28,13 @@ public class LightOptionParser {
/// Find the definition for this option. /// Find the definition for this option.
def optDef = optionDefinitions.find { def optDef = optionDefinitions.find {
it.key == foundName || it.value.longName == foundName } it.key == foundName || it.value.longName == foundName }
def optName = optDef.key
optDef = optDef.value
if (!optDef) throw new IllegalArgumentException( if (!optDef) throw new IllegalArgumentException(
"Unrecognized option: '${args[optInfo.idx]}.") "Unrecognized option: '${args[optInfo.idx]}.")
def optName = optDef.key
optDef = optDef.value
/// Remember the option index for later. /// Remember the option index for later.
optionArgIndices << optInfo.idx optionArgIndices << optInfo.idx