Updates for 0.9.5
[debian/openrocket] / src / net / sf / openrocket / gui / adaptors / IntegerModel.java
index 6800e0de670682c20a20df1c51b89bc786967706..60658b3fe921b686a21e7d3c5d2c329635fe947e 100644 (file)
@@ -9,7 +9,9 @@ import javax.swing.SpinnerNumberModel;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
+import net.sf.openrocket.util.BugException;
 import net.sf.openrocket.util.ChangeSource;
+import net.sf.openrocket.util.Reflection;
 
 
 public class IntegerModel implements ChangeListener {
@@ -149,13 +151,12 @@ public class IntegerModel implements ChangeListener {
                try {
                        return (Integer)getMethod.invoke(source);
                } catch (IllegalArgumentException e) {
-                       e.printStackTrace();
+                       throw new BugException(e);
                } catch (IllegalAccessException e) {
-                       e.printStackTrace();
+                       throw new BugException(e);
                } catch (InvocationTargetException e) {
-                       e.printStackTrace();
+                       throw Reflection.handleInvocationTargetException(e);
                }
-               return lastValue;  // Should not occur
        }
        
        /**
@@ -164,15 +165,13 @@ public class IntegerModel implements ChangeListener {
        public void setValue(int v) {
                try {
                        setMethod.invoke(source, v);
-                       return;
                } catch (IllegalArgumentException e) {
-                       e.printStackTrace();
+                       throw new BugException(e);
                } catch (IllegalAccessException e) {
-                       e.printStackTrace();
+                       throw new BugException(e);
                } catch (InvocationTargetException e) {
-                       e.printStackTrace();
+                       throw Reflection.handleInvocationTargetException(e);
                }
-               fireStateChanged();  // Should not occur
        }