Skip to content

Commit

Permalink
Use try-with-resource
Browse files Browse the repository at this point in the history
  • Loading branch information
zapek committed Aug 24, 2024
1 parent d29fab1 commit 61d4c22
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions common/src/main/java/io/xeres/common/util/OsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,10 @@ public static void setFileSecurity(Path path, boolean trusted)
Objects.requireNonNull(path);
if (SystemUtils.IS_OS_WINDOWS)
{
try
try (var ads = new RandomAccessFile(path + ":Zone.Identifier", "rw")) // We can't use Path.of() here as it won't accept the ':'
{
var ads = new RandomAccessFile(path + ":Zone.Identifier", "rw"); // We can't use Path.of() here as it won't accept the ':'
byte[] data = ("[ZoneTransfer]\r\nZoneId=" + (trusted ? "2" : "3") + "\r\nHostUrl=about:internet\r\n").getBytes();
ads.write(data);
ads.close();
}
catch (IOException e)
{
Expand Down

0 comments on commit 61d4c22

Please sign in to comment.