You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/01/12 07:38:13 UTC

[GitHub] [maven-resolver] cstamas opened a new pull request #89: [MRESOLVER-158] Simplify SimpleDigest

cstamas opened a new pull request #89:
URL: https://github.com/apache/maven-resolver/pull/89


   https://issues.apache.org/jira/browse/MRESOLVER-158


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] michael-o commented on a change in pull request #89: [MRESOLVER-158] Simplify SimpleDigest

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #89:
URL: https://github.com/apache/maven-resolver/pull/89#discussion_r555570883



##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/SimpleDigest.java
##########
@@ -32,26 +35,23 @@
 
     private static final String[] HASH_ALGOS = new String[] { "SHA-1", "MD5" };
 
-    private MessageDigest digest;
-
-    private long hash;
+    private final MessageDigest digest;
 
     SimpleDigest()
     {
+        MessageDigest md = null;
         for ( String hashAlgo : HASH_ALGOS )
         {
             try
             {
-                digest = MessageDigest.getInstance( hashAlgo );
-                hash = 0;
+                md = MessageDigest.getInstance( hashAlgo );
                 break;
             }
             catch ( NoSuchAlgorithmException ne )
             {
-                digest = null;
-                hash = 13;
             }
         }
+        this.digest = requireNonNull( md, "Not supported digests: " + Arrays.toString( HASH_ALGOS ) );

Review comment:
       I think this should be IllegalStateException because no null has been passed, but an argument led to an inconsistent state.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] cstamas commented on a change in pull request #89: [MRESOLVER-158] Simplify SimpleDigest

Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #89:
URL: https://github.com/apache/maven-resolver/pull/89#discussion_r555575311



##########
File path: maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/SimpleDigest.java
##########
@@ -32,26 +35,23 @@
 
     private static final String[] HASH_ALGOS = new String[] { "SHA-1", "MD5" };
 
-    private MessageDigest digest;
-
-    private long hash;
+    private final MessageDigest digest;
 
     SimpleDigest()
     {
+        MessageDigest md = null;
         for ( String hashAlgo : HASH_ALGOS )
         {
             try
             {
-                digest = MessageDigest.getInstance( hashAlgo );
-                hash = 0;
+                md = MessageDigest.getInstance( hashAlgo );
                 break;
             }
             catch ( NoSuchAlgorithmException ne )
             {
-                digest = null;
-                hash = 13;
             }
         }
+        this.digest = requireNonNull( md, "Not supported digests: " + Arrays.toString( HASH_ALGOS ) );

Review comment:
       changed




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] cstamas closed pull request #89: [MRESOLVER-158] Simplify SimpleDigest

Posted by GitBox <gi...@apache.org>.
cstamas closed pull request #89:
URL: https://github.com/apache/maven-resolver/pull/89


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] cstamas commented on pull request #89: [MRESOLVER-158] Simplify SimpleDigest

Posted by GitBox <gi...@apache.org>.
cstamas commented on pull request #89:
URL: https://github.com/apache/maven-resolver/pull/89#issuecomment-758493541


   merged as 6c418e32ed9c12f1deadbf3be9ab0ab67aa09217


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org