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
3b71393e
Commit
3b71393e
authored
Oct 16, 2017
by
dreis2211
Committed by
Stephane Nicoll
Oct 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Assert.state() with Supplier where possible
See gh-10658
parent
3e182133
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
28 additions
and
27 deletions
+28
-27
EndpointRequest.java
.../boot/actuate/autoconfigure/security/EndpointRequest.java
+1
-1
AnnotationEndpointDiscoverer.java
...ate/endpoint/annotation/AnnotationEndpointDiscoverer.java
+2
-2
CacheConfigurations.java
...amework/boot/autoconfigure/cache/CacheConfigurations.java
+1
-1
FlywayAutoConfiguration.java
...rk/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
+1
-1
DataSourceProperties.java
...amework/boot/autoconfigure/jdbc/DataSourceProperties.java
+1
-1
LiquibaseAutoConfiguration.java
...t/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
+1
-1
SessionStoreMappings.java
...work/boot/autoconfigure/session/SessionStoreMappings.java
+1
-1
SocialWebAutoConfiguration.java
...boot/autoconfigure/social/SocialWebAutoConfiguration.java
+1
-1
CommandLineInvoker.java
...framework/boot/cli/infrastructure/CommandLineInvoker.java
+1
-1
ChangedFile.java
.../springframework/boot/devtools/filewatch/ChangedFile.java
+1
-1
HttpTunnelServer.java
...amework/boot/devtools/tunnel/server/HttpTunnelServer.java
+1
-1
SpringBootConfigurationFinder.java
...work/boot/test/context/SpringBootConfigurationFinder.java
+1
-1
SpringBootContextLoader.java
...gframework/boot/test/context/SpringBootContextLoader.java
+1
-1
DefinitionsParser.java
...ngframework/boot/test/mock/mockito/DefinitionsParser.java
+4
-3
MockitoPostProcessor.java
...ramework/boot/test/mock/mockito/MockitoPostProcessor.java
+2
-2
JavaExecutable.java
...org/springframework/boot/loader/tools/JavaExecutable.java
+1
-1
ApplicationTemp.java
...c/main/java/org/springframework/boot/ApplicationTemp.java
+3
-3
JsonObjectDeserializer.java
.../springframework/boot/jackson/JsonObjectDeserializer.java
+1
-1
JettyWebServer.java
...ringframework/boot/web/embedded/jetty/JettyWebServer.java
+1
-1
TomcatServletWebServerFactory.java
...ot/web/embedded/tomcat/TomcatServletWebServerFactory.java
+1
-1
RegistrationBean.java
...rg/springframework/boot/web/servlet/RegistrationBean.java
+1
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/security/EndpointRequest.java
View file @
3b71393e
...
@@ -163,7 +163,7 @@ public final class EndpointRequest {
...
@@ -163,7 +163,7 @@ public final class EndpointRequest {
private
String
getPathId
(
Class
<?>
source
)
{
private
String
getPathId
(
Class
<?>
source
)
{
Endpoint
annotation
=
AnnotationUtils
.
findAnnotation
(
source
,
Endpoint
.
class
);
Endpoint
annotation
=
AnnotationUtils
.
findAnnotation
(
source
,
Endpoint
.
class
);
Assert
.
state
(
annotation
!=
null
,
Assert
.
state
(
annotation
!=
null
,
"Class "
+
source
+
" is not annotated with @Endpoint"
);
()
->
"Class "
+
source
+
" is not annotated with @Endpoint"
);
return
annotation
.
id
();
return
annotation
.
id
();
}
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/AnnotationEndpointDiscoverer.java
View file @
3b71393e
...
@@ -140,7 +140,7 @@ public abstract class AnnotationEndpointDiscoverer<T extends Operation, K>
...
@@ -140,7 +140,7 @@ public abstract class AnnotationEndpointDiscoverer<T extends Operation, K>
AnnotationAttributes
endpointAttributes
=
AnnotatedElementUtils
AnnotationAttributes
endpointAttributes
=
AnnotatedElementUtils
.
getMergedAnnotationAttributes
(
endpointType
,
Endpoint
.
class
);
.
getMergedAnnotationAttributes
(
endpointType
,
Endpoint
.
class
);
Assert
.
state
(
isExposedOver
(
endpointAttributes
,
exposure
),
Assert
.
state
(
isExposedOver
(
endpointAttributes
,
exposure
),
"Invalid extension "
+
beanType
.
getName
()
+
"': endpoint '"
()
->
"Invalid extension "
+
beanType
.
getName
()
+
"': endpoint '"
+
endpointType
.
getName
()
+
endpointType
.
getName
()
+
"' does not support such extension"
);
+
"' does not support such extension"
);
EndpointInfo
<
T
>
info
=
getEndpointInfo
(
endpoints
,
beanType
,
endpointType
);
EndpointInfo
<
T
>
info
=
getEndpointInfo
(
endpoints
,
beanType
,
endpointType
);
...
@@ -163,7 +163,7 @@ public abstract class AnnotationEndpointDiscoverer<T extends Operation, K>
...
@@ -163,7 +163,7 @@ public abstract class AnnotationEndpointDiscoverer<T extends Operation, K>
private
EndpointInfo
<
T
>
getEndpointInfo
(
Map
<
Class
<?>,
EndpointInfo
<
T
>>
endpoints
,
private
EndpointInfo
<
T
>
getEndpointInfo
(
Map
<
Class
<?>,
EndpointInfo
<
T
>>
endpoints
,
Class
<?>
beanType
,
Class
<?>
endpointClass
)
{
Class
<?>
beanType
,
Class
<?>
endpointClass
)
{
EndpointInfo
<
T
>
endpoint
=
endpoints
.
get
(
endpointClass
);
EndpointInfo
<
T
>
endpoint
=
endpoints
.
get
(
endpointClass
);
Assert
.
state
(
endpoint
!=
null
,
"Invalid extension '"
+
beanType
.
getName
()
Assert
.
state
(
endpoint
!=
null
,
()
->
"Invalid extension '"
+
beanType
.
getName
()
+
"': no endpoint found with type '"
+
endpointClass
.
getName
()
+
"'"
);
+
"': no endpoint found with type '"
+
endpointClass
.
getName
()
+
"'"
);
return
endpoint
;
return
endpoint
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java
View file @
3b71393e
...
@@ -52,7 +52,7 @@ final class CacheConfigurations {
...
@@ -52,7 +52,7 @@ final class CacheConfigurations {
public
static
String
getConfigurationClass
(
CacheType
cacheType
)
{
public
static
String
getConfigurationClass
(
CacheType
cacheType
)
{
Class
<?>
configurationClass
=
MAPPINGS
.
get
(
cacheType
);
Class
<?>
configurationClass
=
MAPPINGS
.
get
(
cacheType
);
Assert
.
state
(
configurationClass
!=
null
,
"Unknown cache type "
+
cacheType
);
Assert
.
state
(
configurationClass
!=
null
,
()
->
"Unknown cache type "
+
cacheType
);
return
configurationClass
.
getName
();
return
configurationClass
.
getName
();
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java
View file @
3b71393e
...
@@ -124,7 +124,7 @@ public class FlywayAutoConfiguration {
...
@@ -124,7 +124,7 @@ public class FlywayAutoConfiguration {
"Migration script locations not configured"
);
"Migration script locations not configured"
);
boolean
exists
=
hasAtLeastOneLocation
();
boolean
exists
=
hasAtLeastOneLocation
();
Assert
.
state
(
exists
,
Assert
.
state
(
exists
,
"Cannot find migrations location in: "
+
this
.
properties
()
->
"Cannot find migrations location in: "
+
this
.
properties
.
getLocations
()
.
getLocations
()
+
" (please add migrations or check your Flyway configuration)"
);
+
" (please add migrations or check your Flyway configuration)"
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java
View file @
3b71393e
...
@@ -232,7 +232,7 @@ public class DataSourceProperties
...
@@ -232,7 +232,7 @@ public class DataSourceProperties
public
String
determineDriverClassName
()
{
public
String
determineDriverClassName
()
{
if
(
StringUtils
.
hasText
(
this
.
driverClassName
))
{
if
(
StringUtils
.
hasText
(
this
.
driverClassName
))
{
Assert
.
state
(
driverClassIsLoadable
(),
Assert
.
state
(
driverClassIsLoadable
(),
"Cannot load driver class: "
+
this
.
driverClassName
);
()
->
"Cannot load driver class: "
+
this
.
driverClassName
);
return
this
.
driverClassName
;
return
this
.
driverClassName
;
}
}
String
driverClassName
=
null
;
String
driverClassName
=
null
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java
View file @
3b71393e
...
@@ -103,7 +103,7 @@ public class LiquibaseAutoConfiguration {
...
@@ -103,7 +103,7 @@ public class LiquibaseAutoConfiguration {
Resource
resource
=
this
.
resourceLoader
Resource
resource
=
this
.
resourceLoader
.
getResource
(
this
.
properties
.
getChangeLog
());
.
getResource
(
this
.
properties
.
getChangeLog
());
Assert
.
state
(
resource
.
exists
(),
Assert
.
state
(
resource
.
exists
(),
"Cannot find changelog location: "
+
resource
()
->
"Cannot find changelog location: "
+
resource
+
" (please add changelog or check your Liquibase "
+
" (please add changelog or check your Liquibase "
+
"configuration)"
);
+
"configuration)"
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionStoreMappings.java
View file @
3b71393e
...
@@ -48,7 +48,7 @@ final class SessionStoreMappings {
...
@@ -48,7 +48,7 @@ final class SessionStoreMappings {
public
static
String
getConfigurationClass
(
StoreType
sessionStoreType
)
{
public
static
String
getConfigurationClass
(
StoreType
sessionStoreType
)
{
Class
<?>
configurationClass
=
MAPPINGS
.
get
(
sessionStoreType
);
Class
<?>
configurationClass
=
MAPPINGS
.
get
(
sessionStoreType
);
Assert
.
state
(
configurationClass
!=
null
,
Assert
.
state
(
configurationClass
!=
null
,
"Unknown session store type "
+
sessionStoreType
);
()
->
"Unknown session store type "
+
sessionStoreType
);
return
configurationClass
.
getName
();
return
configurationClass
.
getName
();
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java
View file @
3b71393e
...
@@ -178,7 +178,7 @@ public class SocialWebAutoConfiguration {
...
@@ -178,7 +178,7 @@ public class SocialWebAutoConfiguration {
SecurityContext
context
=
SecurityContextHolder
.
getContext
();
SecurityContext
context
=
SecurityContextHolder
.
getContext
();
Authentication
authentication
=
context
.
getAuthentication
();
Authentication
authentication
=
context
.
getAuthentication
();
Assert
.
state
(
authentication
!=
null
,
Assert
.
state
(
authentication
!=
null
,
"Unable to get a
"
+
"
ConnectionRepository: no user signed in"
);
"Unable to get a ConnectionRepository: no user signed in"
);
return
authentication
.
getName
();
return
authentication
.
getName
();
}
}
...
...
spring-boot-project/spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java
View file @
3b71393e
...
@@ -94,7 +94,7 @@ public final class CommandLineInvoker {
...
@@ -94,7 +94,7 @@ public final class CommandLineInvoker {
File
bin
=
new
File
(
unpacked
.
listFiles
()[
0
],
"bin"
);
File
bin
=
new
File
(
unpacked
.
listFiles
()[
0
],
"bin"
);
File
launchScript
=
new
File
(
bin
,
isWindows
()
?
"spring.bat"
:
"spring"
);
File
launchScript
=
new
File
(
bin
,
isWindows
()
?
"spring.bat"
:
"spring"
);
Assert
.
state
(
launchScript
.
exists
()
&&
launchScript
.
isFile
(),
Assert
.
state
(
launchScript
.
exists
()
&&
launchScript
.
isFile
(),
"Could not find CLI launch script "
+
launchScript
.
getAbsolutePath
());
()
->
"Could not find CLI launch script "
+
launchScript
.
getAbsolutePath
());
return
launchScript
;
return
launchScript
;
}
}
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/ChangedFile.java
View file @
3b71393e
...
@@ -76,7 +76,7 @@ public final class ChangedFile {
...
@@ -76,7 +76,7 @@ public final class ChangedFile {
File
file
=
this
.
file
.
getAbsoluteFile
();
File
file
=
this
.
file
.
getAbsoluteFile
();
String
folderName
=
StringUtils
.
cleanPath
(
folder
.
getPath
());
String
folderName
=
StringUtils
.
cleanPath
(
folder
.
getPath
());
String
fileName
=
StringUtils
.
cleanPath
(
file
.
getPath
());
String
fileName
=
StringUtils
.
cleanPath
(
file
.
getPath
());
Assert
.
state
(
fileName
.
startsWith
(
folderName
),
"The file "
+
fileName
Assert
.
state
(
fileName
.
startsWith
(
folderName
),
()
->
"The file "
+
fileName
+
" is not contained in the source folder "
+
folderName
);
+
" is not contained in the source folder "
+
folderName
);
return
fileName
.
substring
(
folderName
.
length
()
+
1
);
return
fileName
.
substring
(
folderName
.
length
()
+
1
);
}
}
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java
View file @
3b71393e
...
@@ -299,7 +299,7 @@ public class HttpTunnelServer {
...
@@ -299,7 +299,7 @@ public class HttpTunnelServer {
long
timeout
=
HttpTunnelServer
.
this
.
disconnectTimeout
;
long
timeout
=
HttpTunnelServer
.
this
.
disconnectTimeout
;
long
duration
=
System
.
currentTimeMillis
()
-
this
.
lastHttpRequestTime
;
long
duration
=
System
.
currentTimeMillis
()
-
this
.
lastHttpRequestTime
;
Assert
.
state
(
duration
<
timeout
,
Assert
.
state
(
duration
<
timeout
,
"Disconnect timeout: "
+
timeout
+
" "
+
duration
);
()
->
"Disconnect timeout: "
+
timeout
+
" "
+
duration
);
}
}
}
}
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootConfigurationFinder.java
View file @
3b71393e
...
@@ -67,7 +67,7 @@ final class SpringBootConfigurationFinder {
...
@@ -67,7 +67,7 @@ final class SpringBootConfigurationFinder {
Set
<
BeanDefinition
>
components
=
this
.
scanner
.
findCandidateComponents
(
source
);
Set
<
BeanDefinition
>
components
=
this
.
scanner
.
findCandidateComponents
(
source
);
if
(!
components
.
isEmpty
())
{
if
(!
components
.
isEmpty
())
{
Assert
.
state
(
components
.
size
()
==
1
,
Assert
.
state
(
components
.
size
()
==
1
,
"Found multiple @SpringBootConfiguration annotated classes "
()
->
"Found multiple @SpringBootConfiguration annotated classes "
+
components
);
+
components
);
return
ClassUtils
.
resolveClassName
(
return
ClassUtils
.
resolveClassName
(
components
.
iterator
().
next
().
getBeanClassName
(),
null
);
components
.
iterator
().
next
().
getBeanClassName
(),
null
);
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java
View file @
3b71393e
...
@@ -96,7 +96,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
...
@@ -96,7 +96,7 @@ public class SpringBootContextLoader extends AbstractContextLoader {
Assert
.
state
(
Assert
.
state
(
!
ObjectUtils
.
isEmpty
(
configClasses
)
!
ObjectUtils
.
isEmpty
(
configClasses
)
||
!
ObjectUtils
.
isEmpty
(
configLocations
),
||
!
ObjectUtils
.
isEmpty
(
configLocations
),
"No configuration classes "
()
->
"No configuration classes "
+
"or locations found in @SpringApplicationConfiguration. "
+
"or locations found in @SpringApplicationConfiguration. "
+
"For default configuration detection to work you need "
+
"For default configuration detection to work you need "
+
"Spring 4.0.3 or better (found "
+
SpringVersion
.
getVersion
()
+
"Spring 4.0.3 or better (found "
+
SpringVersion
.
getVersion
()
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/DefinitionsParser.java
View file @
3b71393e
...
@@ -76,7 +76,7 @@ class DefinitionsParser {
...
@@ -76,7 +76,7 @@ class DefinitionsParser {
private
void
parseMockBeanAnnotation
(
MockBean
annotation
,
AnnotatedElement
element
)
{
private
void
parseMockBeanAnnotation
(
MockBean
annotation
,
AnnotatedElement
element
)
{
Set
<
ResolvableType
>
typesToMock
=
getOrDeduceTypes
(
element
,
annotation
.
value
());
Set
<
ResolvableType
>
typesToMock
=
getOrDeduceTypes
(
element
,
annotation
.
value
());
Assert
.
state
(!
typesToMock
.
isEmpty
(),
Assert
.
state
(!
typesToMock
.
isEmpty
(),
"Unable to deduce type to mock from "
+
element
);
()
->
"Unable to deduce type to mock from "
+
element
);
if
(
StringUtils
.
hasLength
(
annotation
.
name
()))
{
if
(
StringUtils
.
hasLength
(
annotation
.
name
()))
{
Assert
.
state
(
typesToMock
.
size
()
==
1
,
Assert
.
state
(
typesToMock
.
size
()
==
1
,
"The name attribute can only be used when mocking a single class"
);
"The name attribute can only be used when mocking a single class"
);
...
@@ -93,7 +93,7 @@ class DefinitionsParser {
...
@@ -93,7 +93,7 @@ class DefinitionsParser {
private
void
parseSpyBeanAnnotation
(
SpyBean
annotation
,
AnnotatedElement
element
)
{
private
void
parseSpyBeanAnnotation
(
SpyBean
annotation
,
AnnotatedElement
element
)
{
Set
<
ResolvableType
>
typesToSpy
=
getOrDeduceTypes
(
element
,
annotation
.
value
());
Set
<
ResolvableType
>
typesToSpy
=
getOrDeduceTypes
(
element
,
annotation
.
value
());
Assert
.
state
(!
typesToSpy
.
isEmpty
(),
Assert
.
state
(!
typesToSpy
.
isEmpty
(),
"Unable to deduce type to spy from "
+
element
);
()
->
"Unable to deduce type to spy from "
+
element
);
if
(
StringUtils
.
hasLength
(
annotation
.
name
()))
{
if
(
StringUtils
.
hasLength
(
annotation
.
name
()))
{
Assert
.
state
(
typesToSpy
.
size
()
==
1
,
Assert
.
state
(
typesToSpy
.
size
()
==
1
,
"The name attribute can only be used when spying a single class"
);
"The name attribute can only be used when spying a single class"
);
...
@@ -109,7 +109,8 @@ class DefinitionsParser {
...
@@ -109,7 +109,8 @@ class DefinitionsParser {
private
void
addDefinition
(
AnnotatedElement
element
,
Definition
definition
,
private
void
addDefinition
(
AnnotatedElement
element
,
Definition
definition
,
String
type
)
{
String
type
)
{
boolean
isNewDefinition
=
this
.
definitions
.
add
(
definition
);
boolean
isNewDefinition
=
this
.
definitions
.
add
(
definition
);
Assert
.
state
(
isNewDefinition
,
"Duplicate "
+
type
+
" definition "
+
definition
);
Assert
.
state
(
isNewDefinition
,
()
->
"Duplicate "
+
type
+
" definition "
+
definition
);
if
(
element
instanceof
Field
)
{
if
(
element
instanceof
Field
)
{
Field
field
=
(
Field
)
element
;
Field
field
=
(
Field
)
element
;
this
.
definitionFields
.
put
(
definition
,
field
);
this
.
definitionFields
.
put
(
definition
,
field
);
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockitoPostProcessor.java
View file @
3b71393e
...
@@ -380,7 +380,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
...
@@ -380,7 +380,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
void
inject
(
Field
field
,
Object
target
,
Definition
definition
)
{
void
inject
(
Field
field
,
Object
target
,
Definition
definition
)
{
String
beanName
=
this
.
beanNameRegistry
.
get
(
definition
);
String
beanName
=
this
.
beanNameRegistry
.
get
(
definition
);
Assert
.
state
(
StringUtils
.
hasLength
(
beanName
),
Assert
.
state
(
StringUtils
.
hasLength
(
beanName
),
"No bean found for definition "
+
definition
);
()
->
"No bean found for definition "
+
definition
);
inject
(
field
,
target
,
beanName
,
definition
);
inject
(
field
,
target
,
beanName
,
definition
);
}
}
...
@@ -389,7 +389,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
...
@@ -389,7 +389,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
try
{
try
{
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
Assert
.
state
(
ReflectionUtils
.
getField
(
field
,
target
)
==
null
,
Assert
.
state
(
ReflectionUtils
.
getField
(
field
,
target
)
==
null
,
"The field "
+
field
+
" cannot have an existing value"
);
()
->
"The field "
+
field
+
" cannot have an existing value"
);
Object
bean
=
this
.
beanFactory
.
getBean
(
beanName
,
field
.
getType
());
Object
bean
=
this
.
beanFactory
.
getBean
(
beanName
,
field
.
getType
());
if
(
definition
.
isProxyTargetAware
()
&&
isAopProxy
(
bean
))
{
if
(
definition
.
isProxyTargetAware
()
&&
isAopProxy
(
bean
))
{
MockitoAopProxyTargetInterceptor
.
applyTo
(
bean
);
MockitoAopProxyTargetInterceptor
.
applyTo
(
bean
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JavaExecutable.java
View file @
3b71393e
...
@@ -44,7 +44,7 @@ public class JavaExecutable {
...
@@ -44,7 +44,7 @@ public class JavaExecutable {
File
bin
=
new
File
(
new
File
(
javaHome
),
"bin"
);
File
bin
=
new
File
(
new
File
(
javaHome
),
"bin"
);
File
command
=
new
File
(
bin
,
"java.exe"
);
File
command
=
new
File
(
bin
,
"java.exe"
);
command
=
(
command
.
exists
()
?
command
:
new
File
(
bin
,
"java"
));
command
=
(
command
.
exists
()
?
command
:
new
File
(
bin
,
"java"
));
Assert
.
state
(
command
.
exists
(),
"Unable to find java in "
+
javaHome
);
Assert
.
state
(
command
.
exists
(),
()
->
"Unable to find java in "
+
javaHome
);
return
command
;
return
command
;
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/ApplicationTemp.java
View file @
3b71393e
...
@@ -80,7 +80,7 @@ public class ApplicationTemp {
...
@@ -80,7 +80,7 @@ public class ApplicationTemp {
this
.
dir
=
new
File
(
getTempDirectory
(),
toHexString
(
hash
));
this
.
dir
=
new
File
(
getTempDirectory
(),
toHexString
(
hash
));
this
.
dir
.
mkdirs
();
this
.
dir
.
mkdirs
();
Assert
.
state
(
this
.
dir
.
exists
(),
Assert
.
state
(
this
.
dir
.
exists
(),
"Unable to create temp directory "
+
this
.
dir
);
()
->
"Unable to create temp directory "
+
this
.
dir
);
}
}
}
}
return
this
.
dir
;
return
this
.
dir
;
...
@@ -90,8 +90,8 @@ public class ApplicationTemp {
...
@@ -90,8 +90,8 @@ public class ApplicationTemp {
String
property
=
System
.
getProperty
(
"java.io.tmpdir"
);
String
property
=
System
.
getProperty
(
"java.io.tmpdir"
);
Assert
.
state
(
StringUtils
.
hasLength
(
property
),
"No 'java.io.tmpdir' property set"
);
Assert
.
state
(
StringUtils
.
hasLength
(
property
),
"No 'java.io.tmpdir' property set"
);
File
file
=
new
File
(
property
);
File
file
=
new
File
(
property
);
Assert
.
state
(
file
.
exists
(),
"Temp directory"
+
file
+
" does not exist"
);
Assert
.
state
(
file
.
exists
(),
()
->
"Temp directory"
+
file
+
" does not exist"
);
Assert
.
state
(
file
.
isDirectory
(),
"Temp location "
+
file
+
" is not a directory"
);
Assert
.
state
(
file
.
isDirectory
(),
()
->
"Temp location "
+
file
+
" is not a directory"
);
return
file
;
return
file
;
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jackson/JsonObjectDeserializer.java
View file @
3b71393e
...
@@ -131,7 +131,7 @@ public abstract class JsonObjectDeserializer<T>
...
@@ -131,7 +131,7 @@ public abstract class JsonObjectDeserializer<T>
Assert
.
notNull
(
tree
,
"Tree must not be null"
);
Assert
.
notNull
(
tree
,
"Tree must not be null"
);
JsonNode
node
=
tree
.
get
(
fieldName
);
JsonNode
node
=
tree
.
get
(
fieldName
);
Assert
.
state
(
node
!=
null
&&
!(
node
instanceof
NullNode
),
Assert
.
state
(
node
!=
null
&&
!(
node
instanceof
NullNode
),
"Missing JSON field '"
+
fieldName
+
"'"
);
()
->
"Missing JSON field '"
+
fieldName
+
"'"
);
return
node
;
return
node
;
}
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyWebServer.java
View file @
3b71393e
...
@@ -92,7 +92,7 @@ public class JettyWebServer implements WebServer {
...
@@ -92,7 +92,7 @@ public class JettyWebServer implements WebServer {
@Override
@Override
protected
void
doStart
()
throws
Exception
{
protected
void
doStart
()
throws
Exception
{
for
(
Connector
connector
:
JettyWebServer
.
this
.
connectors
)
{
for
(
Connector
connector
:
JettyWebServer
.
this
.
connectors
)
{
Assert
.
state
(
connector
.
isStopped
(),
"Connector "
+
connector
Assert
.
state
(
connector
.
isStopped
(),
()
->
"Connector "
+
connector
+
" has been started prematurely"
);
+
" has been started prematurely"
);
}
}
JettyWebServer
.
this
.
server
.
setConnectors
(
null
);
JettyWebServer
.
this
.
server
.
setConnectors
(
null
);
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java
View file @
3b71393e
...
@@ -492,7 +492,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
...
@@ -492,7 +492,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
private
void
configurePersistSession
(
Manager
manager
)
{
private
void
configurePersistSession
(
Manager
manager
)
{
Assert
.
state
(
manager
instanceof
StandardManager
,
Assert
.
state
(
manager
instanceof
StandardManager
,
"Unable to persist HTTP session state using manager type "
()
->
"Unable to persist HTTP session state using manager type "
+
manager
.
getClass
().
getName
());
+
manager
.
getClass
().
getName
());
File
dir
=
getValidSessionStoreDir
();
File
dir
=
getValidSessionStoreDir
();
File
file
=
new
File
(
dir
,
"SESSIONS.ser"
);
File
file
=
new
File
(
dir
,
"SESSIONS.ser"
);
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/RegistrationBean.java
View file @
3b71393e
...
@@ -135,7 +135,7 @@ public abstract class RegistrationBean implements ServletContextInitializer, Ord
...
@@ -135,7 +135,7 @@ public abstract class RegistrationBean implements ServletContextInitializer, Ord
*/
*/
protected
void
configure
(
Registration
.
Dynamic
registration
)
{
protected
void
configure
(
Registration
.
Dynamic
registration
)
{
Assert
.
state
(
registration
!=
null
,
Assert
.
state
(
registration
!=
null
,
"Registration is null. Was something already registered for name=["
()
->
"Registration is null. Was something already registered for name=["
+
this
.
name
+
"]?"
);
+
this
.
name
+
"]?"
);
registration
.
setAsyncSupported
(
this
.
asyncSupported
);
registration
.
setAsyncSupported
(
this
.
asyncSupported
);
if
(!
this
.
initParameters
.
isEmpty
())
{
if
(!
this
.
initParameters
.
isEmpty
())
{
...
...
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