Polish: combine catches block with same body
This commit is contained in:
parent
f835f7b500
commit
7bce04c06c
|
|
@ -695,11 +695,7 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
|
||||||
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
||||||
"Index of out of bounds in property path '" + propertyName + "'", ex);
|
"Index of out of bounds in property path '" + propertyName + "'", ex);
|
||||||
}
|
}
|
||||||
catch (NumberFormatException ex) {
|
catch (NumberFormatException | TypeMismatchException ex) {
|
||||||
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
|
||||||
"Invalid index in property path '" + propertyName + "'", ex);
|
|
||||||
}
|
|
||||||
catch (TypeMismatchException ex) {
|
|
||||||
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
||||||
"Invalid index in property path '" + propertyName + "'", ex);
|
"Invalid index in property path '" + propertyName + "'", ex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -504,11 +504,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||||
}
|
}
|
||||||
return beanInstance;
|
return beanInstance;
|
||||||
}
|
}
|
||||||
catch (BeanCreationException ex) {
|
catch (BeanCreationException | ImplicitlyAppearedSingletonException ex) {
|
||||||
// A previously detected exception with proper bean creation context already...
|
// A previously detected exception with proper bean creation context already...
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
catch (ImplicitlyAppearedSingletonException ex) {
|
|
||||||
// An IllegalStateException to be communicated up to DefaultSingletonBeanRegistry...
|
// An IllegalStateException to be communicated up to DefaultSingletonBeanRegistry...
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,8 @@ public class PathEditor extends PropertyEditorSupport {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (URISyntaxException ex) {
|
catch (URISyntaxException | FileSystemNotFoundException ex) {
|
||||||
// Not a valid URI: Let's try as Spring resource location.
|
// Not a valid URI: Let's try as Spring resource location.
|
||||||
}
|
|
||||||
catch (FileSystemNotFoundException ex) {
|
|
||||||
// URI scheme not registered for NIO:
|
// URI scheme not registered for NIO:
|
||||||
// Let's try URL protocol handlers via Spring's resource mechanism.
|
// Let's try URL protocol handlers via Spring's resource mechanism.
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -365,10 +365,7 @@ public class MBeanClientInterceptor
|
||||||
try {
|
try {
|
||||||
return doInvoke(invocation);
|
return doInvoke(invocation);
|
||||||
}
|
}
|
||||||
catch (MBeanConnectFailureException ex) {
|
catch (MBeanConnectFailureException | IOException ex) {
|
||||||
return handleConnectFailure(invocation, ex);
|
|
||||||
}
|
|
||||||
catch (IOException ex) {
|
|
||||||
return handleConnectFailure(invocation, ex);
|
return handleConnectFailure(invocation, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -673,18 +673,10 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
|
||||||
try {
|
try {
|
||||||
invokeListener(session, message);
|
invokeListener(session, message);
|
||||||
}
|
}
|
||||||
catch (JMSException ex) {
|
catch (JMSException | RuntimeException | Error ex) {
|
||||||
rollbackOnExceptionIfNecessary(session, ex);
|
rollbackOnExceptionIfNecessary(session, ex);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
catch (RuntimeException ex) {
|
|
||||||
rollbackOnExceptionIfNecessary(session, ex);
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
catch (Error err) {
|
|
||||||
rollbackOnExceptionIfNecessary(session, err);
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
commitIfNecessary(session, message);
|
commitIfNecessary(session, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,10 +217,7 @@ public abstract class JmsUtils {
|
||||||
try {
|
try {
|
||||||
session.commit();
|
session.commit();
|
||||||
}
|
}
|
||||||
catch (javax.jms.TransactionInProgressException ex) {
|
catch (javax.jms.TransactionInProgressException | javax.jms.IllegalStateException ex) {
|
||||||
// Ignore -> can only happen in case of a JTA transaction.
|
|
||||||
}
|
|
||||||
catch (javax.jms.IllegalStateException ex) {
|
|
||||||
// Ignore -> can only happen in case of a JTA transaction.
|
// Ignore -> can only happen in case of a JTA transaction.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -235,10 +232,7 @@ public abstract class JmsUtils {
|
||||||
try {
|
try {
|
||||||
session.rollback();
|
session.rollback();
|
||||||
}
|
}
|
||||||
catch (javax.jms.TransactionInProgressException ex) {
|
catch (javax.jms.TransactionInProgressException | javax.jms.IllegalStateException ex) {
|
||||||
// Ignore -> can only happen in case of a JTA transaction.
|
|
||||||
}
|
|
||||||
catch (javax.jms.IllegalStateException ex) {
|
|
||||||
// Ignore -> can only happen in case of a JTA transaction.
|
// Ignore -> can only happen in case of a JTA transaction.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -847,12 +847,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
|
||||||
try {
|
try {
|
||||||
doJtaBegin(txObject, definition);
|
doJtaBegin(txObject, definition);
|
||||||
}
|
}
|
||||||
catch (NotSupportedException ex) {
|
catch (NotSupportedException | UnsupportedOperationException ex) {
|
||||||
// assume nested transaction not supported
|
|
||||||
throw new NestedTransactionNotSupportedException(
|
|
||||||
"JTA implementation does not support nested transactions", ex);
|
|
||||||
}
|
|
||||||
catch (UnsupportedOperationException ex) {
|
|
||||||
// assume nested transaction not supported
|
// assume nested transaction not supported
|
||||||
throw new NestedTransactionNotSupportedException(
|
throw new NestedTransactionNotSupportedException(
|
||||||
"JTA implementation does not support nested transactions", ex);
|
"JTA implementation does not support nested transactions", ex);
|
||||||
|
|
|
||||||
|
|
@ -175,11 +175,8 @@ public class CommonsMultipartFile implements MultipartFile, Serializable {
|
||||||
catch (FileUploadException ex) {
|
catch (FileUploadException ex) {
|
||||||
throw new IllegalStateException(ex.getMessage(), ex);
|
throw new IllegalStateException(ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
catch (IllegalStateException ex) {
|
catch (IllegalStateException | IOException ex) {
|
||||||
// Pass through when coming from FileItem directly
|
// Pass through when coming from FileItem directly
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
catch (IOException ex) {
|
|
||||||
// From I/O operations within FileItem.write
|
// From I/O operations within FileItem.write
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,7 @@ abstract class AbstractMediaTypeExpression implements Comparable<AbstractMediaTy
|
||||||
boolean match = matchMediaType(exchange);
|
boolean match = matchMediaType(exchange);
|
||||||
return (!this.isNegated == match);
|
return (!this.isNegated == match);
|
||||||
}
|
}
|
||||||
catch (NotAcceptableStatusException ex) {
|
catch (NotAcceptableStatusException | UnsupportedMediaTypeStatusException ex) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch (UnsupportedMediaTypeStatusException ex) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -499,11 +499,7 @@ public abstract class FrameworkServlet extends HttpServletBean implements Applic
|
||||||
this.webApplicationContext = initWebApplicationContext();
|
this.webApplicationContext = initWebApplicationContext();
|
||||||
initFrameworkServlet();
|
initFrameworkServlet();
|
||||||
}
|
}
|
||||||
catch (ServletException ex) {
|
catch (ServletException | RuntimeException ex) {
|
||||||
this.logger.error("Context initialization failed", ex);
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
catch (RuntimeException ex) {
|
|
||||||
this.logger.error("Context initialization failed", ex);
|
this.logger.error("Context initialization failed", ex);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue