Skip to content

Commit

Permalink
MvnProtocolHandlerService: Implement lastModfified()
Browse files Browse the repository at this point in the history
Determine last-modified timestamp based on the referenced file.

This silences warnings such as

  Server returned lastModified <= 0 for mvn:org.eclipse.jetty:jetty-p2:11.0.12:zip:p2site/content.xml

Fixes #982.
  • Loading branch information
sratz authored and laeubi committed Oct 12, 2022
1 parent 57d17d0 commit 9705f5d
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,19 @@ public InputStream getInputStream() throws IOException {
String urlSpec = "jar:" + location.toURI() + "!" + subPath;
return new URL(urlSpec).openStream();
}

@Override
public long getLastModified() {
try {
connect();
} catch (IOException e) {
return 0;
}
if(artifactResult == null || artifactResult.isMissing()) {
return 0;
}
return artifactResult.getArtifact().getFile().lastModified();
}
}

}

0 comments on commit 9705f5d

Please sign in to comment.