Gargi-jais11 commented on code in PR #9316:
URL: https://github.com/apache/ozone/pull/9316#discussion_r2536252817
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/stream/DirstreamClientHandler.java:
##########
@@ -80,6 +80,10 @@ public void doRead(ChannelHandlerContext ctx, ByteBuf buffer)
name.release();
buffer.skipBytes(1);
String[] parts = currentFileName.split(" ", 2);
+ if (parts.length < 2 || parts[1] == null || parts[1].isEmpty()) {
+ throw new IllegalArgumentException("Invalid file name format: " +
currentFileName
Review Comment:
The `parts[1] == null` check is redundant.
In Java, **String.split()** will never put a null value inside the array. If
the string is empty, it puts **""** (an empty string), not null.
```suggestion
if (parts.length < 2 || parts[1].isEmpty()) {
throw new IllegalArgumentException("Invalid file name format: " +
currentFileName
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]