Skip to content

Commit 61f5a76

Browse files
committed
Fix CommandLineParser throw ArrayIndexOutOfBoundsException when the option value is empty
Closes gh-769
1 parent 4a1894a commit 61f5a76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

grace-bootstrap/src/main/groovy/org/grails/build/parsing/CommandLineParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2011-2023 the original author or authors.
2+
* Copyright 2011-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -268,7 +268,7 @@ protected String processOption(DefaultCommandLine cl, String arg) {
268268
String[] split = arg.split("=");
269269
String name = split[0].trim();
270270
validateOptionName(name);
271-
String value = split[1].trim();
271+
String value = split.length > 1 ? split[1].trim() : null;
272272
if (this.declaredOptions.containsKey(name)) {
273273
cl.addDeclaredOption(name, this.declaredOptions.get(name), value);
274274
}

0 commit comments

Comments
 (0)