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


##########
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:
   Yes, that's what the code does.  I don't understand why.  What we want is a 
lock on the full file, so why just requesting 1 byte instead of the whole 
length (which will be extended automatically when written) ?
   This parameter seems useless to me.



-- 
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