From f9698b83ecd7e620e92054a2b1d05584e9deaebd Mon Sep 17 00:00:00 2001 From: Kristian Kraljic Date: Wed, 14 Feb 2024 21:27:17 +0100 Subject: [PATCH] Fix copy & pasting legacy plugin components --- CHANGELOG.md | 4 ++++ pom.xml | 2 +- src/main/java/lc/kra/jds/Utilities.java | 18 +++++++----------- src/main/java/lc/kra/jds/gui/Application.java | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df1cd0..310994f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.5.2 (2024-02-13) +### Fixed + - Copy & pasting legacy plugin components + ## 2.5.1 (2024-02-13) ### Fixed - Loading worksheets with plugin components diff --git a/pom.xml b/pom.xml index c743971..0b18e42 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ lc.kra.jds jds - 2.5.1 + 2.5.2 JDigitalSimulator JDigitalSimulator is a plattform independend Electronic Design Automation software entirely build in Java diff --git a/src/main/java/lc/kra/jds/Utilities.java b/src/main/java/lc/kra/jds/Utilities.java index 6df2368..fcc5582 100644 --- a/src/main/java/lc/kra/jds/Utilities.java +++ b/src/main/java/lc/kra/jds/Utilities.java @@ -87,7 +87,7 @@ public static Object copy(Object object) throws CloneNotSupportedException { //d ObjectOutputStream objectOutput = new ObjectOutputStream(byteOutput); try { objectOutput.writeObject(object); } finally { objectOutput.close(); } - ObjectInputStream objectInput = new AlternateClassLoaderObjectInputStream(new ByteArrayInputStream(byteOutput.toByteArray()), Utilities.getSimpleClassLoader()); + ObjectInputStream objectInput = new LegacyObjectInputStream(new ByteArrayInputStream(byteOutput.toByteArray())); try { copy = objectInput.readObject(); } finally { objectInput.close(); } } catch(Exception e) { e.printStackTrace(); throw new CloneNotSupportedException(); } @@ -385,16 +385,12 @@ public LegacyObjectInputStream(InputStream in) throws IOException { @Override protected Class resolveClass(ObjectStreamClass descriptor) throws ClassNotFoundException, IOException { try { - return super.resolveClass(descriptor); - } catch (ClassNotFoundException e_a) { - try { - return Class.forName(descriptor.getName(), false, getSimpleClassLoader()); - } catch (ClassNotFoundException e_b) { - if (hasLegacyClassLoader()) { - return Class.forName(descriptor.getName(), false, getLegacyClassLoader()); - } else { - throw e_b; - } + return super.resolveClass(descriptor); // from simple or (parent) system class loader + } catch (ClassNotFoundException e) { + if (hasLegacyClassLoader()) { + return Class.forName(descriptor.getName(), false, getLegacyClassLoader()); + } else { + throw e; } } } diff --git a/src/main/java/lc/kra/jds/gui/Application.java b/src/main/java/lc/kra/jds/gui/Application.java index c946894..1514595 100644 --- a/src/main/java/lc/kra/jds/gui/Application.java +++ b/src/main/java/lc/kra/jds/gui/Application.java @@ -142,7 +142,7 @@ /** * JDigitalSimulator * @author Kristian Kraljic - * @version 2.5.1 + * @version 2.5.2 */ public class Application extends JFrame { private static final long serialVersionUID = -4693271310855486553L; @@ -150,7 +150,7 @@ public class Application extends JFrame { public static final String FILE_EXTENSION = "jdsim"; public static File pluginDirectory, currentDirectory; - private static final String VERSION = "2.5.1", COPYRIGHT = "2010-2024", LINES_OF_CODE = "9.509", WORDS_OF_CODE = "36.133", PAGES_OF_CODE = "245"; + private static final String VERSION = "2.5.2", COPYRIGHT = "2010-2024", LINES_OF_CODE = "9.509", WORDS_OF_CODE = "36.133", PAGES_OF_CODE = "245"; private static final String[] TOOLBAR_FRAME_FOCUS = new String[]{"save", "print", "print_level", "simulate", "left", "right", "up", "down", "grid", "secure", "zoom_default", "zoom", "zoom_in", "zoom_out"},