cstamas commented on code in PR #1692:
URL: https://github.com/apache/maven-resolver/pull/1692#discussion_r2569914186


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultTrackingFileManager.java:
##########
@@ -61,15 +62,14 @@ public Properties read(File file) {
     @Override
     public Properties read(Path path) {
         if (Files.isReadable(path)) {
-            synchronized (getMutex(path)) {
-                try {
-                    long fileSize = Files.size(path);
-                    try (FileChannel fileChannel = FileChannel.open(path, 
StandardOpenOption.READ);
-                            FileLock unused = fileLock(fileChannel, 
Math.max(1, fileSize), true)) {
-                        Properties props = new Properties();
-                        props.load(Channels.newInputStream(fileChannel));
-                        return props;
-                    }
+            synchronized (mutex(path)) {
+                try (FileChannel fileChannel = FileChannel.open(path, 
StandardOpenOption.READ);
+                        FileLock unused = fileLock(fileChannel, Math.max(1, 
fileChannel.size()), true)) {

Review Comment:
   Basically we lock with `size` 0 or 1 (so all or [0..1] bytes), based on file 
was just created or existed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to