Skip to content
Permalink
Browse files

[JENKINS-8856] Diagnostic improvement: show ‘'i' 'l' 'l' 'e' 'd' 0x0a…

…’ rather than ‘696c6c65640a’, so it is more obviously the rest of ‘Killed’.
  • Loading branch information
jglick committed Jul 26, 2013
1 parent 2b84547 commit d0334ba25b503038e17488cdbd5dd9bb5cb8121c
Showing with 11 additions and 3 deletions.
  1. +10 −2 src/main/java/hudson/remoting/HexDump.java
  2. +1 −1 src/test/java/hudson/remoting/HexDumpTest.java
@@ -12,9 +12,17 @@ public static String toHex(byte[] buf) {
public static String toHex(byte[] buf, int start, int len) {
StringBuilder r = new StringBuilder(len*2);
for (int i=0; i<len; i++) {
if (i > 0) {
r.append(' ');
}
byte b = buf[start+i];
r.append(CODE.charAt((b>>4)&15));
r.append(CODE.charAt(b&15));
if (b >= 0x20 && b <= 0x7e) {
r.append('\'').append((char) b).append('\'');
} else {
r.append("0x");
r.append(CODE.charAt((b>>4)&15));
r.append(CODE.charAt(b&15));
}
}
return r.toString();
}
@@ -7,6 +7,6 @@
*/
public class HexDumpTest extends TestCase {
public void test1() {
assertEquals("0001ff",HexDump.toHex(new byte[]{0,1,-1}));
assertEquals("0x00 0x01 0xff 'A'", HexDump.toHex(new byte[] {0, 1, -1, 65}));
}
}

0 comments on commit d0334ba

Please sign in to comment.