mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8292279: (fs) Use try-with-resources to release NativeBuffer
Reviewed-by: alanb
This commit is contained in:
parent
a25e1dc53c
commit
1d9c2f7a6e
13 changed files with 61 additions and 168 deletions
|
@ -55,11 +55,8 @@ class BsdNativeDispatcher extends UnixNativeDispatcher {
|
|||
* returns buf->f_mntonname (directory on which mounted)
|
||||
*/
|
||||
static byte[] getmntonname(UnixPath path) throws UnixException {
|
||||
NativeBuffer pathBuffer = copyToNativeBuffer(path);
|
||||
try {
|
||||
try (NativeBuffer pathBuffer = copyToNativeBuffer(path)) {
|
||||
return getmntonname0(pathBuffer.address());
|
||||
} finally {
|
||||
pathBuffer.release();
|
||||
}
|
||||
}
|
||||
static native byte[] getmntonname0(long pathAddress) throws UnixException;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue