uschindler commented on code in PR #13068: URL: https://github.com/apache/lucene/pull/13068#discussion_r1477431195
########## lucene/core/src/java/org/apache/lucene/util/ToStringUtils.java: ########## @@ -32,11 +32,37 @@ public static void byteArray(StringBuilder buffer, byte[] bytes) { private static final char[] HEX = "0123456789abcdef".toCharArray(); + /** + * Unlike {@link Long#toHexString(long)} returns a String with a "0x" prefix and all the leading + * zeros. + */ public static String longHex(long x) { char[] asHex = new char[16]; for (int i = 16; --i >= 0; x >>>= 4) { asHex[i] = HEX[(int) x & 0x0F]; } return "0x" + new String(asHex); } + + @SuppressWarnings("unused") + public static String brToString(BytesRef b) { + if (b == null) { + return "null"; + } + try { + return b.utf8ToString() + " " + b; + } catch (Throwable t) { Review Comment: This method should not catch Throwable, can we not make a multi-catch out of it and explicitely: - `AssertionFailedError` (if we hit an Assertion) - `RuntimeException` (anything is wrong and we have wrong offsets or bytes array is too short or incomplete surrogates -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org