gnodet commented on code in PR #1692:
URL: https://github.com/apache/maven-resolver/pull/1692#discussion_r2569892890
##########
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:
what's the purpose of using `fileLock(fileChannel, x)` ? Why not using
`fileLock(fileChannel, 0)` ?
According to the javadoc:
> A value of zero means to lock all bytes from the specified starting
position to the end of the file, regardless of whether the file is subsequently
extended or truncated
--
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]