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
bd2a2521
Commit
bd2a2521
authored
Sep 21, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish 'Add origin support for empty YAML list and map'
See gh-21704
parent
f18d564a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
OriginTrackedYamlLoader.java
...org/springframework/boot/env/OriginTrackedYamlLoader.java
+4
-4
OriginTrackedYamlLoaderTests.java
...pringframework/boot/env/OriginTrackedYamlLoaderTests.java
+2
-2
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedYamlLoader.java
View file @
bd2a2521
...
@@ -105,15 +105,15 @@ class OriginTrackedYamlLoader extends YamlProcessor {
...
@@ -105,15 +105,15 @@ class OriginTrackedYamlLoader extends YamlProcessor {
@Override
@Override
protected
Object
constructObject
(
Node
node
)
{
protected
Object
constructObject
(
Node
node
)
{
if
(
node
instanceof
CollectionNode
&&
((
CollectionNode
<?>)
node
).
getValue
().
isEmpty
())
{
return
constructTrackedObject
(
node
,
super
.
constructObject
(
node
));
}
if
(
node
instanceof
ScalarNode
)
{
if
(
node
instanceof
ScalarNode
)
{
if
(!(
node
instanceof
KeyScalarNode
))
{
if
(!(
node
instanceof
KeyScalarNode
))
{
return
constructTrackedObject
(
node
,
super
.
constructObject
(
node
));
return
constructTrackedObject
(
node
,
super
.
constructObject
(
node
));
}
}
}
}
else
if
(
node
instanceof
CollectionNode
&&
((
CollectionNode
<?>)
node
).
getValue
().
isEmpty
())
{
if
(
node
instanceof
MappingNode
)
{
return
constructTrackedObject
(
node
,
super
.
constructObject
(
node
));
}
else
if
(
node
instanceof
MappingNode
)
{
replaceMappingNodeKeys
((
MappingNode
)
node
);
replaceMappingNodeKeys
((
MappingNode
)
node
);
}
}
return
super
.
constructObject
(
node
);
return
super
.
constructObject
(
node
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedYamlLoaderTests.java
View file @
bd2a2521
...
@@ -125,8 +125,8 @@ class OriginTrackedYamlLoaderTests {
...
@@ -125,8 +125,8 @@ class OriginTrackedYamlLoaderTests {
void
processEmptyListAndMap
()
{
void
processEmptyListAndMap
()
{
OriginTrackedValue
emptymap
=
getValue
(
"emptymap"
);
OriginTrackedValue
emptymap
=
getValue
(
"emptymap"
);
OriginTrackedValue
emptylist
=
getValue
(
"emptylist"
);
OriginTrackedValue
emptylist
=
getValue
(
"emptylist"
);
assertThat
(
emptymap
.
getValue
()).
isEqualTo
(
Collections
.
EMPTY_MAP
);
assertThat
(
emptymap
.
getValue
()).
isEqualTo
(
Collections
.
emptyMap
()
);
assertThat
(
emptylist
.
getValue
()).
isEqualTo
(
Collections
.
EMPTY_LIST
);
assertThat
(
emptylist
.
getValue
()).
isEqualTo
(
Collections
.
emptyList
()
);
}
}
@Test
@Test
...
...
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