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
d58f38f6
Commit
d58f38f6
authored
Jan 24, 2017
by
dreis
Committed by
Stephane Nicoll
Jan 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use String.replace() with single char if possible
See gh-8089
parent
551bfb2c
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
23 additions
and
23 deletions
+23
-23
HealthMvcEndpoint.java
...ramework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
+1
-1
CacheCondition.java
...ingframework/boot/autoconfigure/cache/CacheCondition.java
+1
-1
SessionCondition.java
...ramework/boot/autoconfigure/session/SessionCondition.java
+1
-1
DefaultErrorViewResolverTests.java
...boot/autoconfigure/web/DefaultErrorViewResolverTests.java
+1
-1
ArchiveCommand.java
...ingframework/boot/cli/command/archive/ArchiveCommand.java
+1
-1
ExtendedGroovyClassLoader.java
...ramework/boot/cli/compiler/ExtendedGroovyClassLoader.java
+1
-1
RestartClassLoaderTests.java
...devtools/restart/classloader/RestartClassLoaderTests.java
+1
-1
DevToolsSettingsTests.java
...amework/boot/devtools/settings/DevToolsSettingsTests.java
+1
-1
TestCompiler.java
...org/springframework/boot/junit/compiler/TestCompiler.java
+1
-1
AbstractConfigurationClassTests.java
...k/boot/test/testutil/AbstractConfigurationClassTests.java
+1
-1
MainClassFinder.java
...rg/springframework/boot/loader/tools/MainClassFinder.java
+1
-1
TestJarFile.java
...va/org/springframework/boot/loader/tools/TestJarFile.java
+1
-1
LaunchedURLClassLoader.java
...g/springframework/boot/loader/LaunchedURLClassLoader.java
+2
-2
PropertiesLauncher.java
...a/org/springframework/boot/loader/PropertiesLauncher.java
+1
-1
SystemPropertyUtils.java
...springframework/boot/loader/util/SystemPropertyUtils.java
+2
-2
RelaxedConversionService.java
...g/springframework/boot/bind/RelaxedConversionService.java
+1
-1
RelaxedNames.java
...main/java/org/springframework/boot/bind/RelaxedNames.java
+3
-3
AbstractLoggingSystem.java
...g/springframework/boot/logging/AbstractLoggingSystem.java
+1
-1
XmlEmbeddedWebApplicationContextTests.java
...ntext/embedded/XmlEmbeddedWebApplicationContextTests.java
+1
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HealthMvcEndpoint.java
View file @
d58f38f6
...
...
@@ -139,7 +139,7 @@ public class HealthMvcEndpoint extends AbstractEndpointMvcAdapter<HealthEndpoint
private
HttpStatus
getStatus
(
Health
health
)
{
String
code
=
health
.
getStatus
().
getCode
();
if
(
code
!=
null
)
{
code
=
code
.
toLowerCase
().
replace
(
"_"
,
"-"
);
code
=
code
.
toLowerCase
().
replace
(
'_'
,
'-'
);
for
(
String
candidate
:
RelaxedNames
.
forCamelCase
(
code
))
{
HttpStatus
status
=
this
.
statusMapping
.
get
(
candidate
);
if
(
status
!=
null
)
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheCondition.java
View file @
d58f38f6
...
...
@@ -50,7 +50,7 @@ class CacheCondition extends SpringBootCondition {
}
CacheType
cacheType
=
CacheConfigurations
.
getType
(((
AnnotationMetadata
)
metadata
).
getClassName
());
String
value
=
resolver
.
getProperty
(
"type"
).
replace
(
"-"
,
"_"
).
toUpperCase
();
String
value
=
resolver
.
getProperty
(
"type"
).
replace
(
'-'
,
'_'
).
toUpperCase
();
if
(
value
.
equals
(
cacheType
.
name
()))
{
return
ConditionOutcome
.
match
(
message
.
because
(
value
+
" cache type"
));
}
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/SessionCondition.java
View file @
d58f38f6
...
...
@@ -45,7 +45,7 @@ class SessionCondition extends SpringBootCondition {
return
ConditionOutcome
.
noMatch
(
message
.
didNotFind
(
"spring.session.store-type property"
).
atAll
());
}
String
value
=
resolver
.
getProperty
(
"store-type"
).
replace
(
"-"
,
"_"
).
toUpperCase
();
String
value
=
resolver
.
getProperty
(
"store-type"
).
replace
(
'-'
,
'_'
).
toUpperCase
();
if
(
value
.
equals
(
sessionStoreType
.
name
()))
{
return
ConditionOutcome
.
match
(
message
.
found
(
"spring.session.store-type property"
).
items
(
sessionStoreType
));
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/DefaultErrorViewResolverTests.java
View file @
d58f38f6
...
...
@@ -212,7 +212,7 @@ public class DefaultErrorViewResolverTests {
private
void
setResourceLocation
(
String
path
)
{
String
packageName
=
getClass
().
getPackage
().
getName
();
this
.
resourceProperties
.
setStaticLocations
(
new
String
[]
{
"classpath:"
+
packageName
.
replace
(
"."
,
"/"
)
+
path
+
"/"
});
"classpath:"
+
packageName
.
replace
(
'.'
,
'/'
)
+
path
+
"/"
});
}
private
MockHttpServletResponse
render
(
ModelAndView
modelAndView
)
throws
Exception
{
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/archive/ArchiveCommand.java
View file @
d58f38f6
...
...
@@ -264,7 +264,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
if
(
classLoader
==
null
)
{
classLoader
=
Thread
.
currentThread
().
getContextClassLoader
();
}
String
name
=
sourceClass
.
replace
(
"."
,
"/"
)
+
".class"
;
String
name
=
sourceClass
.
replace
(
'.'
,
'/'
)
+
".class"
;
InputStream
stream
=
classLoader
.
getResourceAsStream
(
name
);
writer
.
writeEntry
(
this
.
layout
.
getClassesLocation
()
+
name
,
stream
);
}
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/ExtendedGroovyClassLoader.java
View file @
d58f38f6
...
...
@@ -161,7 +161,7 @@ public class ExtendedGroovyClassLoader extends GroovyClassLoader {
protected
Class
<?>
createClass
(
byte
[]
code
,
ClassNode
classNode
)
{
Class
<?>
createdClass
=
super
.
createClass
(
code
,
classNode
);
ExtendedGroovyClassLoader
.
this
.
classResources
.
put
(
classNode
.
getName
().
replace
(
"."
,
"/"
)
+
".class"
,
code
);
.
put
(
classNode
.
getName
().
replace
(
'.'
,
'/'
)
+
".class"
,
code
);
return
createdClass
;
}
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java
View file @
d58f38f6
...
...
@@ -52,7 +52,7 @@ public class RestartClassLoaderTests {
private
static
final
String
PACKAGE
=
RestartClassLoaderTests
.
class
.
getPackage
()
.
getName
();
private
static
final
String
PACKAGE_PATH
=
PACKAGE
.
replace
(
"."
,
"/"
);
private
static
final
String
PACKAGE_PATH
=
PACKAGE
.
replace
(
'.'
,
'/'
);
private
static
final
Charset
UTF_8
=
Charset
.
forName
(
"UTF-8"
);
...
...
spring-boot-devtools/src/test/java/org/springframework/boot/devtools/settings/DevToolsSettingsTests.java
View file @
d58f38f6
...
...
@@ -37,7 +37,7 @@ public class DevToolsSettingsTests {
public
TemporaryFolder
temporaryFolder
=
new
TemporaryFolder
();
private
static
final
String
ROOT
=
DevToolsSettingsTests
.
class
.
getPackage
().
getName
()
.
replace
(
"."
,
"/"
)
+
"/"
;
.
replace
(
'.'
,
'/'
)
+
"/"
;
@Test
public
void
includePatterns
()
throws
Exception
{
...
...
spring-boot-test-support/src/main/java/org/springframework/boot/junit/compiler/TestCompiler.java
View file @
d58f38f6
...
...
@@ -99,7 +99,7 @@ public class TestCompiler {
}
public
static
String
sourcePathFor
(
Class
<?>
type
)
{
return
type
.
getName
().
replace
(
"."
,
"/"
)
+
".java"
;
return
type
.
getName
().
replace
(
'.'
,
'/'
)
+
".java"
;
}
protected
File
getSourceFolder
()
{
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/testutil/AbstractConfigurationClassTests.java
View file @
d58f38f6
...
...
@@ -65,7 +65,7 @@ public abstract class AbstractConfigurationClassTests {
private
Set
<
AnnotationMetadata
>
findConfigurationClasses
()
throws
IOException
{
Set
<
AnnotationMetadata
>
configurationClasses
=
new
HashSet
<
AnnotationMetadata
>();
Resource
[]
resources
=
this
.
resolver
.
getResources
(
"classpath*:"
+
getClass
().
getPackage
().
getName
().
replace
(
"."
,
"/"
)
+
"/**/*.class"
);
+
getClass
().
getPackage
().
getName
().
replace
(
'.'
,
'/'
)
+
"/**/*.class"
);
for
(
Resource
resource
:
resources
)
{
if
(!
isTestClass
(
resource
))
{
MetadataReader
metadataReader
=
new
SimpleMetadataReaderFactory
()
...
...
spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/MainClassFinder.java
View file @
d58f38f6
...
...
@@ -262,7 +262,7 @@ public abstract class MainClassFinder {
}
private
static
String
convertToClassName
(
String
name
,
String
prefix
)
{
name
=
name
.
replace
(
"/"
,
"."
);
name
=
name
.
replace
(
'/'
,
'.'
);
name
=
name
.
replace
(
'\\'
,
'.'
);
name
=
name
.
substring
(
0
,
name
.
length
()
-
DOT_CLASS
.
length
());
if
(
prefix
!=
null
)
{
...
...
spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/TestJarFile.java
View file @
d58f38f6
...
...
@@ -55,7 +55,7 @@ public class TestJarFile {
File
file
=
getFilePath
(
filename
);
file
.
getParentFile
().
mkdirs
();
InputStream
inputStream
=
getClass
().
getResourceAsStream
(
"/"
+
classToCopy
.
getName
().
replace
(
"."
,
"/"
)
+
".class"
);
"/"
+
classToCopy
.
getName
().
replace
(
'.'
,
'/'
)
+
".class"
);
copyToFile
(
inputStream
,
file
);
if
(
time
!=
null
)
{
file
.
setLastModified
(
time
);
...
...
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/LaunchedURLClassLoader.java
View file @
d58f38f6
...
...
@@ -132,8 +132,8 @@ public class LaunchedURLClassLoader extends URLClassLoader {
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Object
>()
{
@Override
public
Object
run
()
throws
ClassNotFoundException
{
String
packageEntryName
=
packageName
.
replace
(
"."
,
"/"
)
+
"/"
;
String
classEntryName
=
className
.
replace
(
"."
,
"/"
)
+
".class"
;
String
packageEntryName
=
packageName
.
replace
(
'.'
,
'/'
)
+
"/"
;
String
classEntryName
=
className
.
replace
(
'.'
,
'/'
)
+
".class"
;
for
(
URL
url
:
getURLs
())
{
try
{
URLConnection
connection
=
url
.
openConnection
();
...
...
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/PropertiesLauncher.java
View file @
d58f38f6
...
...
@@ -359,7 +359,7 @@ public class PropertiesLauncher extends Launcher {
private
String
getProperty
(
String
propertyKey
,
String
manifestKey
)
throws
Exception
{
if
(
manifestKey
==
null
)
{
manifestKey
=
propertyKey
.
replace
(
"."
,
"-"
);
manifestKey
=
propertyKey
.
replace
(
'.'
,
'-'
);
manifestKey
=
toCamelCase
(
manifestKey
);
}
String
property
=
SystemPropertyUtils
.
getProperty
(
propertyKey
);
...
...
spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java
View file @
d58f38f6
...
...
@@ -184,11 +184,11 @@ public abstract class SystemPropertyUtils {
}
if
(
propVal
==
null
)
{
// Try with underscores.
propVal
=
System
.
getenv
(
key
.
replace
(
"."
,
"_"
));
propVal
=
System
.
getenv
(
key
.
replace
(
'.'
,
'_'
));
}
if
(
propVal
==
null
)
{
// Try uppercase with underscores as well.
propVal
=
System
.
getenv
(
key
.
toUpperCase
().
replace
(
"."
,
"_"
));
propVal
=
System
.
getenv
(
key
.
toUpperCase
().
replace
(
'.'
,
'_'
));
}
if
(
propVal
!=
null
)
{
return
propVal
;
...
...
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedConversionService.java
View file @
d58f38f6
...
...
@@ -127,7 +127,7 @@ class RelaxedConversionService implements ConversionService {
source
=
source
.
trim
();
for
(
T
candidate
:
(
Set
<
T
>)
EnumSet
.
allOf
(
this
.
enumType
))
{
RelaxedNames
names
=
new
RelaxedNames
(
candidate
.
name
().
replace
(
"_"
,
"-"
).
toLowerCase
());
candidate
.
name
().
replace
(
'_'
,
'-'
).
toLowerCase
());
for
(
String
name
:
names
)
{
if
(
name
.
equals
(
source
))
{
return
candidate
;
...
...
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java
View file @
d58f38f6
...
...
@@ -127,7 +127,7 @@ public final class RelaxedNames implements Iterable<String> {
@Override
public
String
apply
(
String
value
)
{
return
value
.
indexOf
(
'-'
)
!=
-
1
?
value
.
replace
(
"-"
,
"_"
)
:
value
;
return
value
.
indexOf
(
'-'
)
!=
-
1
?
value
.
replace
(
'-'
,
'_'
)
:
value
;
}
},
...
...
@@ -136,7 +136,7 @@ public final class RelaxedNames implements Iterable<String> {
@Override
public
String
apply
(
String
value
)
{
return
value
.
indexOf
(
'_'
)
!=
-
1
?
value
.
replace
(
"_"
,
"."
)
:
value
;
return
value
.
indexOf
(
'_'
)
!=
-
1
?
value
.
replace
(
'_'
,
'.'
)
:
value
;
}
},
...
...
@@ -145,7 +145,7 @@ public final class RelaxedNames implements Iterable<String> {
@Override
public
String
apply
(
String
value
)
{
return
value
.
indexOf
(
'.'
)
!=
-
1
?
value
.
replace
(
"."
,
"_"
)
:
value
;
return
value
.
indexOf
(
'.'
)
!=
-
1
?
value
.
replace
(
'.'
,
'_'
)
:
value
;
}
},
...
...
spring-boot/src/main/java/org/springframework/boot/logging/AbstractLoggingSystem.java
View file @
d58f38f6
...
...
@@ -172,7 +172,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
protected
final
String
getPackagedConfigFile
(
String
fileName
)
{
String
defaultPath
=
ClassUtils
.
getPackageName
(
getClass
());
defaultPath
=
defaultPath
.
replace
(
"."
,
"/"
);
defaultPath
=
defaultPath
.
replace
(
'.'
,
'/'
);
defaultPath
=
defaultPath
+
"/"
+
fileName
;
defaultPath
=
"classpath:"
+
defaultPath
;
return
defaultPath
;
...
...
spring-boot/src/test/java/org/springframework/boot/context/embedded/XmlEmbeddedWebApplicationContextTests.java
View file @
d58f38f6
...
...
@@ -32,7 +32,7 @@ import static org.mockito.Mockito.verify;
public
class
XmlEmbeddedWebApplicationContextTests
{
private
static
final
String
PATH
=
XmlEmbeddedWebApplicationContextTests
.
class
.
getPackage
().
getName
().
replace
(
"."
,
"/"
)
+
"/"
;
.
getPackage
().
getName
().
replace
(
'.'
,
'/'
)
+
"/"
;
private
static
final
String
FILE
=
"exampleEmbeddedWebApplicationConfiguration.xml"
;
...
...
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