Skip to content

Commit

Permalink
Revert variable initialization to empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Feb 3, 2025
1 parent 0369012 commit 7910ec5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,10 @@ public Action(@NonNull String name, @Nullable Args args, String version) {
* @throws IOException parsing error occurred.
*/
public static Action parse(XContentParser parser) throws IOException, IllegalArgumentException {
String name = null;
String name = "";
Args args = new Args();
String version = null;

// Make a deep clone of the parser, iterate it to read the value of action.name.
// Then, parse the rest fo arguments.

while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
String fieldName = parser.currentName();
parser.nextToken();
Expand All @@ -82,7 +79,6 @@ public static Action parse(XContentParser parser) throws IOException, IllegalArg
args = FetchConfigCommand.parse(parser);
break;
default:
log.info("name: {}", name);
log.info("Parsing arguments for [generic] command");
args = Args.parse(parser);
break;
Expand All @@ -97,10 +93,6 @@ public static Action parse(XContentParser parser) throws IOException, IllegalArg
}
}

if (name == null) {
throw new IllegalArgumentException("Missing mandatory field [command.action.name]");
}

return new Action(name, args, version);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private RestChannelConsumer handlePost(RestRequest request) throws IOException {
parser.nextToken();
if (parser.nextToken() == XContentParser.Token.START_ARRAY) {
commands = Command.parseToArray(parser);
log.warn(request.content().utf8ToString());
} else {
log.error("Token does not match {}", parser.currentToken());
}
Expand Down

0 comments on commit 7910ec5

Please sign in to comment.