From 688ccc9b455f639d5ce0668d395d273055d1ad3b Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Jun 2023 19:18:25 +0200 Subject: [PATCH 1/4] Explicitly clone ID --- .../src/net/sf/openrocket/rocketcomponent/RocketComponent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java index 01b5b6820..b4a4b91e2 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java +++ b/core/src/net/sf/openrocket/rocketcomponent/RocketComponent.java @@ -408,7 +408,8 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab checkState(); RocketComponent clone; try { - clone = (RocketComponent) this.clone(); + clone = this.clone(); + clone.id = this.id; } catch (CloneNotSupportedException e) { throw new BugException("CloneNotSupportedException encountered, report a bug!", e); } From 78f1ee3a94662414745c6b18554eaf7a15282cd2 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Jun 2023 19:25:03 +0200 Subject: [PATCH 2/4] Better exception handling --- core/src/net/sf/openrocket/rocketcomponent/Rocket.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java index 513f16391..413e99b23 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Rocket.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Rocket.java @@ -375,6 +375,9 @@ public class Rocket extends ComponentAssembly { copyRocket.stageMap = new ConcurrentHashMap<>(); for( Map.Entry entry : this.stageMap.entrySet()){ final AxialStage stage = (AxialStage)copyRocket.findComponent(entry.getValue().getID()); + if (stage == null) { + throw new IllegalStateException("Stage not found in copy"); + } copyRocket.stageMap.put(entry.getKey(), stage); } From f28f9f88a5a2f6e52a379eec0ec853c445c2a0f8 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Jun 2023 19:25:14 +0200 Subject: [PATCH 3/4] Fix workspace formatting bug --- .idea/workspace.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0fa52f5fc..f82ae0323 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -81,10 +81,11 @@ - - 1625095153807 - \ No newline at end of file From 26022915e4a77da861947609f3fe2cb0aed3be74 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Thu, 29 Jun 2023 21:46:11 +0200 Subject: [PATCH 4/4] Stop tracking .idea/workspace.xml --- .idea/workspace.xml | 91 --------------------------------------------- 1 file changed, 91 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index f82ae0323..000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1625095153807 - - - \ No newline at end of file