You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/05/13 06:39:58 UTC

[GitHub] [iotdb] mychaow commented on a diff in pull request #5867: [IOTDB-3175] Unable to find file when creating user with AuthorInfo

mychaow commented on code in PR #5867:
URL: https://github.com/apache/iotdb/pull/5867#discussion_r872044929


##########
node-commons/src/main/java/org/apache/iotdb/commons/auth/role/LocalFileRoleAccessor.java:
##########
@@ -84,10 +84,9 @@ public Role loadRole(String rolename) throws IOException {
         return null;
       }
     }
-
-    try (FileInputStream inputStream = new FileInputStream(roleProfile);
-        DataInputStream dataInputStream =
-            new DataInputStream(new BufferedInputStream(inputStream))) {
+    FileInputStream inputStream = new FileInputStream(roleProfile);

Review Comment:
   why do you move the inputstream out side of try? When to close the inputstream?



##########
node-commons/src/main/java/org/apache/iotdb/commons/auth/user/BasicUserManager.java:
##########
@@ -115,6 +116,10 @@ public boolean createUser(String username, String password) throws AuthException
     lock.writeLock(username);
     try {
       user = new User(username, AuthUtils.encryptPassword(password));
+      File userDirPath = new File(accessor.getDirPath());

Review Comment:
   Could you create the dir before other operation? like in the constructor?



##########
node-commons/src/main/java/org/apache/iotdb/commons/auth/user/LocalFileUserAccessor.java:
##########
@@ -98,9 +98,9 @@ public User loadUser(String username) throws IOException {
         return null;
       }
     }
-    try (FileInputStream inputStream = new FileInputStream(userProfile);
-        DataInputStream dataInputStream =
-            new DataInputStream(new BufferedInputStream(inputStream))) {
+    FileInputStream inputStream = new FileInputStream(userProfile);

Review Comment:
   Why move the code out of try?



-- 
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: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org