adoroszlai opened a new pull request #235: HDDS-2580. Ensure resources are closed in Get/PutKeyHandler URL: https://github.com/apache/hadoop-ozone/pull/235 ## What changes were proposed in this pull request? 1. Ensure input/output streams are closed in `GetKeyHandler` and `PutKeyHandler` 2. Remove unreachable `else` branch (`dataFilePath` is never `null`) 3. Use more generic types (`InputStream`/`OutputStream`) 4. Replace `Boolean.valueOf` with `Boolean.parseBoolean` (avoid unnecessary boxing) 5. Fix typo in overwrite error message (`will` -> `would`) https://issues.apache.org/jira/browse/HDDS-2580 ## How was this patch tested? Tested both `key put` and `key get` on compose-based cluster: ``` $ ozone freon ockg -t 1 -n 1 -p key ... $ ozone sh key put vol1/bucket1/key/test /etc/passwd $ ozone sh key get vol1/bucket1/key/test test.txt $ diff -q test.txt /etc/passwd $ ozone sh --verbose key put vol1/bucket1/key/verbose /etc/group Volume Name : vol1 Bucket Name : bucket1 Key Name : key/verbose File Hash : dce24e3a2699f6acc55bc913bd92ce61 $ ozone sh --verbose key get vol1/bucket1/key/verbose verbose.txt Volume Name : vol1 Bucket Name : bucket1 Key Name : key/verbose Downloaded file hash : dce24e3a2699f6acc55bc913bd92ce61 $ diff -q verbose.txt /etc/group $ ozone sh key get vol1/bucket1/key/test /etc/passwd /etc/passwd exists. Download would overwrite an existing file. Aborting. $ ozone sh key get vol1/bucket1/key/test /a/b/c/d /a/b/c/d (No such file or directory) $ ozone sh --verbose key get vol1/bucket1/key/test /a/b/c/d Volume Name : vol1 Bucket Name : bucket1 Key Name : key/test java.io.FileNotFoundException: /a/b/c/d (No such file or directory) ... $ ozone sh key put vol1/bucket1/key/error1 /a/b/c /a/b/c (No such file or directory) $ ozone sh --verbose key put vol1/bucket1/key/error2 /a/b/c Volume Name : vol1 Bucket Name : bucket1 Key Name : key/error2 java.io.FileNotFoundException: /a/b/c (No such file or directory) ... ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
