Skip to content

Commit

Permalink
Fix CommandLineParser throw ArrayIndexOutOfBoundsException when t…
Browse files Browse the repository at this point in the history
…he option value is empty

Closes gh-769
  • Loading branch information
rainboyan committed Dec 2, 2024
1 parent 4a1894a commit 61f5a76
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2023 the original author or authors.
* Copyright 2011-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -268,7 +268,7 @@ protected String processOption(DefaultCommandLine cl, String arg) {
String[] split = arg.split("=");
String name = split[0].trim();
validateOptionName(name);
String value = split[1].trim();
String value = split.length > 1 ? split[1].trim() : null;
if (this.declaredOptions.containsKey(name)) {
cl.addDeclaredOption(name, this.declaredOptions.get(name), value);
}
Expand Down

0 comments on commit 61f5a76

Please sign in to comment.