RFR: JDK-8264111 (fs) Leaking NativeBuffers in case of errors during UnixUserDefinedFileAttributeView.read/write
Sebastian Stenzel
github.com+1204330+overheadhunter at openjdk.java.net
Wed Mar 24 11:11:48 UTC 2021
Added new private methods for `read(String name, long address, int rem)` and `write(String name, long address, int rem)` that take an address as an argument and thereby no longer need to deal with any NativeBuffers.
This allows a certain simplification of `read(String name, ByteBuffer dst)` and `write(String name, ByteBuffer src)` and use of `try (NativeBuffer nb = NativeBuffers.getNativeBuffer(rem)) {...}` which fixes the issue.
-------------
Commit messages:
- refactor read and write to use try-with-resource for NativeBuffer
Changes: https://git.openjdk.java.net/jdk/pull/3171/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3171&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8264111
Stats: 86 lines in 1 file changed: 24 ins; 27 del; 35 mod
Patch: https://git.openjdk.java.net/jdk/pull/3171.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/3171/head:pull/3171
PR: https://git.openjdk.java.net/jdk/pull/3171
More information about the nio-dev
mailing list