From 27d1dea9ddcbb7f88742d51744ba640c9cb01a60 Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Tue, 20 Jul 2021 17:35:27 +0200 Subject: [PATCH] Read version directly from POM --- pom.xml | 25 +++++++++---------- .../club/bytecodeviewer/Constants.java | 2 +- .../compilers/impl/KrakatauAssembler.java | 2 -- .../decompilers/impl/CFRDecompiler.java | 1 - .../malwarescanner/MalwareCodeScanner.java | 6 ++--- .../bytecodeviewer/util/VersionChecker.java | 3 ++- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index feddd948..2f8d6f1f 100644 --- a/pom.xml +++ b/pom.xml @@ -237,19 +237,6 @@ - - org.apache.maven.plugins - maven-jar-plugin - 3.1.1 - - - - true - the.bytecode.club.bytecodeviewer.BytecodeViewer - - - - org.apache.maven.plugins maven-compiler-plugin @@ -287,9 +274,21 @@ META-INF/*.SF META-INF/*.DSA META-INF/*.RSA + META-INF/*LICENSE* + META-INF/*NOTICE* + META-INF/MANIFEST.MF + + + the.bytecode.club.bytecodeviewer.BytecodeViewer + + ${version} + + + diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java index b146fc4b..ebe19ff3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Constants.java @@ -16,7 +16,7 @@ import java.io.PrintStream; public class Constants { /*per version*/ - public static final String VERSION = "2.10.14"; //could be loaded from the pom + public static final String VERSION = BytecodeViewer.class.getPackage().getImplementationVersion(); public static String krakatauVersion = "12"; public static String enjarifyVersion = "4"; public static final boolean BLOCK_TAB_MENU = true; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/impl/KrakatauAssembler.java b/src/main/java/the/bytecode/club/bytecodeviewer/compilers/impl/KrakatauAssembler.java index 3093fc94..3ac886c4 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/compilers/impl/KrakatauAssembler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/compilers/impl/KrakatauAssembler.java @@ -51,8 +51,6 @@ public class KrakatauAssembler extends InternalCompiler if(!ExternalResources.getSingleton().hasSetPython2Command()) return null; - String origName = MiscUtils.randomString(20); - File tempD = new File(Constants.tempDirectory + fs + MiscUtils.randomString(32) + fs); tempD.mkdir(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/CFRDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/CFRDecompiler.java index e4a0243f..8d4a90a5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/CFRDecompiler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/CFRDecompiler.java @@ -11,7 +11,6 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Deque; import java.util.LinkedList; -import java.util.Objects; import java.util.Random; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareCodeScanner.java b/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareCodeScanner.java index 52e32a7f..bcfac4cc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareCodeScanner.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/malwarescanner/MalwareCodeScanner.java @@ -117,16 +117,16 @@ public abstract class MalwareCodeScanner implements CodeScanner public void foundLDC(MalwareScan scan, String ldc, String foundAt) { - scan.sb.append(header() + " Found LDC \"").append(ldc).append("\" ").append(foundAt); + scan.sb.append(header()).append(" Found LDC \"").append(ldc).append("\" ").append(foundAt); } public void foundMethod(MalwareScan scan, String foundAt) { - scan.sb.append(header() + " Found Method call to ").append(foundAt); + scan.sb.append(header()).append(" Found Method call to ").append(foundAt); } public void found(MalwareScan scan, String found) { - scan.sb.append(header() + " Found ").append(found); + scan.sb.append(header()).append(" Found ").append(found); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java index 9a7f6cdc..eda49bc7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/VersionChecker.java @@ -1,5 +1,6 @@ package the.bytecode.club.bytecodeviewer.util; +import java.util.Objects; import me.konloch.kontainer.io.HTTPRequest; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; @@ -58,7 +59,7 @@ public class VersionChecker implements Runnable } - if (!VERSION.equals(version)) + if (VERSION != null && !VERSION.equals(version)) { MultipleChoiceDialogue outdatedDialogue = new MultipleChoiceDialogue("Bytecode Viewer - Outdated Version", "Your version: " + VERSION + ", latest version: "