From c6794bc9e4399122014bc68eeb75e040668cd8ff Mon Sep 17 00:00:00 2001 From: helospark Date: Fri, 16 Nov 2018 22:03:49 +0100 Subject: [PATCH] #55 - Make sure plugin not fails on old version of Eclipse --- .../decompiler/util/JarClassExtractor.java | 16 ++++++++++++++-- pom.xml | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/JarClassExtractor.java b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/JarClassExtractor.java index 71a992af..e1303471 100644 --- a/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/JarClassExtractor.java +++ b/org.sf.feeling.decompiler/src/org/sf/feeling/decompiler/util/JarClassExtractor.java @@ -33,7 +33,7 @@ public class JarClassExtractor public static void extract( String archivePath, String packege, String className, boolean inner, String to ) throws IOException { - if ( archivePath.endsWith( JRTUtil.JRT_FS_JAR ) ) + if ( isClassInJrt( archivePath ) ) { extractClassFromJrt( archivePath, packege, className, to ); } @@ -43,6 +43,19 @@ public static void extract( String archivePath, String packege, String className } } + private static boolean isClassInJrt( String archivePath ) + { + try + { + return archivePath.endsWith( JRTUtil.JRT_FS_JAR ); + } + catch ( NoClassDefFoundError e ) + { + // Compatible with pre-Oxygen Eclipse, where JRTUtil does not exist + return false; + } + } + private static void extractClassFromJrt( String archivePath, String packege, String className, String to ) throws IOException, FileNotFoundException { @@ -57,7 +70,6 @@ private static void extractClassFromJrt( String archivePath, String packege, Str } catch ( ClassFormatException e ) { - e.printStackTrace( ); throw new RuntimeException( "Unable to read JRT file", e ); } } diff --git a/pom.xml b/pom.xml index 175fd690..0075c988 100644 --- a/pom.xml +++ b/pom.xml @@ -103,9 +103,9 @@ - eclipse-juno + eclipse-oxygen p2 - http://download.eclipse.org/releases/juno + http://download.eclipse.org/releases/oxygen