X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fmain%2FComponentAddButtons.java;h=ba4111abd29f31d3410c7093a776252cf932a5ac;hb=e298a9509613f232227d16d28310611b33c3aa03;hp=a8072de47e72be4d0ac68b6dbd28b75d7e2d3be1;hpb=d8776d61bfa934a68829d9971bb89311e55c67cf;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..ba4111ab 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.handleWrappedException(e); } // Next undo position is set by opening the configuration dialog