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:51 UTC
(maven-shared-jar) 01/01: Use a single try-with-resources block
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);
}