From 3d8700d727f5aca1c4f9e5fad3ed8957527c5b64 Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Thu, 3 Jan 2019 11:27:08 +0300 Subject: [PATCH 1/2] AsmFix (#118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * AsmFix P1 * ASMFix P2 или как asm 7 тупит. --- .../ru/gravit/launchserver/asm/ClassMetadataReader.java | 9 ++++++--- .../gravit/launchserver/manangers/NodeTransformer.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java b/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java index 53cf3e89..c1f07859 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/asm/ClassMetadataReader.java @@ -23,7 +23,7 @@ private class CheckSuperClassVisitor extends ClassVisitor { String superClassName; public CheckSuperClassVisitor() { - super(Opcodes.ASM5); + super(Opcodes.ASM7); } @Override @@ -57,10 +57,13 @@ public void acceptVisitor(String className, ClassVisitor visitor) throws IOExcep public byte[] getClassData(String className) throws IOException { for (JarFile f : cp) { - if (f.getEntry(className + ".class") != null) + if (f.getEntry(className + ".class") != null) { + byte[] bytes = null; try (InputStream in = f.getInputStream(f.getEntry(className + ".class"))) { - return IOHelper.read(in); + bytes = IOHelper.read(in); } + return bytes; + } } return IOHelper.read(IOHelper.getResourceURL(className + ".class")); } diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/NodeTransformer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/NodeTransformer.java index 59dbd2b4..f90f0a1d 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/NodeTransformer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/manangers/NodeTransformer.java @@ -33,7 +33,7 @@ public byte[] transform(byte[] input, String classname, JARLauncherBinary data) ClassNode cn = new ClassNode(); cr.accept(cn, ClassReader.SKIP_DEBUG); for (ClassNodeTransformer tr : transLst) tr.transform(cn, classname, data); - ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_FRAMES); + ClassWriter cw = new SafeClassWriter(data.reader, ClassWriter.COMPUTE_MAXS); cn.accept(cw); return cw.toByteArray(); } From f812129d81a67228eff401d151f82caa98391887 Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Thu, 3 Jan 2019 12:33:14 +0300 Subject: [PATCH 2/2] Modules upd + Integer -> int. (#117) --- .../ru/gravit/launchserver/socket/ServerSocketHandler.java | 4 ++-- modules | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/ServerSocketHandler.java b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/ServerSocketHandler.java index f80075e6..93fb1ce3 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/socket/ServerSocketHandler.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/socket/ServerSocketHandler.java @@ -27,7 +27,7 @@ public interface Listener { void onDisconnect(Exception e); - boolean onHandshake(long session, Integer type); + boolean onHandshake(long session, int type); } private static final ThreadFactory THREAD_FACTORY = r -> CommonHelper.newThread("Network Thread", true, r); @@ -76,7 +76,7 @@ public void close() { listener.onDisconnect(e); } - /*package*/ boolean onHandshake(long session, Integer type) { + /*package*/ boolean onHandshake(long session, int type) { return listener == null || listener.onHandshake(session, type); } diff --git a/modules b/modules index eec958f2..ec143160 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit eec958f2c5edbc7c053686ab7cebaab8dbca2778 +Subproject commit ec1431605c4951ace5cbd2ab392b67cea25bddd5