Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
798fe5ed
Commit
798fe5ed
authored
Jul 18, 2017
by
Emanuel Campolo
Committed by
Phillip Webb
Jul 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collapse catch clauses
Use multi-catch for exceptions whenever possible. See gh-9781
parent
4a189bde
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
19 additions
and
76 deletions
+19
-76
AbstractJmxCacheStatisticsProvider.java
...oot/actuate/cache/AbstractJmxCacheStatisticsProvider.java
+1
-4
OnBeanCondition.java
...amework/boot/autoconfigure/condition/OnBeanCondition.java
+1
-4
HttpMessageConverters.java
...mework/boot/autoconfigure/http/HttpMessageConverters.java
+1
-4
MongoDataAutoConfigurationTests.java
...configure/data/mongo/MongoDataAutoConfigurationTests.java
+0
-4
AetherGrapeEngine.java
...gframework/boot/cli/compiler/grape/AetherGrapeEngine.java
+1
-4
ClassPathChangeUploader.java
.../boot/devtools/remote/client/ClassPathChangeUploader.java
+1
-4
HttpTunnelConnection.java
...ork/boot/devtools/tunnel/client/HttpTunnelConnection.java
+1
-4
AbstractRunMojo.java
.../java/org/springframework/boot/maven/AbstractRunMojo.java
+0
-3
SpringApplicationAdminClient.java
...ingframework/boot/maven/SpringApplicationAdminClient.java
+2
-5
StartMojo.java
...c/main/java/org/springframework/boot/maven/StartMojo.java
+1
-5
BeanDefinitionLoader.java
...n/java/org/springframework/boot/BeanDefinitionLoader.java
+1
-4
AtomikosDependsOnBeanFactoryPostProcessor.java
...a/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java
+1
-4
BitronixDependentBeanFactoryPostProcessor.java
...a/bitronix/BitronixDependentBeanFactoryPostProcessor.java
+2
-5
NarayanaBeanFactoryPostProcessor.java
...k/boot/jta/narayana/NarayanaBeanFactoryPostProcessor.java
+2
-5
SpringPackageScanClassResolver.java
...mework/boot/liquibase/SpringPackageScanClassResolver.java
+2
-6
TomcatErrorPage.java
...ngframework/boot/web/embedded/tomcat/TomcatErrorPage.java
+1
-4
ServletWebServerApplicationContext.java
...b/servlet/context/ServletWebServerApplicationContext.java
+1
-7
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cache/AbstractJmxCacheStatisticsProvider.java
View file @
798fe5ed
...
...
@@ -107,16 +107,13 @@ public abstract class AbstractJmxCacheStatisticsProvider<C extends Cache>
Object
attribute
=
getMBeanServer
().
getAttribute
(
objectName
,
attributeName
);
return
type
.
cast
(
attribute
);
}
catch
(
MBeanException
ex
)
{
catch
(
MBeanException
|
ReflectionException
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
catch
(
AttributeNotFoundException
ex
)
{
throw
new
IllegalStateException
(
"Unexpected: MBean with name '"
+
objectName
+
"' "
+
"does not expose attribute with name "
+
attributeName
,
ex
);
}
catch
(
ReflectionException
ex
)
{
throw
new
IllegalStateException
(
ex
);
}
catch
(
InstanceNotFoundException
ex
)
{
logger
.
warn
(
"Cache statistics are no longer available"
,
ex
);
return
null
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
View file @
798fe5ed
...
...
@@ -255,10 +255,7 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
ClassUtils
.
forName
(
type
,
classLoader
),
considerHierarchy
);
return
result
;
}
catch
(
ClassNotFoundException
ex
)
{
return
Collections
.
emptySet
();
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
ClassNotFoundException
|
NoClassDefFoundError
ex
)
{
return
Collections
.
emptySet
();
}
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpMessageConverters.java
View file @
798fe5ed
...
...
@@ -240,10 +240,7 @@ public class HttpMessageConverters implements Iterable<HttpMessageConverter<?>>
try
{
list
.
add
(
Class
.
forName
(
className
));
}
catch
(
ClassNotFoundException
ex
)
{
// Ignore
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
ClassNotFoundException
|
NoClassDefFoundError
ex
)
{
// Ignore
}
}
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MongoDataAutoConfigurationTests.java
View file @
798fe5ed
...
...
@@ -27,7 +27,6 @@ import org.junit.Test;
import
org.junit.rules.ExpectedException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.UnsatisfiedDependencyException
;
import
org.springframework.boot.autoconfigure.AutoConfigurationPackages
;
import
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
;
import
org.springframework.boot.autoconfigure.data.mongo.city.City
;
...
...
@@ -135,9 +134,6 @@ public class MongoDataAutoConfigurationTests {
fail
(
"Create FieldNamingStrategy interface should fail"
);
}
// We seem to have an inconsistent exception, accept either
catch
(
UnsatisfiedDependencyException
ex
)
{
// Expected
}
catch
(
BeanCreationException
ex
)
{
// Expected
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/AetherGrapeEngine.java
View file @
798fe5ed
...
...
@@ -131,10 +131,7 @@ public class AetherGrapeEngine implements GrapeEngine {
classLoader
.
addURL
(
file
.
toURI
().
toURL
());
}
}
catch
(
ArtifactResolutionException
ex
)
{
throw
new
DependencyResolutionFailedException
(
ex
);
}
catch
(
MalformedURLException
ex
)
{
catch
(
ArtifactResolutionException
|
MalformedURLException
ex
)
{
throw
new
DependencyResolutionFailedException
(
ex
);
}
return
null
;
...
...
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java
View file @
798fe5ed
...
...
@@ -80,10 +80,7 @@ public class ClassPathChangeUploader
try
{
this
.
uri
=
new
URL
(
url
).
toURI
();
}
catch
(
URISyntaxException
ex
)
{
throw
new
IllegalArgumentException
(
"Malformed URL '"
+
url
+
"'"
);
}
catch
(
MalformedURLException
ex
)
{
catch
(
URISyntaxException
|
MalformedURLException
ex
)
{
throw
new
IllegalArgumentException
(
"Malformed URL '"
+
url
+
"'"
);
}
this
.
requestFactory
=
requestFactory
;
...
...
spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/HttpTunnelConnection.java
View file @
798fe5ed
...
...
@@ -84,10 +84,7 @@ public class HttpTunnelConnection implements TunnelConnection {
try
{
this
.
uri
=
new
URL
(
url
).
toURI
();
}
catch
(
URISyntaxException
ex
)
{
throw
new
IllegalArgumentException
(
"Malformed URL '"
+
url
+
"'"
);
}
catch
(
MalformedURLException
ex
)
{
catch
(
URISyntaxException
|
MalformedURLException
ex
)
{
throw
new
IllegalArgumentException
(
"Malformed URL '"
+
url
+
"'"
);
}
this
.
requestFactory
=
requestFactory
;
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java
View file @
798fe5ed
...
...
@@ -371,9 +371,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
addDependencies
(
urls
);
return
urls
.
toArray
(
new
URL
[
urls
.
size
()]);
}
catch
(
MalformedURLException
ex
)
{
throw
new
MojoExecutionException
(
"Unable to build classpath"
,
ex
);
}
catch
(
IOException
ex
)
{
throw
new
MojoExecutionException
(
"Unable to build classpath"
,
ex
);
}
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/SpringApplicationAdminClient.java
View file @
798fe5ed
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -73,10 +73,7 @@ class SpringApplicationAdminClient {
throw
new
MojoExecutionException
(
"Failed to retrieve Ready attribute"
,
ex
.
getCause
());
}
catch
(
MBeanException
ex
)
{
throw
new
MojoExecutionException
(
ex
.
getMessage
(),
ex
);
}
catch
(
IOException
ex
)
{
catch
(
MBeanException
|
IOException
ex
)
{
throw
new
MojoExecutionException
(
ex
.
getMessage
(),
ex
);
}
}
...
...
spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java
View file @
798fe5ed
...
...
@@ -94,11 +94,7 @@ public class StartMojo extends AbstractRunMojo {
try
{
waitForSpringApplication
();
}
catch
(
MojoExecutionException
ex
)
{
runProcess
.
kill
();
throw
ex
;
}
catch
(
MojoFailureException
ex
)
{
catch
(
MojoExecutionException
|
MojoFailureException
ex
)
{
runProcess
.
kill
();
throw
ex
;
}
...
...
spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java
View file @
798fe5ed
...
...
@@ -191,10 +191,7 @@ class BeanDefinitionLoader {
try
{
return
load
(
ClassUtils
.
forName
(
resolvedSource
,
null
));
}
catch
(
IllegalArgumentException
ex
)
{
// swallow exception and continue
}
catch
(
ClassNotFoundException
ex
)
{
catch
(
IllegalArgumentException
|
ClassNotFoundException
ex
)
{
// swallow exception and continue
}
// Attempt as resources
...
...
spring-boot/src/main/java/org/springframework/boot/jta/atomikos/AtomikosDependsOnBeanFactoryPostProcessor.java
View file @
798fe5ed
...
...
@@ -91,10 +91,7 @@ public class AtomikosDependsOnBeanFactoryPostProcessor
try
{
return
beanFactory
.
getBeanNamesForType
(
Class
.
forName
(
type
),
true
,
false
);
}
catch
(
ClassNotFoundException
ex
)
{
// Ignore
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
ClassNotFoundException
|
NoClassDefFoundError
ex
)
{
// Ignore
}
return
NO_BEANS
;
...
...
spring-boot/src/main/java/org/springframework/boot/jta/bitronix/BitronixDependentBeanFactoryPostProcessor.java
View file @
798fe5ed
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -67,10 +67,7 @@ public class BitronixDependentBeanFactoryPostProcessor
try
{
return
beanFactory
.
getBeanNamesForType
(
Class
.
forName
(
type
),
true
,
false
);
}
catch
(
ClassNotFoundException
ex
)
{
// Ignore
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
ClassNotFoundException
|
NoClassDefFoundError
ex
)
{
// Ignore
}
return
NO_BEANS
;
...
...
spring-boot/src/main/java/org/springframework/boot/jta/narayana/NarayanaBeanFactoryPostProcessor.java
View file @
798fe5ed
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -70,10 +70,7 @@ public class NarayanaBeanFactoryPostProcessor
try
{
return
beanFactory
.
getBeanNamesForType
(
Class
.
forName
(
type
),
true
,
false
);
}
catch
(
ClassNotFoundException
ex
)
{
// Ignore
}
catch
(
NoClassDefFoundError
ex
)
{
catch
(
ClassNotFoundException
|
NoClassDefFoundError
ex
)
{
// Ignore
}
return
NO_BEANS
;
...
...
spring-boot/src/main/java/org/springframework/boot/liquibase/SpringPackageScanClassResolver.java
View file @
798fe5ed
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
7
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.
...
...
@@ -78,11 +78,7 @@ public class SpringPackageScanClassResolver extends DefaultPackageScanClassResol
MetadataReader
reader
=
readerFactory
.
getMetadataReader
(
resource
);
return
ClassUtils
.
forName
(
reader
.
getClassMetadata
().
getClassName
(),
loader
);
}
catch
(
ClassNotFoundException
ex
)
{
handleFailure
(
resource
,
ex
);
return
null
;
}
catch
(
LinkageError
ex
)
{
catch
(
ClassNotFoundException
|
LinkageError
ex
)
{
handleFailure
(
resource
,
ex
);
return
null
;
}
...
...
spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatErrorPage.java
View file @
798fe5ed
...
...
@@ -58,10 +58,7 @@ class TomcatErrorPage {
.
instantiateClass
(
ClassUtils
.
forName
(
ERROR_PAGE_CLASS
,
null
));
}
}
catch
(
ClassNotFoundException
ex
)
{
// Swallow and continue
}
catch
(
LinkageError
ex
)
{
catch
(
ClassNotFoundException
|
LinkageError
ex
)
{
// Swallow and continue
}
return
null
;
...
...
spring-boot/src/main/java/org/springframework/boot/web/servlet/context/ServletWebServerApplicationContext.java
View file @
798fe5ed
...
...
@@ -273,13 +273,7 @@ public class ServletWebServerApplicationContext extends GenericWebApplicationCon
+
elapsedTime
+
" ms"
);
}
}
catch
(
RuntimeException
ex
)
{
logger
.
error
(
"Context initialization failed"
,
ex
);
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ex
);
throw
ex
;
}
catch
(
Error
ex
)
{
catch
(
RuntimeException
|
Error
ex
)
{
logger
.
error
(
"Context initialization failed"
,
ex
);
servletContext
.
setAttribute
(
WebApplicationContext
.
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
,
ex
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment