elharo commented on code in PR #177:
URL: https://github.com/apache/maven-shared-jar/pull/177#discussion_r4115060527


##########
src/main/java/org/apache/maven/shared/jar/identification/hash/JarBytecodeHashAnalyzer.java:
##########
@@ -43,25 +43,46 @@
 public class JarBytecodeHashAnalyzer implements JarHashAnalyzer {
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
+    /**
+     * Computes the bytecode hash while retaining the historical null-on-error 
behaviour.
+     *
+     * @param jarAnalyzer the JAR analyzer to use
+     * @return the hash, or {@code null} when the hash cannot be computed
+     * @deprecated use {@link #computeHashWithIOException(JarAnalyzer)} when 
the failure must be handled by the caller
+     */
+    @Deprecated
+    @Override
     public String computeHash(JarAnalyzer jarAnalyzer) {
+        try {
+            return computeHashWithIOException(jarAnalyzer);
+        } catch (IOException e) {
+            logger.warn("Unable to calculate the hashcode.", e);
+            return null;
+        }
+    }
+
+    /**
+     * Computes the bytecode hash and reports I/O failures to the caller.
+     *
+     * @param jarAnalyzer the JAR analyzer to use
+     * @return the computed hash
+     * @throws IOException if a class entry cannot be read
+     */
+    public String computeHashWithIOException(JarAnalyzer jarAnalyzer) throws 
IOException {

Review Comment:
   maybe just computeHashCode



-- 
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]

Reply via email to