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;
/**
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);
}
}
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);
}
}
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
}
/**
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
}