From 648997c00df818726ca5b09f53a98ddf5476c929 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Tue, 1 Sep 2015 10:25:24 +0100 Subject: [PATCH] Clean up 0xCAFEBABE string (again) Missed a few last time. --- src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java | 5 +---- src/the/bytecode/club/bytecodeviewer/JarUtils.java | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 92fd797d..9c3641d3 100644 --- a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -833,10 +833,7 @@ public class BytecodeViewer { } else if (fn.endsWith(".class")) { try { byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); - String cafebabe = String.format("%02X", bytes[0]) - + String.format("%02X", bytes[1]) - + String.format("%02X", bytes[2]) - + String.format("%02X", bytes[3]); + String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]); if(cafebabe.toLowerCase().equals("cafebabe")) { final ClassNode cn = JarUtils.getNode(bytes); diff --git a/src/the/bytecode/club/bytecodeviewer/JarUtils.java b/src/the/bytecode/club/bytecodeviewer/JarUtils.java index 21f5d537..d9df2540 100644 --- a/src/the/bytecode/club/bytecodeviewer/JarUtils.java +++ b/src/the/bytecode/club/bytecodeviewer/JarUtils.java @@ -104,10 +104,7 @@ public class JarUtils { final String name = entry.getName(); if (name.endsWith(".class")) { byte[] bytes = getBytes(jis); - String cafebabe = String.format("%02X", bytes[0]) - + String.format("%02X", bytes[1]) - + String.format("%02X", bytes[2]) - + String.format("%02X", bytes[3]); + String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]); if(cafebabe.toLowerCase().equals("cafebabe")) { try { final ClassNode cn = getNode(bytes);