Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Exception when editing nose cone #2657

Closed
SiboVG opened this issue Jan 5, 2025 · 2 comments · Fixed by #2658
Closed

[Bug] Exception when editing nose cone #2657

SiboVG opened this issue Jan 5, 2025 · 2 comments · Fixed by #2658
Assignees
Labels
bug release blocker Release blocking bug

Comments

@SiboVG
Copy link
Member

SiboVG commented Jan 5, 2025

Describe the bug

A user reported an exception when opening the attached file and editing the nose cone.

---------- Exception stack trace ----------
java.lang.NullPointerException: Cannot invoke "info.openrocket.core.aerodynamics.AerodynamicForces.setFrictionCD(double)" because the return value of "java.util.Map.get(Object)" is null
at info.openrocket.core.aerodynamics.BarrowmanCalculator.calculateFrictionCD(BarrowmanCalculator.java:543)
at info.openrocket.core.aerodynamics.BarrowmanCalculator.getForceAnalysis(BarrowmanCalculator.java:116)
at info.openrocket.core.rocketcomponent.RocketComponent.getComponentCD(RocketComponent.java:766)
at info.openrocket.core.rocketcomponent.RocketComponent.getOverrideCD(RocketComponent.java:782)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at info.openrocket.swing.gui.adaptors.DoubleModel.getValue(DoubleModel.java:850)
at info.openrocket.swing.gui.adaptors.DoubleModel$ValueSpinnerModel.getValue(DoubleModel.java:74)
at java.desktop/javax.swing.JSpinner.getValue(JSpinner.java:363)
at java.desktop/javax.swing.JSpinner$DefaultEditor.<init>(JSpinner.java:657)
at java.desktop/javax.swing.JSpinner.createEditor(JSpinner.java:286)
at java.desktop/javax.swing.JSpinner.<init>(JSpinner.java:188)
at info.openrocket.swing.gui.configdialog.RocketComponentConfig.overrideTab(RocketComponentConfig.java:718)
at info.openrocket.swing.gui.configdialog.RocketComponentConfig.<init>(RocketComponentConfig.java:186)
at info.openrocket.swing.gui.configdialog.NoseConeConfig.<init>(NoseConeConfig.java:53)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.getDialogContents(ComponentConfigDialog.java:161)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.setComponent(ComponentConfigDialog.java:109)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.<init>(ComponentConfigDialog.java:62)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.showDialog(ComponentConfigDialog.java:269)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.showDialog(ComponentConfigDialog.java:301)
at info.openrocket.swing.gui.configdialog.ComponentConfigDialog.showDialog(ComponentConfigDialog.java:313)
at info.openrocket.swing.gui.main.RocketActions$EditAction.editComponents(RocketActions.java:586)
at info.openrocket.swing.gui.main.RocketActions$EditAction.actionPerformed(RocketActions.java:562)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
at java.desktop/java.awt.Component.processEvent(Component.java:6391)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

---------- Thread information ----------
Thread[AWT-EventQueue-0,6,main]

---------- System information ----------
OpenRocket version: 24.12.beta.01

To Reproduce

  1. Open the file
  2. Edit the nose cone
  3. Exception

Screenshots / .ork file

.ork file:

LOC IRIS Modified Blue Tube.ork.zip

OpenRocket version

unstable

What platform are you running on?

macOS

Additional context

No response

@SiboVG SiboVG added bug release blocker Release blocking bug labels Jan 5, 2025
@SiboVG SiboVG self-assigned this Jan 5, 2025
@SiboVG
Copy link
Member Author

SiboVG commented Jan 5, 2025

The issue is that the Booster stage is disabled, but its child stage, Booster Set, is not. In calculateForceAnalysis, when a stage is inactive, it ignores all its child components, but here, the child component Booster Set is active (it's sort of overriding its parent stage), and expecting to have values in the forceMap. I see two solutions:

  1. When a stage is disabled, do not allow its child stage to be toggled in the stage selector.
  2. When a stage is disabled, in calculateForceAnalysis check if there are child components that are active, and if so, calculate them.

I think a combination of the two may be appropriate. I don't see why you would want to enable a child stage when its parent is disabled.

@JoePfeiffer
Copy link
Contributor

I don't see any reason either, but if we don't let users do it we'll hear about it....

Your option 2 above looks, at first glance, like the right one.

SiboVG added a commit to SiboVG/openrocket that referenced this issue Jan 6, 2025
SiboVG added a commit that referenced this issue Jan 9, 2025
[#2657] Do not ignore active child stages of inactive parent stage in calculations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug release blocker Release blocking bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants