thomasmueller commented on code in PR #2271: URL: https://github.com/apache/jackrabbit-oak/pull/2271#discussion_r2077831634
########## oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/util/ElasticIndexUtils.java: ########## @@ -106,16 +106,25 @@ public static String fieldName(String propertyName) { public static String idFromPath(@NotNull String path) { byte[] pathBytes = path.getBytes(StandardCharsets.UTF_8); if (pathBytes.length > 512) { - try { - return new String(MessageDigest.getInstance("SHA-256").digest(pathBytes), - StandardCharsets.UTF_8); - } catch (NoSuchAlgorithmException e) { - throw new IllegalStateException(e); - } + return sha256Hash(pathBytes); } return path; } + /** + * Computes the SHA-256 hash of the given byte array and returns it as a UTF-8 string. + * + * @param input the byte array to hash + * @return the SHA-256 hash as a string + */ + public static String sha256Hash(byte[] input) { + try { + return new String(MessageDigest.getInstance("SHA-256").digest(input), StandardCharsets.UTF_8); + } catch (NoSuchAlgorithmException e) { + throw new IllegalStateException(e); + } + } + Review Comment: ```suggestion * Computes the SHA-256 hash of the given byte array and returns it as a UTF-8 string. * * @param input the byte array to hash * @return the SHA-256 hash as a string */ public static String sha256Hash(byte[] input) { byte[] digest = MessageDigest.getInstance("SHA-256").digest(input); String hexString = StringUtils.convertBytesToHex(digest); } ``` ########## oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/util/ElasticIndexUtils.java: ########## @@ -106,16 +106,25 @@ public static String fieldName(String propertyName) { public static String idFromPath(@NotNull String path) { byte[] pathBytes = path.getBytes(StandardCharsets.UTF_8); if (pathBytes.length > 512) { - try { - return new String(MessageDigest.getInstance("SHA-256").digest(pathBytes), - StandardCharsets.UTF_8); - } catch (NoSuchAlgorithmException e) { - throw new IllegalStateException(e); - } Review Comment: This we would need to retain. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org