You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2018/08/10 12:09:51 UTC

[2/3] groovy git commit: GROOVY-8740: groovy.util.CliBuilder doesn't handle parse errors correctly

GROOVY-8740: groovy.util.CliBuilder doesn't handle parse errors correctly


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/044c3c43
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/044c3c43
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/044c3c43

Branch: refs/heads/master
Commit: 044c3c43de61a1eab3d1054fdf7f4a85ea789eb2
Parents: 8591266
Author: Paul King <pa...@asert.com.au>
Authored: Fri Aug 10 21:27:37 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Fri Aug 10 22:09:37 2018 +1000

----------------------------------------------------------------------
 .../src/main/groovy/groovy/util/CliBuilder.groovy                | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/044c3c43/subprojects/groovy-cli-commons/src/main/groovy/groovy/util/CliBuilder.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-cli-commons/src/main/groovy/groovy/util/CliBuilder.groovy b/subprojects/groovy-cli-commons/src/main/groovy/groovy/util/CliBuilder.groovy
index 58ec973..4d729a7 100644
--- a/subprojects/groovy-cli-commons/src/main/groovy/groovy/util/CliBuilder.groovy
+++ b/subprojects/groovy-cli-commons/src/main/groovy/groovy/util/CliBuilder.groovy
@@ -18,6 +18,7 @@
  */
 package groovy.util
 
+import groovy.cli.commons.OptionAccessor
 import org.apache.commons.cli.CommandLineParser
 import org.apache.commons.cli.HelpFormatter
 
@@ -31,7 +32,8 @@ class CliBuilder {
 
     // explicit delegate to convert return type to expected legacy package
     OptionAccessor parse(args) {
-        return new OptionAccessor(delegate: delegate.parse(args))
+        def result = delegate.parse(args)
+        return result == null ? null : new OptionAccessor(delegate: result)
     }
 
     // explicit delegate since groovyObject methods ignored by @Delegate