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
3b0f6e71
Commit
3b0f6e71
authored
Mar 25, 2018
by
dreis2211
Committed by
Stephane Nicoll
Mar 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Supplier variants of Assert methods
See gh-12630
parent
d771485e
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
33 additions
and
30 deletions
+33
-30
DiskSpaceHealthIndicatorProperties.java
...oconfigure/system/DiskSpaceHealthIndicatorProperties.java
+2
-2
MetricsRun.java
...k/boot/actuate/autoconfigure/metrics/test/MetricsRun.java
+1
-1
EndpointDiscoverer.java
.../boot/actuate/endpoint/annotation/EndpointDiscoverer.java
+1
-1
OperationMethodParameters.java
...te/endpoint/invoke/reflect/OperationMethodParameters.java
+1
-1
AutoConfigurationImportSelector.java
...k/boot/autoconfigure/AutoConfigurationImportSelector.java
+3
-2
CacheAutoConfiguration.java
...work/boot/autoconfigure/cache/CacheAutoConfiguration.java
+2
-2
CacheProperties.java
...ngframework/boot/autoconfigure/cache/CacheProperties.java
+2
-2
OnBeanCondition.java
...amework/boot/autoconfigure/condition/OnBeanCondition.java
+2
-2
HazelcastProperties.java
...ork/boot/autoconfigure/hazelcast/HazelcastProperties.java
+2
-2
JacksonAutoConfiguration.java
.../boot/autoconfigure/jackson/JacksonAutoConfiguration.java
+2
-2
ArchiveCommand.java
...ingframework/boot/cli/command/archive/ArchiveCommand.java
+2
-2
FolderSnapshot.java
...ringframework/boot/devtools/filewatch/FolderSnapshot.java
+2
-2
ClassPathChangeUploader.java
.../boot/devtools/remote/client/ClassPathChangeUploader.java
+3
-2
ClassLoaderFile.java
...rk/boot/devtools/restart/classloader/ClassLoaderFile.java
+2
-2
ConfigurationPropertiesBinder.java
...oot/context/properties/ConfigurationPropertiesBinder.java
+2
-1
EnableConfigurationPropertiesImportSelector.java
...operties/EnableConfigurationPropertiesImportSelector.java
+1
-1
Bindable.java
...pringframework/boot/context/properties/bind/Bindable.java
+1
-1
StringToEnumIgnoringCaseConverterFactory.java
...oot/convert/StringToEnumIgnoringCaseConverterFactory.java
+2
-2
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorProperties.java
View file @
3b0f6e71
...
...
@@ -50,8 +50,8 @@ public class DiskSpaceHealthIndicatorProperties {
}
public
void
setPath
(
File
path
)
{
Assert
.
isTrue
(
path
.
exists
(),
"Path '"
+
path
+
"' does not exist"
);
Assert
.
isTrue
(
path
.
canRead
(),
"Path '"
+
path
+
"' cannot be read"
);
Assert
.
isTrue
(
path
.
exists
(),
()
->
"Path '"
+
path
+
"' does not exist"
);
Assert
.
isTrue
(
path
.
canRead
(),
()
->
"Path '"
+
path
+
"' cannot be read"
);
this
.
path
=
path
;
}
...
...
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsRun.java
View file @
3b0f6e71
...
...
@@ -105,7 +105,7 @@ public final class MetricsRun {
Class
<?>[]
exportAutoConfigurations
)
{
for
(
Class
<?>
configuration
:
exportAutoConfigurations
)
{
Assert
.
state
(
EXPORT_AUTO_CONFIGURATIONS
.
contains
(
configuration
),
"Unknown export auto-configuration "
+
configuration
.
getName
());
()
->
"Unknown export auto-configuration "
+
configuration
.
getName
());
}
return
contextRunner
.
withPropertyValues
(
"management.metrics.use-global-registry=false"
)
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/annotation/EndpointDiscoverer.java
View file @
3b0f6e71
...
...
@@ -432,7 +432,7 @@ public abstract class EndpointDiscoverer<E extends ExposableEndpoint<O>, O exten
this
.
enabledByDefault
=
(
Boolean
)
attributes
.
get
(
"enableByDefault"
);
this
.
filter
=
getFilter
(
this
.
bean
.
getClass
());
Assert
.
state
(
StringUtils
.
hasText
(
this
.
id
),
"No @Endpoint id attribute specified for "
()
->
"No @Endpoint id attribute specified for "
+
bean
.
getClass
().
getName
());
}
...
...
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/invoke/reflect/OperationMethodParameters.java
View file @
3b0f6e71
...
...
@@ -51,7 +51,7 @@ class OperationMethodParameters implements OperationParameters {
String
[]
parameterNames
=
parameterNameDiscoverer
.
getParameterNames
(
method
);
Parameter
[]
parameters
=
method
.
getParameters
();
Assert
.
state
(
parameterNames
!=
null
,
"Failed to extract parameter names for "
+
method
);
()
->
"Failed to extract parameter names for "
+
method
);
this
.
operationParameters
=
getOperationParameters
(
parameters
,
parameterNames
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java
View file @
3b0f6e71
...
...
@@ -129,8 +129,9 @@ public class AutoConfigurationImportSelector
AnnotationAttributes
attributes
=
AnnotationAttributes
.
fromMap
(
metadata
.
getAnnotationAttributes
(
name
,
true
));
Assert
.
notNull
(
attributes
,
"No auto-configuration attributes found. Is "
+
metadata
.
getClassName
()
+
" annotated with "
+
ClassUtils
.
getShortName
(
name
)
+
"?"
);
()
->
"No auto-configuration attributes found. Is "
+
metadata
.
getClassName
()
+
" annotated with "
+
ClassUtils
.
getShortName
(
name
)
+
"?"
);
return
attributes
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.java
View file @
3b0f6e71
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -149,7 +149,7 @@ public class CacheAutoConfiguration {
@PostConstruct
public
void
checkHasCacheManager
()
{
Assert
.
notNull
(
this
.
cacheManager
,
"No cache manager could "
()
->
"No cache manager could "
+
"be auto-configured, check your configuration (caching "
+
"type is '"
+
this
.
cacheProperties
.
getType
()
+
"')"
);
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java
View file @
3b0f6e71
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -107,7 +107,7 @@ public class CacheProperties {
*/
public
Resource
resolveConfigLocation
(
Resource
config
)
{
if
(
config
!=
null
)
{
Assert
.
isTrue
(
config
.
exists
(),
"Cache configuration does not exist '"
Assert
.
isTrue
(
config
.
exists
(),
()
->
"Cache configuration does not exist '"
+
config
.
getDescription
()
+
"'"
);
return
config
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnBeanCondition.java
View file @
3b0f6e71
...
...
@@ -503,8 +503,8 @@ class OnBeanCondition extends SpringBootCondition implements ConfigurationCondit
@Override
protected
void
validate
(
BeanTypeDeductionException
ex
)
{
Assert
.
isTrue
(
getTypes
().
size
()
==
1
,
annotationName
()
+
" annotations must "
+
"specify only one type (got "
+
getTypes
()
+
")"
);
Assert
.
isTrue
(
getTypes
().
size
()
==
1
,
()
->
annotationName
()
+
"
annotations must
specify only one type (got "
+
getTypes
()
+
")"
);
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastProperties.java
View file @
3b0f6e71
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -52,7 +52,7 @@ public class HazelcastProperties {
if
(
this
.
config
==
null
)
{
return
null
;
}
Assert
.
isTrue
(
this
.
config
.
exists
(),
"Hazelcast configuration does not exist '"
Assert
.
isTrue
(
this
.
config
.
exists
(),
()
->
"Hazelcast configuration does not exist '"
+
this
.
config
.
getDescription
()
+
"'"
);
return
this
.
config
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java
View file @
3b0f6e71
...
...
@@ -323,8 +323,8 @@ public class JacksonAutoConfiguration {
// that may be added by Jackson in the future)
Field
field
=
ReflectionUtils
.
findField
(
PropertyNamingStrategy
.
class
,
fieldName
,
PropertyNamingStrategy
.
class
);
Assert
.
notNull
(
field
,
"Constant named '"
+
fieldName
+
"' not found on "
+
PropertyNamingStrategy
.
class
.
getName
());
Assert
.
notNull
(
field
,
()
->
"Constant named '"
+
fieldName
+
"' not found on "
+
PropertyNamingStrategy
.
class
.
getName
());
try
{
builder
.
propertyNamingStrategy
(
(
PropertyNamingStrategy
)
field
.
get
(
null
));
...
...
spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java
View file @
3b0f6e71
...
...
@@ -124,14 +124,14 @@ abstract class ArchiveCommand extends OptionParsingCommand {
protected
ExitStatus
run
(
OptionSet
options
)
throws
Exception
{
List
<?>
nonOptionArguments
=
new
ArrayList
<
Object
>(
options
.
nonOptionArguments
());
Assert
.
isTrue
(
nonOptionArguments
.
size
()
>=
2
,
"The name of the resulting "
Assert
.
isTrue
(
nonOptionArguments
.
size
()
>=
2
,
()
->
"The name of the resulting "
+
this
.
type
+
" and at least one source file must be specified"
);
File
output
=
new
File
((
String
)
nonOptionArguments
.
remove
(
0
));
Assert
.
isTrue
(
output
.
getName
().
toLowerCase
(
Locale
.
ENGLISH
)
.
endsWith
(
"."
+
this
.
type
),
"The output '"
+
output
+
"' is not a "
()
->
"The output '"
+
output
+
"' is not a "
+
this
.
type
.
toUpperCase
(
Locale
.
ENGLISH
)
+
" file."
);
deleteIfExists
(
output
);
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java
View file @
3b0f6e71
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -79,7 +79,7 @@ class FolderSnapshot {
Assert
.
notNull
(
snapshot
,
"Snapshot must not be null"
);
File
folder
=
this
.
folder
;
Assert
.
isTrue
(
snapshot
.
folder
.
equals
(
folder
),
"Snapshot source folder must be '"
+
folder
+
"'"
);
()
->
"Snapshot source folder must be '"
+
folder
+
"'"
);
Set
<
ChangedFile
>
changes
=
new
LinkedHashSet
<>();
Map
<
File
,
FileSnapshot
>
previousFiles
=
getFilesMap
();
for
(
FileSnapshot
currentFile
:
snapshot
.
files
)
{
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/ClassPathChangeUploader.java
View file @
3b0f6e71
...
...
@@ -111,8 +111,9 @@ public class ClassPathChangeUploader
headers
.
setContentLength
(
bytes
.
length
);
FileCopyUtils
.
copy
(
bytes
,
request
.
getBody
());
ClientHttpResponse
response
=
request
.
execute
();
Assert
.
state
(
response
.
getStatusCode
()
==
HttpStatus
.
OK
,
"Unexpected "
+
response
.
getStatusCode
()
HttpStatus
statusCode
=
response
.
getStatusCode
();
Assert
.
state
(
statusCode
==
HttpStatus
.
OK
,
()
->
"Unexpected "
+
statusCode
+
" response uploading class files"
);
logUpload
(
classLoaderFiles
);
return
;
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/classloader/ClassLoaderFile.java
View file @
3b0f6e71
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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,7 +56,7 @@ public class ClassLoaderFile implements Serializable {
public
ClassLoaderFile
(
Kind
kind
,
long
lastModified
,
byte
[]
contents
)
{
Assert
.
notNull
(
kind
,
"Kind must not be null"
);
Assert
.
isTrue
(
kind
==
Kind
.
DELETED
?
contents
==
null
:
contents
!=
null
,
"Contents must "
+
(
kind
==
Kind
.
DELETED
?
""
:
"not "
)
+
"be null"
);
()
->
"Contents must "
+
(
kind
==
Kind
.
DELETED
?
""
:
"not "
)
+
"be null"
);
this
.
kind
=
kind
;
this
.
lastModified
=
lastModified
;
this
.
contents
=
contents
;
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBinder.java
View file @
3b0f6e71
...
...
@@ -73,7 +73,8 @@ class ConfigurationPropertiesBinder {
public
void
bind
(
Bindable
<?>
target
)
{
ConfigurationProperties
annotation
=
target
.
getAnnotation
(
ConfigurationProperties
.
class
);
Assert
.
state
(
annotation
!=
null
,
"Missing @ConfigurationProperties on "
+
target
);
Assert
.
state
(
annotation
!=
null
,
()
->
"Missing @ConfigurationProperties on "
+
target
);
List
<
Validator
>
validators
=
getValidators
(
target
);
BindHandler
bindHandler
=
getBindHandler
(
annotation
,
validators
);
getBinder
().
bind
(
annotation
.
prefix
(),
target
,
bindHandler
);
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/EnableConfigurationPropertiesImportSelector.java
View file @
3b0f6e71
...
...
@@ -125,7 +125,7 @@ class EnableConfigurationPropertiesImportSelector implements ImportSelector {
private
void
assertHasAnnotation
(
Class
<?>
type
)
{
Assert
.
notNull
(
AnnotationUtils
.
findAnnotation
(
type
,
ConfigurationProperties
.
class
),
"No "
+
ConfigurationProperties
.
class
.
getSimpleName
()
()
->
"No "
+
ConfigurationProperties
.
class
.
getSimpleName
()
+
" annotation found on '"
+
type
.
getName
()
+
"'."
);
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java
View file @
3b0f6e71
...
...
@@ -153,7 +153,7 @@ public final class Bindable<T> {
Assert
.
isTrue
(
existingValue
==
null
||
this
.
type
.
isArray
()
||
this
.
boxedType
.
resolve
().
isInstance
(
existingValue
),
"ExistingValue must be an instance of "
+
this
.
type
);
()
->
"ExistingValue must be an instance of "
+
this
.
type
);
Supplier
<
T
>
value
=
(
existingValue
==
null
?
null
:
()
->
existingValue
);
return
new
Bindable
<>(
this
.
type
,
this
.
boxedType
,
value
,
NO_ANNOTATIONS
);
}
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToEnumIgnoringCaseConverterFactory.java
View file @
3b0f6e71
...
...
@@ -39,8 +39,8 @@ final class StringToEnumIgnoringCaseConverterFactory
while
(
enumType
!=
null
&&
!
enumType
.
isEnum
())
{
enumType
=
enumType
.
getSuperclass
();
}
Assert
.
notNull
(
enumType
,
"The target type "
+
targetType
.
getName
()
+
" does not refer to an enum"
);
Assert
.
notNull
(
enumType
,
()
->
"The target type "
+
targetType
.
getName
()
+
" does not refer to an enum"
);
return
new
StringToEnum
(
enumType
);
}
...
...
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