rakeshadr commented on a change in pull request #2707:
URL: https://github.com/apache/ozone/pull/2707#discussion_r724722487
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/BucketLayout.java
##########
@@ -59,4 +60,10 @@ public static BucketLayout fromProto(
"Error: BucketLayout not found, type=" + this);
}
}
+
+ public static BucketLayout fromString(String value) {
+ // Todo: should we throw error if user configured unsupported value
+ // during OM startup or bucket creation time.
+ return StringUtils.isBlank(value) ? LEGACY : BucketLayout.valueOf(value);
Review comment:
@JyotinderSingh ok, you meant it can be null in unit tests where it uses
mocking. IMHO, please do :
1) Just add a java comment conveying that, this `isBlank` check is added for
testing purpose and value won't be null in production.
```
// This will never be null in production but can be null in mocked unit
test cases.
// Added safer `isBlank` check for unit test cases.
```
2) Move the existing todo comment to startup.
```
// Todo: need to validate then throw error or set to OM default layout
if user configured unsupported value
// during OM startup.
```
--
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]