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