Skip to content

Commit 648997c

Browse files
committed
Clean up 0xCAFEBABE string (again)
Missed a few last time.
1 parent 09d4255 commit 648997c

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,10 +833,7 @@ public void run() {
833833
} else if (fn.endsWith(".class")) {
834834
try {
835835
byte[] bytes = JarUtils.getBytes(new FileInputStream(f));
836-
String cafebabe = String.format("%02X", bytes[0])
837-
+ String.format("%02X", bytes[1])
838-
+ String.format("%02X", bytes[2])
839-
+ String.format("%02X", bytes[3]);
836+
String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]);
840837
if(cafebabe.toLowerCase().equals("cafebabe")) {
841838
final ClassNode cn = JarUtils.getNode(bytes);
842839

src/the/bytecode/club/bytecodeviewer/JarUtils.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ public static ArrayList<ClassNode> loadClasses(final File jarFile) throws IOExce
104104
final String name = entry.getName();
105105
if (name.endsWith(".class")) {
106106
byte[] bytes = getBytes(jis);
107-
String cafebabe = String.format("%02X", bytes[0])
108-
+ String.format("%02X", bytes[1])
109-
+ String.format("%02X", bytes[2])
110-
+ String.format("%02X", bytes[3]);
107+
String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]);
111108
if(cafebabe.toLowerCase().equals("cafebabe")) {
112109
try {
113110
final ClassNode cn = getNode(bytes);

0 commit comments

Comments
 (0)