You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/09/19 17:38:50 UTC
(maven-shared-jar) branch fix/file-hash-analyzer-returns-null created (now f997020)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch fix/file-hash-analyzer-returns-null
in repository https://gitbox.apache.org/repos/asf/maven-shared-jar.git
at f997020 Use a single try-with-resources block
This branch includes the following new commits:
new f997020 Use a single try-with-resources block
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-shared-jar) 01/01: Use a single try-with-resources block
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch fix/file-hash-analyzer-returns-null
in repository https://gitbox.apache.org/repos/asf/maven-shared-jar.git
commit f997020ec95516e9b96938c54b05dc0a5d5d1a96
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Sep 19 19:38:44 2026 +0200
Use a single try-with-resources block
---
.../shared/jar/identification/hash/JarFileHashAnalyzer.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/maven/shared/jar/identification/hash/JarFileHashAnalyzer.java b/src/main/java/org/apache/maven/shared/jar/identification/hash/JarFileHashAnalyzer.java
index 4def430..3e6f7f8 100644
--- a/src/main/java/org/apache/maven/shared/jar/identification/hash/JarFileHashAnalyzer.java
+++ b/src/main/java/org/apache/maven/shared/jar/identification/hash/JarFileHashAnalyzer.java
@@ -45,12 +45,10 @@ public class JarFileHashAnalyzer implements JarHashAnalyzer {
String result = jarData.getFileHash();
if (result == null) {
- try {
- try (InputStream inputStream =
- Files.newInputStream(jarData.getFile().toPath())) {
- result = DigestUtils.sha1Hex(inputStream);
- jarData.setFileHash(result);
- }
+ try (InputStream inputStream =
+ Files.newInputStream(jarData.getFile().toPath())) {
+ result = DigestUtils.sha1Hex(inputStream);
+ jarData.setFileHash(result);
} catch (IOException e) {
logger.warn("Unable to calculate the hashcode.", e);
}