exceptionfactory commented on a change in pull request #4788:
URL: https://github.com/apache/nifi/pull/4788#discussion_r576442657
##########
File path:
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java
##########
@@ -137,25 +137,17 @@ private static boolean isNotBlank(final String value) {
return additionalClasspath.toArray(new
URL[additionalClasspath.size()]);
}
- public static String generateAdditionalUrlsFingerprint(Set<URL> urls) {
- List<String> listOfUrls =
urls.stream().map(Object::toString).collect(Collectors.toList());
- StringBuffer urlBuffer = new StringBuffer();
+ public static String generateAdditionalUrlsFingerprint(final Set<URL>
urls) {
+ final StringBuilder fingerprintBuilder = new StringBuilder();
//Sorting so that the order is maintained for generating the
fingerprint
- Collections.sort(listOfUrls);
- try {
- MessageDigest md = MessageDigest.getInstance("MD5");
- listOfUrls.forEach(url -> {
-
urlBuffer.append(url).append("-").append(getLastModified(url)).append(";");
- });
- byte[] bytesOfAdditionalUrls =
urlBuffer.toString().getBytes(StandardCharsets.UTF_8);
- byte[] bytesOfDigest = md.digest(bytesOfAdditionalUrls);
-
- return DatatypeConverter.printHexBinary(bytesOfDigest);
- } catch (NoSuchAlgorithmException e) {
- LOGGER.error("Unable to generate fingerprint for the provided
additional resources {}", new Object[]{urls, e});
- return null;
- }
+ final List<String> sortedUrls =
urls.stream().map(Object::toString).collect(Collectors.toList());
+ Collections.sort(sortedUrls);
Review comment:
Thanks for the clarification, that makes sense, will make the change.
----------------------------------------------------------------
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:
[email protected]