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
c97a9a0c
Commit
c97a9a0c
authored
Feb 12, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.5.x'
parents
2be0c465
2f6d05dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
BasicJsonParser.java
...n/java/org/springframework/boot/json/BasicJsonParser.java
+3
-7
AbstractJsonParserTests.java
...rg/springframework/boot/json/AbstractJsonParserTests.java
+8
-1
No files found.
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/json/BasicJsonParser.java
View file @
c97a9a0c
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
*
* @author Dave Syer
* @author Jean de Klerk
* @author Stephane Nicoll
* @since 1.2.0
* @see JsonParserFactory
*/
...
...
@@ -112,12 +113,7 @@ public class BasicJsonParser implements JsonParser {
for
(
String
pair
:
tokenize
(
json
))
{
String
[]
values
=
StringUtils
.
trimArrayElements
(
StringUtils
.
split
(
pair
,
":"
));
String
key
=
trimLeadingCharacter
(
trimTrailingCharacter
(
values
[
0
],
'"'
),
'"'
);
Object
value
=
null
;
if
(
values
.
length
>
0
)
{
String
string
=
trimLeadingCharacter
(
trimTrailingCharacter
(
values
[
1
],
'"'
),
'"'
);
value
=
parseInternal
(
string
);
}
Object
value
=
parseInternal
(
values
[
1
]);
map
.
put
(
key
,
value
);
}
return
map
;
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/json/AbstractJsonParserTests.java
View file @
c97a9a0c
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
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.
...
...
@@ -56,6 +56,13 @@ public abstract class AbstractJsonParserTests {
assertThat
(
map
.
get
(
"spam"
)).
isEqualTo
(
1.23d
);
}
@Test
public
void
stringContainingNumber
()
{
Map
<
String
,
Object
>
map
=
this
.
parser
.
parseMap
(
"{\"foo\":\"123\"}"
);
assertThat
(
map
).
hasSize
(
1
);
assertThat
(
map
.
get
(
"foo"
)).
isEqualTo
(
"123"
);
}
@Test
public
void
emptyMap
()
{
Map
<
String
,
Object
>
map
=
this
.
parser
.
parseMap
(
"{}"
);
...
...
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