vieiro closed pull request #152: Case insensitive SHA-1 comparisons for 
downloaded binaries.
URL: https://github.com/apache/incubator-netbeans/pull/152
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
index 99eda7052..2063175b4 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/DownloadBinaries.java
@@ -202,7 +202,7 @@ private void mavenFile(String hash, MavenCoordinate mc, 
File manifest) throws IO
     private void hashedFile(String expectedHash, String baseName, File 
manifest) throws BuildException {
         File f = new File(manifest.getParentFile(), baseName);
         if (!clean) {
-            if (!f.exists() || !hash(f).equals(expectedHash)) {
+            if (!f.exists() || !hash(f).equalsIgnoreCase(expectedHash)) {
                 log("Creating " + f);
                 String cacheName = expectedHash + "-" + baseName;
                 if (cache != null) {
@@ -224,7 +224,7 @@ private void hashedFile(String expectedHash, String 
baseName, File manifest) thr
                 }
             }
             String actualHash = hash(f);
-            if (!actualHash.equals(expectedHash)) {
+            if (!actualHash.equalsIgnoreCase(expectedHash)) {
                 throw new BuildException("File " + f + " requested by " + 
manifest + " to have hash " +
                         expectedHash + " actually had hash " + actualHash, 
getLocation());
             }
@@ -232,7 +232,7 @@ private void hashedFile(String expectedHash, String 
baseName, File manifest) thr
         } else {
             if (f.exists()) {
                 String actualHash = hash(f);
-                if (!actualHash.equals(expectedHash)) {
+                if (!actualHash.equalsIgnoreCase(expectedHash)) {
                     throw new BuildException("File " + f + " requested by " + 
manifest + " to have hash " +
                             expectedHash + " actually had hash " + actualHash, 
getLocation());
                 }
@@ -292,7 +292,7 @@ private boolean downloadFromServer(URL url, String 
cacheName, File destination,
             byte[] data = baos.toByteArray();
             if (expectedHash != null) {
                 String actualHash = hash(new ByteArrayInputStream(data));
-                if (!expectedHash.equals(actualHash)) {
+                if (!expectedHash.equalsIgnoreCase(actualHash)) {
                     throw new BuildException("Download of " + url + " produced 
content with hash "
                             + actualHash + " when " + expectedHash + " was 
expected", getLocation());
                 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to