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
d8e2349e
Commit
d8e2349e
authored
Jan 23, 2020
by
dreis2211
Committed by
Stephane Nicoll
Jan 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Supplier variants of Assert
See gh-19864
parent
9fbaf761
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
28 additions
and
27 deletions
+28
-27
FileSystemWatcher.java
...gframework/boot/devtools/filewatch/FileSystemWatcher.java
+2
-2
FolderSnapshot.java
...ringframework/boot/devtools/filewatch/FolderSnapshot.java
+2
-2
ApiVersion.java
...ngframework/boot/buildpack/platform/build/ApiVersion.java
+1
-1
BuildOwner.java
...ngframework/boot/buildpack/platform/build/BuildOwner.java
+1
-1
BuilderMetadata.java
...mework/boot/buildpack/platform/build/BuilderMetadata.java
+1
-1
StackId.java
...pringframework/boot/buildpack/platform/build/StackId.java
+1
-1
ImageReference.java
...k/boot/buildpack/platform/docker/type/ImageReference.java
+2
-2
LayerId.java
...ramework/boot/buildpack/platform/docker/type/LayerId.java
+1
-1
VolumeName.java
...ework/boot/buildpack/platform/docker/type/VolumeName.java
+2
-1
MappedObject.java
...gframework/boot/buildpack/platform/json/MappedObject.java
+1
-1
BsdDomainSocket.java
...ework/boot/buildpack/platform/socket/BsdDomainSocket.java
+1
-1
LinuxDomainSocket.java
...ork/boot/buildpack/platform/socket/LinuxDomainSocket.java
+1
-1
IndexedLayers.java
...pringframework/boot/jarmode/layertools/IndexedLayers.java
+1
-1
ImagePackager.java
.../org/springframework/boot/loader/tools/ImagePackager.java
+2
-2
Layer.java
...ain/java/org/springframework/boot/loader/tools/Layer.java
+2
-2
Packager.java
.../java/org/springframework/boot/loader/tools/Packager.java
+4
-4
PropertiesLauncher.java
...a/org/springframework/boot/loader/PropertiesLauncher.java
+2
-2
ModifiedClassPathExtension.java
...oot/testsupport/classpath/ModifiedClassPathExtension.java
+1
-1
No files found.
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java
View file @
d8e2349e
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -124,7 +124,7 @@ public class FileSystemWatcher {
*/
public
void
addSourceFolder
(
File
folder
)
{
Assert
.
notNull
(
folder
,
"Folder must not be null"
);
Assert
.
isTrue
(!
folder
.
isFile
(),
"Folder '"
+
folder
+
"' must not be a file"
);
Assert
.
isTrue
(!
folder
.
isFile
(),
()
->
"Folder '"
+
folder
+
"' must not be a file"
);
synchronized
(
this
.
monitor
)
{
checkNotStarted
();
this
.
folders
.
put
(
folder
,
null
);
...
...
spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FolderSnapshot.java
View file @
d8e2349e
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -51,7 +51,7 @@ class FolderSnapshot {
*/
FolderSnapshot
(
File
folder
)
{
Assert
.
notNull
(
folder
,
"Folder must not be null"
);
Assert
.
isTrue
(!
folder
.
isFile
(),
"Folder '"
+
folder
+
"' must not be a file"
);
Assert
.
isTrue
(!
folder
.
isFile
(),
()
->
"Folder '"
+
folder
+
"' must not be a file"
);
this
.
folder
=
folder
;
this
.
time
=
new
Date
();
Set
<
FileSnapshot
>
files
=
new
LinkedHashSet
<>();
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/ApiVersion.java
View file @
d8e2349e
...
...
@@ -121,7 +121,7 @@ final class ApiVersion {
static
ApiVersion
parse
(
String
value
)
{
Assert
.
hasText
(
value
,
"Value must not be empty"
);
Matcher
matcher
=
PATTERN
.
matcher
(
value
);
Assert
.
isTrue
(
matcher
.
matches
(),
"Malformed version number '"
+
value
+
"'"
);
Assert
.
isTrue
(
matcher
.
matches
(),
()
->
"Malformed version number '"
+
value
+
"'"
);
try
{
int
major
=
Integer
.
parseInt
(
matcher
.
group
(
1
));
int
minor
=
Integer
.
parseInt
(
matcher
.
group
(
2
));
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildOwner.java
View file @
d8e2349e
...
...
@@ -49,7 +49,7 @@ class BuildOwner implements Owner {
private
long
getValue
(
Map
<
String
,
String
>
env
,
String
name
)
{
String
value
=
env
.
get
(
name
);
Assert
.
state
(
StringUtils
.
hasText
(
value
),
"Missing '"
+
name
+
"' value from the builder environment"
);
Assert
.
state
(
StringUtils
.
hasText
(
value
),
()
->
"Missing '"
+
name
+
"' value from the builder environment"
);
try
{
return
Long
.
parseLong
(
value
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuilderMetadata.java
View file @
d8e2349e
...
...
@@ -123,7 +123,7 @@ class BuilderMetadata extends MappedObject {
Assert
.
notNull
(
imageConfig
,
"ImageConfig must not be null"
);
Map
<
String
,
String
>
labels
=
imageConfig
.
getLabels
();
String
json
=
(
labels
!=
null
)
?
labels
.
get
(
LABEL_NAME
)
:
null
;
Assert
.
notNull
(
json
,
"No '"
+
LABEL_NAME
+
"' label found in image config"
);
Assert
.
notNull
(
json
,
()
->
"No '"
+
LABEL_NAME
+
"' label found in image config"
);
return
fromJson
(
json
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/StackId.java
View file @
d8e2349e
...
...
@@ -77,7 +77,7 @@ class StackId {
private
static
StackId
fromImageConfig
(
ImageConfig
imageConfig
)
{
Map
<
String
,
String
>
labels
=
imageConfig
.
getLabels
();
String
value
=
(
labels
!=
null
)
?
labels
.
get
(
LABEL_NAME
)
:
null
;
Assert
.
state
(
StringUtils
.
hasText
(
value
),
"Missing '"
+
LABEL_NAME
+
"' stack label"
);
Assert
.
state
(
StringUtils
.
hasText
(
value
),
()
->
"Missing '"
+
LABEL_NAME
+
"' stack label"
);
return
new
StackId
(
value
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.java
View file @
d8e2349e
...
...
@@ -151,7 +151,7 @@ public final class ImageReference {
* @throws IllegalStateException if the image reference contains a digest
*/
public
ImageReference
inTaggedForm
()
{
Assert
.
state
(
this
.
digest
==
null
,
"Image reference '"
+
this
+
"' cannot contain a digest"
);
Assert
.
state
(
this
.
digest
==
null
,
()
->
"Image reference '"
+
this
+
"' cannot contain a digest"
);
return
new
ImageReference
(
this
.
name
,
(
this
.
tag
!=
null
)
?
this
.
tag
:
LATEST
,
this
.
digest
);
}
...
...
@@ -163,7 +163,7 @@ public final class ImageReference {
*/
public
static
ImageReference
forJarFile
(
File
jarFile
)
{
String
filename
=
jarFile
.
getName
();
Assert
.
isTrue
(
filename
.
toLowerCase
().
endsWith
(
".jar"
),
"File '"
+
jarFile
+
"' is not a JAR"
);
Assert
.
isTrue
(
filename
.
toLowerCase
().
endsWith
(
".jar"
),
()
->
"File '"
+
jarFile
+
"' is not a JAR"
);
filename
=
filename
.
substring
(
0
,
filename
.
length
()
-
4
);
int
firstDot
=
filename
.
indexOf
(
'.'
);
if
(
firstDot
==
-
1
)
{
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/LayerId.java
View file @
d8e2349e
...
...
@@ -85,7 +85,7 @@ public final class LayerId {
public
static
LayerId
of
(
String
value
)
{
Assert
.
hasText
(
value
,
"Value must not be empty"
);
int
i
=
value
.
indexOf
(
':'
);
Assert
.
isTrue
(
i
>=
0
,
"Invalid layer ID '"
+
value
+
"'"
);
Assert
.
isTrue
(
i
>=
0
,
()
->
"Invalid layer ID '"
+
value
+
"'"
);
return
new
LayerId
(
value
,
value
.
substring
(
0
,
i
),
value
.
substring
(
i
+
1
));
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/VolumeName.java
View file @
d8e2349e
...
...
@@ -124,7 +124,8 @@ public final class VolumeName {
}
private
static
String
asHexString
(
byte
[]
digest
,
int
digestLength
)
{
Assert
.
isTrue
(
digestLength
<=
digest
.
length
,
"DigestLength must be less than or equal to "
+
digest
.
length
);
Assert
.
isTrue
(
digestLength
<=
digest
.
length
,
()
->
"DigestLength must be less than or equal to "
+
digest
.
length
);
byte
[]
shortDigest
=
new
byte
[
6
];
System
.
arraycopy
(
digest
,
0
,
shortDigest
,
0
,
shortDigest
.
length
);
return
String
.
format
(
"%0"
+
digestLength
+
"x"
,
new
BigInteger
(
1
,
shortDigest
));
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/json/MappedObject.java
View file @
d8e2349e
...
...
@@ -200,7 +200,7 @@ public class MappedObject {
if
(
declaringClass
==
Object
.
class
)
{
method
.
invoke
(
proxy
,
args
);
}
Assert
.
state
(
args
==
null
||
args
.
length
==
0
,
"Unsupported method "
+
method
);
Assert
.
state
(
args
==
null
||
args
.
length
==
0
,
()
->
"Unsupported method "
+
method
);
String
name
=
getName
(
method
.
getName
());
Class
<?>
type
=
method
.
getReturnType
();
return
valueForProperty
(
name
,
type
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/BsdDomainSocket.java
View file @
d8e2349e
...
...
@@ -65,7 +65,7 @@ class BsdDomainSocket extends DomainSocket {
public
byte
[]
sunPath
=
new
byte
[
MAX_PATH_LENGTH
];
private
SockaddrUn
(
byte
sunFamily
,
byte
[]
path
)
{
Assert
.
isTrue
(
path
.
length
<
MAX_PATH_LENGTH
,
"Path cannot exceed "
+
MAX_PATH_LENGTH
+
" bytes"
);
Assert
.
isTrue
(
path
.
length
<
MAX_PATH_LENGTH
,
()
->
"Path cannot exceed "
+
MAX_PATH_LENGTH
+
" bytes"
);
System
.
arraycopy
(
path
,
0
,
this
.
sunPath
,
0
,
path
.
length
);
this
.
sunPath
[
path
.
length
]
=
0
;
this
.
sunLen
=
(
byte
)
(
fieldOffset
(
"sunPath"
)
+
path
.
length
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/LinuxDomainSocket.java
View file @
d8e2349e
...
...
@@ -63,7 +63,7 @@ class LinuxDomainSocket extends DomainSocket {
public
byte
[]
sunPath
=
new
byte
[
MAX_PATH_LENGTH
];
private
SockaddrUn
(
byte
sunFamily
,
byte
[]
path
)
{
Assert
.
isTrue
(
path
.
length
<
MAX_PATH_LENGTH
,
"Path cannot exceed "
+
MAX_PATH_LENGTH
+
" bytes"
);
Assert
.
isTrue
(
path
.
length
<
MAX_PATH_LENGTH
,
()
->
"Path cannot exceed "
+
MAX_PATH_LENGTH
+
" bytes"
);
System
.
arraycopy
(
path
,
0
,
this
.
sunPath
,
0
,
path
.
length
);
this
.
sunPath
[
path
.
length
]
=
0
;
this
.
sunFamily
=
sunFamily
;
...
...
spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/IndexedLayers.java
View file @
d8e2349e
...
...
@@ -69,7 +69,7 @@ class IndexedLayers implements Layers {
Matcher
matcher
=
LAYER_PATTERN
.
matcher
(
name
);
if
(
matcher
.
matches
())
{
String
layer
=
matcher
.
group
(
1
);
Assert
.
state
(
this
.
layers
.
contains
(
layer
),
"Unexpected layer '"
+
layer
+
"'"
);
Assert
.
state
(
this
.
layers
.
contains
(
layer
),
()
->
"Unexpected layer '"
+
layer
+
"'"
);
return
layer
;
}
return
this
.
layers
.
contains
(
APPLICATION_LAYER
)
?
APPLICATION_LAYER
:
SPRING_BOOT_APPLICATION_LAYER
;
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/ImagePackager.java
View file @
d8e2349e
...
...
@@ -52,8 +52,8 @@ public class ImagePackager extends Packager {
private
void
packageImage
(
Libraries
libraries
,
AbstractJarWriter
writer
)
throws
IOException
{
File
source
=
isAlreadyPackaged
()
?
getBackupFile
()
:
getSource
();
Assert
.
state
(
source
.
exists
()
&&
source
.
isFile
(),
"Unable to read jar file "
+
source
);
Assert
.
state
(!
isAlreadyPackaged
(
source
),
"Repackaged jar file "
+
source
+
" cannot be exported"
);
Assert
.
state
(
source
.
exists
()
&&
source
.
isFile
(),
()
->
"Unable to read jar file "
+
source
);
Assert
.
state
(!
isAlreadyPackaged
(
source
),
()
->
"Repackaged jar file "
+
source
+
" cannot be exported"
);
try
(
JarFile
sourceJar
=
new
JarFile
(
source
))
{
write
(
sourceJar
,
libraries
,
writer
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Layer.java
View file @
d8e2349e
...
...
@@ -40,9 +40,9 @@ public class Layer {
*/
public
Layer
(
String
name
)
{
Assert
.
hasText
(
name
,
"Name must not be empty"
);
Assert
.
isTrue
(
PATTERN
.
matcher
(
name
).
matches
(),
"Malformed layer name '"
+
name
+
"'"
);
Assert
.
isTrue
(
PATTERN
.
matcher
(
name
).
matches
(),
()
->
"Malformed layer name '"
+
name
+
"'"
);
Assert
.
isTrue
(!
name
.
equalsIgnoreCase
(
"ext"
)
&&
!
name
.
toLowerCase
().
startsWith
(
"springboot"
),
"Layer name '"
+
name
+
"' is reserved"
);
()
->
"Layer name '"
+
name
+
"' is reserved"
);
this
.
name
=
name
;
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Packager.java
View file @
d8e2349e
...
...
@@ -413,7 +413,7 @@ public abstract class Packager {
private
String
transformName
(
String
name
)
{
if
(
this
.
layout
instanceof
LayeredLayout
)
{
Layer
layer
=
this
.
layers
.
getLayer
(
name
);
Assert
.
state
(
layer
!=
null
,
"Invalid 'null' layer from "
+
this
.
layers
.
getClass
().
getName
());
Assert
.
state
(
layer
!=
null
,
()
->
"Invalid 'null' layer from "
+
this
.
layers
.
getClass
().
getName
());
return
((
LayeredLayout
)
this
.
layout
).
getRepackagedClassesLocation
(
layer
)
+
name
;
}
return
this
.
layout
.
getRepackagedClassesLocation
()
+
name
;
...
...
@@ -455,7 +455,7 @@ public abstract class Packager {
if
(
location
!=
null
)
{
String
path
=
location
+
library
.
getName
();
Library
existing
=
this
.
libraries
.
putIfAbsent
(
path
,
library
);
Assert
.
state
(
existing
==
null
,
"Duplicate library "
+
library
.
getName
());
Assert
.
state
(
existing
==
null
,
()
->
"Duplicate library "
+
library
.
getName
());
}
}
...
...
@@ -464,7 +464,7 @@ public abstract class Packager {
if
(
layout
instanceof
LayeredLayout
)
{
Layers
layers
=
Packager
.
this
.
layers
;
Layer
layer
=
layers
.
getLayer
(
library
);
Assert
.
state
(
layer
!=
null
,
"Invalid 'null' library layer from "
+
layers
.
getClass
().
getName
());
Assert
.
state
(
layer
!=
null
,
()
->
"Invalid 'null' library layer from "
+
layers
.
getClass
().
getName
());
return
((
LayeredLayout
)
layout
).
getLibraryLocation
(
library
.
getName
(),
library
.
getScope
(),
layer
);
}
return
layout
.
getLibraryLocation
(
library
.
getName
(),
library
.
getScope
());
...
...
@@ -479,7 +479,7 @@ public abstract class Packager {
@Override
public
String
sha1Hash
(
String
name
)
throws
IOException
{
Library
library
=
this
.
libraries
.
get
(
name
);
Assert
.
notNull
(
library
,
"No library found for entry name '"
+
name
+
"'"
);
Assert
.
notNull
(
library
,
()
->
"No library found for entry name '"
+
name
+
"'"
);
return
Digest
.
sha1
(
library:
:
openStream
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
View file @
d8e2349e
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
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.
...
...
@@ -371,7 +371,7 @@ public class PropertiesLauncher extends Launcher {
if
(
classLoader
==
null
)
{
classLoader
=
newClassLoader
(
type
,
NO_PARAMS
);
}
Assert
.
notNull
(
classLoader
,
"Unable to create class loader for "
+
className
);
Assert
.
notNull
(
classLoader
,
()
->
"Unable to create class loader for "
+
className
);
return
classLoader
;
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathExtension.java
View file @
d8e2349e
...
...
@@ -118,7 +118,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
}
}
}
Assert
.
state
(
method
!=
null
,
"Unable to find "
+
testClass
+
"."
+
testMethodName
);
Assert
.
state
(
method
!=
null
,
()
->
"Unable to find "
+
testClass
+
"."
+
testMethodName
);
return
method
;
}
...
...
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