matthiasblaesing commented on issue #152: Case insensitive SHA-1 comparisons 
for downloaded binaries.
URL: 
https://github.com/apache/incubator-netbeans/pull/152#issuecomment-340212245
 
 
   I'm a bit ambivalent about this, as it introduces the possibility for subtle 
bugs. One side effect is, that if the same file is used twice in the code base 
it could be downloaded/cached multiple time as the hash is part of the cache 
file. Assuming this should be done an alternative idea would be to normalize 
the hash to upper case at read time. Based on current master, that would be 
this part in the `DownloadBinaries#execute` method:
   
   ```java
   String[] hashAndFile = line.split(" ", 2);
   if (hashAndFile.length < 2) {
       throw new BuildException("Bad line '" + line + "' in " + manifest, 
getLocation());
   }
   
   if (MavenCoordinate.isMavenFile(hashAndFile[1])) {
       MavenCoordinate mc = MavenCoordinate.fromGradleFormat(hashAndFile[1]);
       fillInFile(hashAndFile[0], mc.toArtifactFilename(), manifest, () -> 
mavenFile(mc));
   } else {
       fillInFile(hashAndFile[0], hashAndFile[1], manifest, () -> 
legacyDownload(hashAndFile[0] + "-" + hashAndFile[1]));
   }
   ```
   
   The first entry of hashAndFile is the hash and it could be converted there. 
What do you think?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to