Merge pull request #2052 from igor-suhoruko

* pr/2052:
  Polish "Join identical catch branches"
  Join identical catch branches
This commit is contained in:
Stephane Nicoll
2018-12-25 09:46:53 +01:00
5 changed files with 20 additions and 53 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

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -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);
}