Abyss-lord commented on code in PR #6285:
URL: https://github.com/apache/gravitino/pull/6285#discussion_r1917619876


##########
clients/cli/src/main/java/org/apache/gravitino/cli/AreYouSure.java:
##########
@@ -32,16 +32,16 @@ public class AreYouSure {
    * @return {@code true} if the action is to continue {@code false} otherwise.
    */
   public static boolean really(boolean force) {
-    Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8.name());
-
     /* force option for scripting */
     if (force) {
       return true;
     }
 
-    System.out.println(
-        "This command could result in data loss or other issues. Are you sure 
you want to do this? (Y/N)");
-    String answer = scanner.next();
-    return answer.equals("Y");
+    try (Scanner scanner = new Scanner(System.in, 
StandardCharsets.UTF_8.name())) {
+      System.out.println(
+          "This command could result in data loss or other issues. Are you 
sure you want to do this? (Y/N)");
+      String answer = scanner.next();
+      return answer.equals("Y");
+    }

Review Comment:
   @justinmclean I’ve finished updating the code. Please take a look at the PR 
again when you have time.



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

Reply via email to