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
1ddcf365
Commit
1ddcf365
authored
Aug 27, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be defensive about resolving properties in PropertySourcesPropertyValues
parent
37aa5326
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
PropertySourcesPropertyValues.java
...ingframework/boot/bind/PropertySourcesPropertyValues.java
+7
-1
PropertySourcesPropertyValuesTests.java
...amework/boot/bind/PropertySourcesPropertyValuesTests.java
+15
-0
No files found.
spring-boot/src/main/java/org/springframework/boot/bind/PropertySourcesPropertyValues.java
View file @
1ddcf365
...
...
@@ -152,7 +152,13 @@ public class PropertySourcesPropertyValues implements PropertyValues {
private
void
processDefaultPropertySource
(
PropertySource
<?>
source
,
PropertySourcesPropertyResolver
resolver
,
String
[]
includes
,
String
[]
exacts
)
{
for
(
String
propertyName
:
exacts
)
{
Object
value
=
resolver
.
getProperty
(
propertyName
);
Object
value
=
null
;
try
{
value
=
resolver
.
getProperty
(
propertyName
,
Object
.
class
);
}
catch
(
RuntimeException
ex
)
{
// Probably could not convert to Object, weird, but ignoreable
}
if
(
value
==
null
)
{
value
=
source
.
getProperty
(
propertyName
.
toUpperCase
());
}
...
...
spring-boot/src/test/java/org/springframework/boot/bind/PropertySourcesPropertyValuesTests.java
View file @
1ddcf365
...
...
@@ -138,6 +138,21 @@ public class PropertySourcesPropertyValuesTests {
assertEquals
(
"bar"
,
target
.
getName
());
}
@Test
public
void
testPlaceholdersErrorInNonEnumerable
()
{
TestBean
target
=
new
TestBean
();
DataBinder
binder
=
new
DataBinder
(
target
);
this
.
propertySources
.
addFirst
(
new
PropertySource
<
Object
>(
"application"
,
"STUFF"
)
{
@Override
public
Object
getProperty
(
String
name
)
{
return
new
Object
();
}
});
binder
.
bind
(
new
PropertySourcesPropertyValues
(
this
.
propertySources
,
null
,
Collections
.
singleton
(
"name"
)));
assertEquals
(
null
,
target
.
getName
());
}
public
static
class
TestBean
{
private
String
name
;
...
...
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