prashantpogde commented on code in PR #4360:
URL: https://github.com/apache/ozone/pull/4360#discussion_r1131612234


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshotManager.java:
##########
@@ -298,27 +366,144 @@ private void verifySnapshotInfoForSnapDiff(final 
SnapshotInfo fromSnapshot,
     }
   }
 
-  private ManagedRocksDB createDbForSnapshotDiff(OzoneConfiguration config) {
-    final ManagedOptions managedOptions = new ManagedOptions();
-    managedOptions.setCreateIfMissing(true);
+  private int getIndexFromToken(final String token) throws IOException {
+    if (isBlank(token)) {
+      return 0;
+    }
+
+    // Validate that token passed in the request is valid integer as of now.
+    // Later we can change it if we migrate to encrypted or cursor token.
+    try {
+      int index = Integer.parseInt(token);
+      if (index < 0) {
+        // Throws NFE which will be transformed to IOException later.
+        throw new NumberFormatException();

Review Comment:
   you could just throw the IOEXception directly from here, instead of 
try/ctach block.



-- 
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]

Reply via email to