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
2d8528d5
Commit
2d8528d5
authored
Oct 22, 2020
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to deprecation of StringUtils.isEmpty(Object)
See gh-23774
parent
3bfe1b00
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21 additions
and
20 deletions
+21
-20
ConditionMessage.java
...mework/boot/autoconfigure/condition/ConditionMessage.java
+4
-4
EntityScanPackages.java
...amework/boot/autoconfigure/domain/EntityScanPackages.java
+1
-1
TestPropertyValues.java
...rg/springframework/boot/test/util/TestPropertyValues.java
+5
-5
DockerEngineException.java
...pack/platform/docker/transport/DockerEngineException.java
+2
-2
Log4J2LoggingSystem.java
...ingframework/boot/logging/log4j2/Log4J2LoggingSystem.java
+1
-1
WebServerPortFileWriter.java
...ngframework/boot/web/context/WebServerPortFileWriter.java
+1
-1
CompressionCustomizer.java
...mework/boot/web/embedded/netty/CompressionCustomizer.java
+2
-2
UndertowServletWebServer.java
.../boot/web/embedded/undertow/UndertowServletWebServer.java
+1
-1
SslConfigurationValidator.java
...gframework/boot/web/server/SslConfigurationValidator.java
+1
-1
DefaultErrorAttributes.java
...mework/boot/web/servlet/error/DefaultErrorAttributes.java
+3
-2
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionMessage.java
View file @
2d8528d5
...
@@ -296,11 +296,11 @@ public final class ConditionMessage {
...
@@ -296,11 +296,11 @@ public final class ConditionMessage {
* @return a built {@link ConditionMessage}
* @return a built {@link ConditionMessage}
*/
*/
public
ConditionMessage
because
(
String
reason
)
{
public
ConditionMessage
because
(
String
reason
)
{
if
(
StringUtils
.
isEmpty
(
reason
))
{
if
(
StringUtils
.
hasLength
(
reason
))
{
return
new
ConditionMessage
(
ConditionMessage
.
this
,
this
.
condition
);
return
new
ConditionMessage
(
ConditionMessage
.
this
,
StringUtils
.
hasLength
(
this
.
condition
)
?
this
.
condition
+
" "
+
reason
:
reason
);
}
}
return
new
ConditionMessage
(
ConditionMessage
.
this
,
return
new
ConditionMessage
(
ConditionMessage
.
this
,
this
.
condition
);
StringUtils
.
isEmpty
(
this
.
condition
)
?
reason
:
this
.
condition
+
" "
+
reason
);
}
}
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/domain/EntityScanPackages.java
View file @
2d8528d5
...
@@ -140,7 +140,7 @@ public class EntityScanPackages {
...
@@ -140,7 +140,7 @@ public class EntityScanPackages {
}
}
if
(
packagesToScan
.
isEmpty
())
{
if
(
packagesToScan
.
isEmpty
())
{
String
packageName
=
ClassUtils
.
getPackageName
(
metadata
.
getClassName
());
String
packageName
=
ClassUtils
.
getPackageName
(
metadata
.
getClassName
());
Assert
.
state
(
!
StringUtils
.
isEmpty
(
packageName
),
"@EntityScan cannot be used with the default package"
);
Assert
.
state
(
StringUtils
.
hasLength
(
packageName
),
"@EntityScan cannot be used with the default package"
);
return
Collections
.
singleton
(
packageName
);
return
Collections
.
singleton
(
packageName
);
}
}
return
packagesToScan
;
return
packagesToScan
;
...
...
spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/util/TestPropertyValues.java
View file @
2d8528d5
/*
/*
* 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");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -277,10 +277,10 @@ public final class TestPropertyValues {
...
@@ -277,10 +277,10 @@ public final class TestPropertyValues {
}
}
private
static
Pair
of
(
String
name
,
String
value
)
{
private
static
Pair
of
(
String
name
,
String
value
)
{
if
(
StringUtils
.
isEmpty
(
name
)
&&
StringUtils
.
isEmpty
(
value
))
{
if
(
StringUtils
.
hasLength
(
name
)
||
StringUtils
.
hasLength
(
value
))
{
return
n
ull
;
return
n
ew
Pair
(
name
,
value
)
;
}
}
return
n
ew
Pair
(
name
,
value
)
;
return
n
ull
;
}
}
}
}
...
@@ -309,7 +309,7 @@ public final class TestPropertyValues {
...
@@ -309,7 +309,7 @@ public final class TestPropertyValues {
private
String
setOrClear
(
String
name
,
String
value
)
{
private
String
setOrClear
(
String
name
,
String
value
)
{
Assert
.
notNull
(
name
,
"Name must not be null"
);
Assert
.
notNull
(
name
,
"Name must not be null"
);
if
(
StringUtils
.
isEmpty
(
value
))
{
if
(
!
StringUtils
.
hasLength
(
value
))
{
return
(
String
)
System
.
getProperties
().
remove
(
name
);
return
(
String
)
System
.
getProperties
().
remove
(
name
);
}
}
return
(
String
)
System
.
getProperties
().
setProperty
(
name
,
value
);
return
(
String
)
System
.
getProperties
().
setProperty
(
name
,
value
);
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/DockerEngineException.java
View file @
2d8528d5
...
@@ -87,10 +87,10 @@ public class DockerEngineException extends RuntimeException {
...
@@ -87,10 +87,10 @@ public class DockerEngineException extends RuntimeException {
Assert
.
notNull
(
uri
,
"URI must not be null"
);
Assert
.
notNull
(
uri
,
"URI must not be null"
);
StringBuilder
message
=
new
StringBuilder
(
StringBuilder
message
=
new
StringBuilder
(
"Docker API call to '"
+
host
+
uri
+
"' failed with status code "
+
statusCode
);
"Docker API call to '"
+
host
+
uri
+
"' failed with status code "
+
statusCode
);
if
(
!
StringUtils
.
isEmpty
(
reasonPhrase
))
{
if
(
StringUtils
.
hasLength
(
reasonPhrase
))
{
message
.
append
(
" \""
).
append
(
reasonPhrase
).
append
(
"\""
);
message
.
append
(
" \""
).
append
(
reasonPhrase
).
append
(
"\""
);
}
}
if
(
responseMessage
!=
null
&&
!
StringUtils
.
isEmpty
(
responseMessage
.
getMessage
()))
{
if
(
responseMessage
!=
null
&&
StringUtils
.
hasLength
(
responseMessage
.
getMessage
()))
{
message
.
append
(
" and message \""
).
append
(
responseMessage
.
getMessage
()).
append
(
"\""
);
message
.
append
(
" and message \""
).
append
(
responseMessage
.
getMessage
()).
append
(
"\""
);
}
}
if
(
errors
!=
null
&&
!
errors
.
isEmpty
())
{
if
(
errors
!=
null
&&
!
errors
.
isEmpty
())
{
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
View file @
2d8528d5
...
@@ -258,7 +258,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
...
@@ -258,7 +258,7 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
}
}
private
String
getSubName
(
String
name
)
{
private
String
getSubName
(
String
name
)
{
if
(
StringUtils
.
isEmpty
(
name
))
{
if
(
!
StringUtils
.
hasLength
(
name
))
{
return
null
;
return
null
;
}
}
int
nested
=
name
.
lastIndexOf
(
'$'
);
int
nested
=
name
.
lastIndexOf
(
'$'
);
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/context/WebServerPortFileWriter.java
View file @
2d8528d5
...
@@ -105,7 +105,7 @@ public class WebServerPortFileWriter implements ApplicationListener<WebServerIni
...
@@ -105,7 +105,7 @@ public class WebServerPortFileWriter implements ApplicationListener<WebServerIni
*/
*/
protected
File
getPortFile
(
ApplicationContext
applicationContext
)
{
protected
File
getPortFile
(
ApplicationContext
applicationContext
)
{
String
namespace
=
getServerNamespace
(
applicationContext
);
String
namespace
=
getServerNamespace
(
applicationContext
);
if
(
StringUtils
.
isEmpty
(
namespace
))
{
if
(
!
StringUtils
.
hasLength
(
namespace
))
{
return
this
.
file
;
return
this
.
file
;
}
}
String
name
=
this
.
file
.
getName
();
String
name
=
this
.
file
.
getName
();
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/netty/CompressionCustomizer.java
View file @
2d8528d5
/*
/*
* 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");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -71,7 +71,7 @@ final class CompressionCustomizer implements NettyServerCustomizer {
...
@@ -71,7 +71,7 @@ final class CompressionCustomizer implements NettyServerCustomizer {
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
return
(
request
,
response
)
->
{
return
(
request
,
response
)
->
{
String
contentType
=
response
.
responseHeaders
().
get
(
HttpHeaderNames
.
CONTENT_TYPE
);
String
contentType
=
response
.
responseHeaders
().
get
(
HttpHeaderNames
.
CONTENT_TYPE
);
if
(
StringUtils
.
isEmpty
(
contentType
))
{
if
(
!
StringUtils
.
hasLength
(
contentType
))
{
return
false
;
return
false
;
}
}
try
{
try
{
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/undertow/UndertowServletWebServer.java
View file @
2d8528d5
...
@@ -123,7 +123,7 @@ public class UndertowServletWebServer extends UndertowWebServer {
...
@@ -123,7 +123,7 @@ public class UndertowServletWebServer extends UndertowWebServer {
@Override
@Override
protected
HttpHandler
createHttpHandler
()
{
protected
HttpHandler
createHttpHandler
()
{
HttpHandler
handler
=
super
.
createHttpHandler
();
HttpHandler
handler
=
super
.
createHttpHandler
();
if
(
!
StringUtils
.
isEmpty
(
this
.
contextPath
))
{
if
(
StringUtils
.
hasLength
(
this
.
contextPath
))
{
handler
=
Handlers
.
path
().
addPrefixPath
(
this
.
contextPath
,
handler
);
handler
=
Handlers
.
path
().
addPrefixPath
(
this
.
contextPath
,
handler
);
}
}
return
handler
;
return
handler
;
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/SslConfigurationValidator.java
View file @
2d8528d5
...
@@ -34,7 +34,7 @@ public final class SslConfigurationValidator {
...
@@ -34,7 +34,7 @@ public final class SslConfigurationValidator {
}
}
public
static
void
validateKeyAlias
(
KeyStore
keyStore
,
String
keyAlias
)
{
public
static
void
validateKeyAlias
(
KeyStore
keyStore
,
String
keyAlias
)
{
if
(
!
StringUtils
.
isEmpty
(
keyAlias
))
{
if
(
StringUtils
.
hasLength
(
keyAlias
))
{
try
{
try
{
Assert
.
state
(
keyStore
.
containsAlias
(
keyAlias
),
Assert
.
state
(
keyStore
.
containsAlias
(
keyAlias
),
()
->
String
.
format
(
"Keystore does not contain specified alias '%s'"
,
keyAlias
));
()
->
String
.
format
(
"Keystore does not contain specified alias '%s'"
,
keyAlias
));
...
...
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributes.java
View file @
2d8528d5
...
@@ -32,6 +32,7 @@ import org.springframework.boot.web.error.ErrorAttributeOptions.Include;
...
@@ -32,6 +32,7 @@ import org.springframework.boot.web.error.ErrorAttributeOptions.Include;
import
org.springframework.core.Ordered
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.validation.ObjectError
;
...
@@ -199,10 +200,10 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
...
@@ -199,10 +200,10 @@ public class DefaultErrorAttributes implements ErrorAttributes, HandlerException
*/
*/
protected
String
getMessage
(
WebRequest
webRequest
,
Throwable
error
)
{
protected
String
getMessage
(
WebRequest
webRequest
,
Throwable
error
)
{
Object
message
=
getAttribute
(
webRequest
,
RequestDispatcher
.
ERROR_MESSAGE
);
Object
message
=
getAttribute
(
webRequest
,
RequestDispatcher
.
ERROR_MESSAGE
);
if
(!
String
Utils
.
isEmpty
(
message
))
{
if
(!
Object
Utils
.
isEmpty
(
message
))
{
return
message
.
toString
();
return
message
.
toString
();
}
}
if
(
error
!=
null
&&
!
StringUtils
.
isEmpty
(
error
.
getMessage
()))
{
if
(
error
!=
null
&&
StringUtils
.
hasLength
(
error
.
getMessage
()))
{
return
error
.
getMessage
();
return
error
.
getMessage
();
}
}
return
"No message available"
;
return
"No message available"
;
...
...
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