Join identical catch branches

See gh-2052
This commit is contained in:
igor-suhorukov 2018-12-14 02:03:33 +03:00 committed by Stephane Nicoll
parent 93e7a0a59d
commit a218bf40cd
5 changed files with 16 additions and 49 deletions

View File

@ -272,15 +272,7 @@ public class AspectJAdviceParameterNameDiscoverer implements ParameterNameDiscov
}
}
}
catch (AmbiguousBindingException ambigEx) {
if (this.raiseExceptions) {
throw ambigEx;
}
else {
return null;
}
}
catch (IllegalArgumentException ex) {
catch (AmbiguousBindingException | IllegalArgumentException ex) {
if (this.raiseExceptions) {
throw ex;
}

View File

@ -80,13 +80,9 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
assertEquals("hello world", value);
assertEquals(String.class, value.getClass());
}
catch (EvaluationException ee) {
ee.printStackTrace();
fail("Unexpected Exception: " + ee.getMessage());
}
catch (ParseException pe) {
pe.printStackTrace();
fail("Unexpected Exception: " + pe.getMessage());
catch (EvaluationException | ParseException ex) {
ex.printStackTrace();
fail("Unexpected Exception: " + ex.getMessage());
}
}
@ -189,13 +185,9 @@ public class ExpressionLanguageScenarioTests extends AbstractExpressionTests {
assertEquals("hellohello", value);
}
catch (EvaluationException ee) {
ee.printStackTrace();
fail("Unexpected Exception: " + ee.getMessage());
}
catch (ParseException pe) {
pe.printStackTrace();
fail("Unexpected Exception: " + pe.getMessage());
catch (EvaluationException | ParseException ex) {
ex.printStackTrace();
fail("Unexpected Exception: " + ex.getMessage());
}
}

View File

@ -276,13 +276,9 @@ public class SetValueTests extends AbstractExpressionTests {
e.setValue(lContext, value);
assertEquals("Retrieved value was not equal to set value", value, e.getValue(lContext,value.getClass()));
}
catch (EvaluationException ee) {
ee.printStackTrace();
fail("Unexpected Exception: " + ee.getMessage());
}
catch (ParseException pe) {
pe.printStackTrace();
fail("Unexpected Exception: " + pe.getMessage());
catch (EvaluationException | ParseException ex) {
ex.printStackTrace();
fail("Unexpected Exception: " + ex.getMessage());
}
}
@ -309,13 +305,9 @@ public class SetValueTests extends AbstractExpressionTests {
// assertEquals("Retrieved value was not equal to set value", expectedValue, e.getValue(lContext));
}
}
catch (EvaluationException ee) {
ee.printStackTrace();
fail("Unexpected Exception: " + ee.getMessage());
}
catch (ParseException pe) {
pe.printStackTrace();
fail("Unexpected Exception: " + pe.getMessage());
catch (EvaluationException | ParseException ex) {
ex.printStackTrace();
fail("Unexpected Exception: " + ex.getMessage());
}
}

View File

@ -121,14 +121,10 @@ public class SpringJtaSynchronizationAdapter implements Synchronization {
boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
this.springSynchronization.beforeCommit(readOnly);
}
catch (RuntimeException ex) {
catch (RuntimeException | Error ex) {
setRollbackOnlyIfPossible();
throw ex;
}
catch (Error err) {
setRollbackOnlyIfPossible();
throw err;
}
finally {
// Process Spring's beforeCompletion early, in order to avoid issues
// with strict JTA implementations that issue warnings when doing JDBC

View File

@ -56,15 +56,10 @@ public class MockUOWManager implements UOWManager {
action.run();
this.status = (this.rollbackOnly ? UOW_STATUS_ROLLEDBACK : UOW_STATUS_COMMITTED);
}
catch (Error err) {
this.status = UOW_STATUS_ROLLEDBACK;
throw err;
}
catch (RuntimeException ex) {
catch (Error | RuntimeException ex) {
this.status = UOW_STATUS_ROLLEDBACK;
throw ex;
}
catch (Exception ex) {
} catch (Exception ex) {
this.status = UOW_STATUS_ROLLEDBACK;
throw new UOWActionException(ex);
}