X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fadaptors%2FDoubleModel.java;fp=src%2Fnet%2Fsf%2Fopenrocket%2Fgui%2Fadaptors%2FDoubleModel.java;h=6616b81c9cac7b4e54a17181f4ba80cee9b0b398;hb=c72e1c03cc0d15e11368707c38721d506ce356b9;hp=da0c7747b2e48aec26968f2f33501629cd08e37f;hpb=d23932f311312abb73801262a80ef2f6bc66818d;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/gui/adaptors/DoubleModel.java b/src/net/sf/openrocket/gui/adaptors/DoubleModel.java index da0c7747..6616b81c 100644 --- a/src/net/sf/openrocket/gui/adaptors/DoubleModel.java +++ b/src/net/sf/openrocket/gui/adaptors/DoubleModel.java @@ -17,8 +17,10 @@ import javax.swing.event.ChangeListener; import net.sf.openrocket.unit.Unit; import net.sf.openrocket.unit.UnitGroup; +import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.ChangeSource; import net.sf.openrocket.util.MathUtil; +import net.sf.openrocket.util.Reflection; /** @@ -589,11 +591,11 @@ public class DoubleModel implements ChangeListener, ChangeSource { try { return (Double)getMethod.invoke(source)*multiplier; } catch (IllegalArgumentException e) { - throw new RuntimeException("BUG: Unable to invoke getMethod of "+this, e); + throw new BugException("BUG: Unable to invoke getMethod of "+this, e); } catch (IllegalAccessException e) { - throw new RuntimeException("BUG: Unable to invoke getMethod of "+this, e); + throw new BugException("BUG: Unable to invoke getMethod of "+this, e); } catch (InvocationTargetException e) { - throw new RuntimeException("BUG: Unable to invoke getMethod of "+this, e); + throw Reflection.handleInvocationTargetException(e); } } @@ -614,13 +616,12 @@ public class DoubleModel implements ChangeListener, ChangeSource { try { setMethod.invoke(source, v/multiplier); - return; } catch (IllegalArgumentException e) { - throw new RuntimeException("BUG: Unable to invoke setMethod of "+this, e); + throw new BugException("BUG: Unable to invoke setMethod of "+this, e); } catch (IllegalAccessException e) { - throw new RuntimeException("BUG: Unable to invoke setMethod of "+this, e); + throw new BugException("BUG: Unable to invoke setMethod of "+this, e); } catch (InvocationTargetException e) { - throw new RuntimeException("Setter method of "+this+" threw exception", e); + throw Reflection.handleInvocationTargetException(e); } } @@ -643,13 +644,12 @@ public class DoubleModel implements ChangeListener, ChangeSource { try { return (Boolean)getAutoMethod.invoke(source); } catch (IllegalArgumentException e) { - e.printStackTrace(); + throw new BugException("Method call failed", e); } catch (IllegalAccessException e) { - e.printStackTrace(); + throw new BugException("Method call failed", e); } catch (InvocationTargetException e) { - e.printStackTrace(); + throw Reflection.handleInvocationTargetException(e); } - return false; // Should not occur } /** @@ -662,18 +662,16 @@ public class DoubleModel implements ChangeListener, ChangeSource { return; } + lastAutomatic = auto; try { - lastAutomatic = auto; setAutoMethod.invoke(source, auto); - 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 }