Collapse catch blocks
This commit is contained in:
parent
3f8b35343c
commit
8df1fa881a
@ -35,9 +35,7 @@ public class CommandlineInterpreter {
|
||||
try {
|
||||
final PostfixExpression pe = PostfixExpression.fromInfix(string);
|
||||
System.out.println(pe.calculate());
|
||||
} catch (UnparsableExpressionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnknownFunctionException e) {
|
||||
} catch (UnparsableExpressionException | UnknownFunctionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -42,9 +42,7 @@ class ComponentHandler extends AbstractElementHandler {
|
||||
RocketComponent c;
|
||||
try {
|
||||
c = constructor.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new BugException("Error constructing component.", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new BugException("Error constructing component.", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -305,8 +305,7 @@ public abstract class BaseHandler<C extends RocketComponent> extends AbstractEle
|
||||
if (method != null) {
|
||||
method.invoke(component, material);
|
||||
}
|
||||
} catch (IllegalAccessException ignored) {
|
||||
} catch (InvocationTargetException ignored) {
|
||||
} catch (IllegalAccessException | InvocationTargetException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,7 @@ public class FlightConfigurationModifier<E extends FlightConfigurableParameter<E
|
||||
try {
|
||||
configName = configName.substring(0, 1).toUpperCase(Locale.ENGLISH) + configName.substring(1);
|
||||
configGetter = new Method(componentClass.getMethod("get" + configName));
|
||||
} catch (SecurityException e) {
|
||||
throw new BugException("Trying to find method get/set" + configName + " in class " + componentClass, e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (SecurityException | NoSuchMethodException e) {
|
||||
throw new BugException("Trying to find method get/set" + configName + " in class " + componentClass, e);
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,7 @@ public abstract class GenericModifier<T> extends AbstractSimulationModifier {
|
||||
methodName = methodName.substring(0, 1).toUpperCase(Locale.ENGLISH) + methodName.substring(1);
|
||||
getter = new Method(modifiedClass.getMethod("get" + methodName));
|
||||
setter = new Method(modifiedClass.getMethod("set" + methodName, double.class));
|
||||
} catch (SecurityException e) {
|
||||
throw new BugException("Trying to find method get/set" + methodName + " in class " + modifiedClass, e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (SecurityException | NoSuchMethodException e) {
|
||||
throw new BugException("Trying to find method get/set" + methodName + " in class " + modifiedClass, e);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ public class DoubleUnitColumnParser extends BaseUnitColumnParser {
|
||||
}
|
||||
|
||||
props.put(propKey, value);
|
||||
} catch (NumberFormatException nex) {
|
||||
} catch (IllegalArgumentException iae) {
|
||||
}
|
||||
}
|
||||
|
@ -32,10 +32,7 @@ public class Reflection {
|
||||
public Object invoke(Object obj, Object... args) {
|
||||
try {
|
||||
return method.invoke(obj, args);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException("Error while invoking method '" + method + "'. " +
|
||||
"Please report this as a bug.", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException("Error while invoking method '" + method + "'. " +
|
||||
"Please report this as a bug.", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
@ -132,8 +129,7 @@ public class Reflection {
|
||||
Class<?> c = Class.forName(name);
|
||||
java.lang.reflect.Method m = c.getMethod(method, params);
|
||||
return new Reflection.Method(m);
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
} catch (NoSuchMethodException ignore) {
|
||||
} catch (ClassNotFoundException | NoSuchMethodException ignore) {
|
||||
}
|
||||
|
||||
currentclass = currentclass.getSuperclass();
|
||||
@ -174,11 +170,7 @@ public class Reflection {
|
||||
return constructor.newInstance(params);
|
||||
}
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException("Construction of " + name + " failed", e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new BugException("Construction of " + name + " failed", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException e) {
|
||||
throw new BugException("Construction of " + name + " failed", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -792,9 +792,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
|
||||
|
||||
try {
|
||||
return (Double) getMethod.invoke(source) * multiplier;
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException("Unable to invoke getMethod of " + this, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException("Unable to invoke getMethod of " + this, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
@ -829,9 +827,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
|
||||
setMethod.invoke(source, v / multiplier);
|
||||
// Make sure to notify all the listeners that have registered
|
||||
fireStateChanged();
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException("Unable to invoke setMethod of " + this, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException("Unable to invoke setMethod of " + this, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
@ -855,9 +851,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
|
||||
|
||||
try {
|
||||
return (Boolean) getAutoMethod.invoke(source);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException("Method call failed", e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException("Method call failed", e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
@ -881,9 +875,7 @@ public class DoubleModel implements StateChangeListener, ChangeSource, Invalidat
|
||||
lastAutomatic = auto;
|
||||
try {
|
||||
setAutoMethod.invoke(source, auto);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -201,9 +201,7 @@ public class IntegerModel implements StateChangeListener, Invalidatable {
|
||||
public int getValue() {
|
||||
try {
|
||||
return (Integer) getMethod.invoke(source);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
@ -224,9 +222,7 @@ public class IntegerModel implements StateChangeListener, Invalidatable {
|
||||
try {
|
||||
setMethod.invoke(source, v);
|
||||
fireStateChanged();
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new BugException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new BugException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -461,9 +461,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
||||
RocketComponent component;
|
||||
try {
|
||||
component = (RocketComponent) constructor.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
throw new BugException("Could not construct new instance of class " + constructor, e);
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
throw new BugException("Could not construct new instance of class " + constructor, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw Reflection.handleWrappedException(e);
|
||||
|
@ -158,9 +158,7 @@ public class PrintController {
|
||||
writer.close();
|
||||
idoc.close();
|
||||
}
|
||||
catch (DocumentException e) {
|
||||
}
|
||||
catch (ExceptionConverter ec) {
|
||||
catch (DocumentException | ExceptionConverter e) {
|
||||
}
|
||||
finally {
|
||||
if (outputFile != null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user