Clean up 0xCAFEBABE string (again)

Missed a few last time.
This commit is contained in:
Matthew Smith 2015-09-01 10:25:24 +01:00
parent 09d4255e2a
commit 648997c00d
2 changed files with 2 additions and 8 deletions

View file

@ -833,10 +833,7 @@ public class BytecodeViewer {
} else if (fn.endsWith(".class")) { } else if (fn.endsWith(".class")) {
try { try {
byte[] bytes = JarUtils.getBytes(new FileInputStream(f)); byte[] bytes = JarUtils.getBytes(new FileInputStream(f));
String cafebabe = String.format("%02X", bytes[0]) String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]);
+ String.format("%02X", bytes[1])
+ String.format("%02X", bytes[2])
+ String.format("%02X", bytes[3]);
if(cafebabe.toLowerCase().equals("cafebabe")) { if(cafebabe.toLowerCase().equals("cafebabe")) {
final ClassNode cn = JarUtils.getNode(bytes); final ClassNode cn = JarUtils.getNode(bytes);

View file

@ -104,10 +104,7 @@ public class JarUtils {
final String name = entry.getName(); final String name = entry.getName();
if (name.endsWith(".class")) { if (name.endsWith(".class")) {
byte[] bytes = getBytes(jis); byte[] bytes = getBytes(jis);
String cafebabe = String.format("%02X", bytes[0]) String cafebabe = String.format("%02X%02X%02X%02X", bytes[0], bytes[1], bytes[2], bytes[3]);
+ String.format("%02X", bytes[1])
+ String.format("%02X", bytes[2])
+ String.format("%02X", bytes[3]);
if(cafebabe.toLowerCase().equals("cafebabe")) { if(cafebabe.toLowerCase().equals("cafebabe")) {
try { try {
final ClassNode cn = getNode(bytes); final ClassNode cn = getNode(bytes);