mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +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
|
@ -337,13 +337,10 @@ abstract class UnixUserDefinedFileAttributeView
|
|||
throws UnixException
|
||||
{
|
||||
int size = fgetxattr(ofd, name, 0L, 0);
|
||||
NativeBuffer buffer = NativeBuffers.getNativeBuffer(size);
|
||||
try {
|
||||
try (NativeBuffer buffer = NativeBuffers.getNativeBuffer(size)) {
|
||||
long address = buffer.address();
|
||||
size = fgetxattr(ofd, name, address, size);
|
||||
fsetxattr(nfd, name, address, size);
|
||||
} finally {
|
||||
buffer.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue