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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X 1948d4726 -> 2fc864580


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/2fc86458
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2fc86458
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2fc86458

Branch: refs/heads/GROOVY_2_5_X
Commit: 2fc8645803c3e5b05a3e080e02c3a376d0bba676
Parents: 1948d47
Author: Paul King <[hidden email]>
Authored: Fri Aug 10 21:27:37 2018 +1000
Committer: Paul King <[hidden email]>
Committed: Fri Aug 10 21:27: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/2fc86458/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