sabi0 commented on code in PR #13068: URL: https://github.com/apache/lucene/pull/13068#discussion_r1477434373
########## 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: Nice catch. Thank you. -- 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