Pankraz76 commented on code in PR #2395:
URL: https://github.com/apache/maven/pull/2395#discussion_r2117696637


##########
compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java:
##########
@@ -66,51 +69,37 @@ public void storeInLocalRepository(ArtifactRepository 
localRepository, ArtifactR
 
     protected void updateRepositoryMetadata(ArtifactRepository 
localRepository, ArtifactRepository remoteRepository)
             throws IOException, XMLStreamException {
-        Metadata metadata = null;
-
         File metadataFile = new File(
                 localRepository.getBasedir(), 
localRepository.pathOfLocalRepositoryMetadata(this, remoteRepository));
-
-        if (metadataFile.length() == 0) {
+        Metadata metadata = this.metadata;
+        if (metadataFile.exists()) {
+            try (InputStream input = 
Files.newInputStream(metadataFile.toPath())) {
+                metadata = new Metadata(new MetadataStaxReader().read(input, 
false));
+            }
+        } else if (metadataFile.length() == 0) {
             if (!metadataFile.delete()) {
                 // sleep for 10ms just in case this is windows holding a file 
lock
                 try {
                     Thread.sleep(10);
-                } catch (InterruptedException e) {

Review Comment:
   extract



-- 
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: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to