X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fmain%2FComponentAddButtons.java;fp=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fmain%2FComponentAddButtons.java;h=8e67b6a599655d80c1fa0e75bb6cdfc2fbfb8f25;hb=c72e1c03cc0d15e11368707c38721d506ce356b9;hp=a8072de47e72be4d0ac68b6dbd28b75d7e2d3be1;hpb=d23932f311312abb73801262a80ef2f6bc66818d;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/gui/main/ComponentAddButtons.java b/src/net/sf/openrocket/gui/main/ComponentAddButtons.java index a8072de4..8e67b6a5 100644 --- a/src/net/sf/openrocket/gui/main/ComponentAddButtons.java +++ b/src/net/sf/openrocket/gui/main/ComponentAddButtons.java @@ -6,6 +6,7 @@ import java.awt.Dimension; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import javax.swing.Icon; import javax.swing.JButton; @@ -47,8 +48,10 @@ import net.sf.openrocket.rocketcomponent.Streamer; import net.sf.openrocket.rocketcomponent.Transition; import net.sf.openrocket.rocketcomponent.TrapezoidFinSet; import net.sf.openrocket.rocketcomponent.TubeCoupler; +import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Pair; import net.sf.openrocket.util.Prefs; +import net.sf.openrocket.util.Reflection; /** * A component that contains addition buttons to add different types of rocket components @@ -393,9 +396,14 @@ public class ComponentAddButtons extends JPanel implements Scrollable { RocketComponent component; try { component = (RocketComponent)constructor.newInstance(); - } catch (Exception e) { - throw new RuntimeException("Could not construct new instance of class "+ + } catch (InstantiationException e) { + throw new BugException("Could not construct new instance of class "+ constructor,e); + } catch (IllegalAccessException e) { + throw new BugException("Could not construct new instance of class "+ + constructor,e); + } catch (InvocationTargetException e) { + throw Reflection.handleInvocationTargetException(e); } // Next undo position is set by opening the configuration dialog