From 3fcc28d4ed5662bf60f6a4e89684fc4a4867d9e9 Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 18 Aug 2013 15:43:48 -0500 Subject: [PATCH] Bugfix in LightOptionParser when handling undefined options. --- project.properties | 6 +++--- src/main/com/jdbernard/util/LightOptionParser.groovy | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/project.properties b/project.properties index 6730b47..baeadd7 100644 --- a/project.properties +++ b/project.properties @@ -1,6 +1,6 @@ -#Sat, 10 Aug 2013 00:00:58 -0500 +#Sun, 18 Aug 2013 15:42:51 -0500 name=jdb-util -version=2.0 +version=2.1 lib.local=true -build.number=2 +build.number=0 diff --git a/src/main/com/jdbernard/util/LightOptionParser.groovy b/src/main/com/jdbernard/util/LightOptionParser.groovy index abbd659..ffd36a6 100644 --- a/src/main/com/jdbernard/util/LightOptionParser.groovy +++ b/src/main/com/jdbernard/util/LightOptionParser.groovy @@ -28,12 +28,13 @@ public class LightOptionParser { /// Find the definition for this option. def optDef = optionDefinitions.find { it.key == foundName || it.value.longName == foundName } - def optName = optDef.key - optDef = optDef.value if (!optDef) throw new IllegalArgumentException( "Unrecognized option: '${args[optInfo.idx]}.") + def optName = optDef.key + optDef = optDef.value + /// Remember the option index for later. optionArgIndices << optInfo.idx