elharo commented on code in PR #166:
URL: https://github.com/apache/maven-shared-jar/pull/166#discussion_r3839698753
##########
src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java:
##########
@@ -105,20 +105,22 @@ public JarAnalyzer(File file) throws IOException {
throw ioe;
}
- // Obtain entries list.
- List<JarEntry> entries = Collections.list(jarFile.entries());
+ try {
+ // Obtain entries list.
+ List<JarEntry> entries = Collections.list(jarFile.entries());
Review Comment:
can this throw? why is it in the try block?
##########
src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java:
##########
@@ -105,20 +105,22 @@ public JarAnalyzer(File file) throws IOException {
throw ioe;
}
- // Obtain entries list.
- List<JarEntry> entries = Collections.list(jarFile.entries());
+ try {
+ // Obtain entries list.
+ List<JarEntry> entries = Collections.list(jarFile.entries());
- // Sorting of list is done by name to ensure a bytecode hash is always
consistent.
- entries.sort(Comparator.comparing(ZipEntry::getName));
+ // Sorting of list is done by name to ensure a bytecode hash is
always consistent.
Review Comment:
Sorting of list is done by name --> Sort list by name
##########
src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java:
##########
@@ -105,20 +105,22 @@ public JarAnalyzer(File file) throws IOException {
throw ioe;
}
- // Obtain entries list.
- List<JarEntry> entries = Collections.list(jarFile.entries());
+ try {
+ // Obtain entries list.
+ List<JarEntry> entries = Collections.list(jarFile.entries());
- // Sorting of list is done by name to ensure a bytecode hash is always
consistent.
- entries.sort(Comparator.comparing(ZipEntry::getName));
+ // Sorting of list is done by name to ensure a bytecode hash is
always consistent.
+ entries.sort(Comparator.comparing(ZipEntry::getName));
- Manifest manifest;
- try {
- manifest = jarFile.getManifest();
- } catch (IOException e) {
+ Manifest manifest = jarFile.getManifest();
+
+ this.jarData = new JarData(file, manifest, entries);
+ } catch (IOException | RuntimeException e) {
Review Comment:
don't catch raw RuntimeException
--
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]