Merge branch '1.5.x'
This commit is contained in:
commit
ef9fb1696c
|
@ -124,6 +124,7 @@ public class BasicJsonParser implements JsonParser {
|
|||
int index = 0;
|
||||
int inObject = 0;
|
||||
int inList = 0;
|
||||
boolean inValue = false;
|
||||
StringBuilder build = new StringBuilder();
|
||||
while (index < json.length()) {
|
||||
char current = json.charAt(index);
|
||||
|
@ -139,7 +140,10 @@ public class BasicJsonParser implements JsonParser {
|
|||
if (current == ']') {
|
||||
inList--;
|
||||
}
|
||||
if (current == ',' && inObject == 0 && inList == 0) {
|
||||
if (current == '"') {
|
||||
inValue = !inValue;
|
||||
}
|
||||
if (current == ',' && inObject == 0 && inList == 0 && !inValue) {
|
||||
list.add(build.toString());
|
||||
build.setLength(0);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*
|
||||
* @author Dave Syer
|
||||
* @author Jean de Klerk
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public abstract class AbstractJsonParserTests {
|
||||
|
||||
|
@ -63,6 +64,13 @@ public abstract class AbstractJsonParserTests {
|
|||
assertThat(map.get("foo")).isEqualTo("123");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringContainingComma() {
|
||||
Map<String, Object> map = this.parser.parseMap("{\"foo\":\"bar1,bar2\"}");
|
||||
assertThat(map).hasSize(1);
|
||||
assertThat(map.get("foo")).isEqualTo("bar1,bar2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyMap() {
|
||||
Map<String, Object> map = this.parser.parseMap("{}");
|
||||
|
|
Loading…
Reference in New Issue