diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManagerLocks.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManagerLocks.java index def6e8cb7..b32dda96d 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManagerLocks.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/FilesystemPackageCacheManagerLocks.java @@ -3,6 +3,7 @@ package org.hl7.fhir.utilities.npm; import lombok.Getter; import lombok.With; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.filesystem.ManagedFileAccess; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -262,7 +263,7 @@ public class FilesystemPackageCacheManagerLocks { result = function.get(); } finally { - lockFile.renameTo(File.createTempFile(lockFile.getName(), ".lock-renamed")); + lockFile.renameTo(ManagedFileAccess.file(File.createTempFile(lockFile.getName(), ".lock-renamed").getAbsolutePath())); fileLock.release(); channel.close(); diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestProcessUtility.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestProcessUtility.java index 63e10bfd9..d8f054f3d 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestProcessUtility.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestProcessUtility.java @@ -1,5 +1,7 @@ package org.hl7.fhir.utilities.npm; +import org.hl7.fhir.utilities.filesystem.ManagedFileAccess; + import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; @@ -103,7 +105,7 @@ public class LockfileTestProcessUtility { System.out.println("File "+lockFileName+" is locked. Waiting for " + seconds + " seconds to release. "); Thread.sleep(seconds * 1000L); - lockFile.renameTo(File.createTempFile(lockFile.getName(), ".lock-renamed")); + lockFile.renameTo(ManagedFileAccess.file(File.createTempFile(lockFile.getName(), ".lock-renamed").getAbsolutePath())); fileLock.release(); channel.close(); diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestUtility.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestUtility.java index e7badf2f0..250e7bcb1 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestUtility.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/npm/LockfileTestUtility.java @@ -67,7 +67,7 @@ public class LockfileTestUtility { throw new TimeoutException("Timed out waiting for lock file creation: " + lockFileName); } // TODO This is a workaround for an edge condition that shows up with testing, where the lock is not reflected in - // the file system immediately. It is unlikely to appear in production environments, but should it occur, it will + // the file system immediately. It is unlikely to appear in production environments. Should it occur, it will // result in a lock file being erroneously reported as not having an owning process, and will cause a package to // fail to be loaded from that cache until the lock is cleaned up by cache initialization. Thread.sleep(100);