Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Conflicts:
#	release-notes/VERSION-2.x
#	src/test/java/com/fasterxml/jackson/dataformat/xml/failing/ListDeser319Test.java
  • Loading branch information
cowtowncoder authored and alex-bel-apica committed Sep 4, 2020
1 parent 492ba5c commit 5943277
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 37 deletions.
Expand Up @@ -628,7 +628,14 @@ public JsonToken nextToken() throws IOException
token = _nextToken();
continue;
}
} else if (_parsingContext.inArray()) {
// [dataformat-xml#319] Aaaaand for Arrays too
if (XmlTokenStream._allWs(_currText)) {
token = _nextToken();
continue;
}
}

// If not a leaf (or otherwise ignorable), need to transform into property...
_parsingContext.setCurrentName(_cfgNameForTextElement);
_nextToken = JsonToken.VALUE_STRING;
Expand Down
Expand Up @@ -56,7 +56,7 @@ public void testDeser314Order1() throws Exception
Customer314 result = MAPPER.readValue(content, Customer314.class);
assertNotNull(result);
}

/*
public void testDeser314Order2() throws Exception
{
String content = ""
Expand All @@ -81,5 +81,5 @@ public void testDeser314Address() throws Exception
;
Address314 result = MAPPER.readValue(content, Address314.class);
assertNotNull(result);
}
}*/
}

This file was deleted.

Expand Up @@ -2,12 +2,13 @@

import java.util.List;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.dataformat.xml.*;
import com.fasterxml.jackson.dataformat.xml.annotation.*;

// for [dataformat-xml#177]
public class EmptyListDeserTest extends XmlTestBase
{
// [dataformat-xml#177]
static class Config
{
@JacksonXmlProperty(isAttribute=true)
Expand All @@ -23,14 +24,20 @@ static class Entry
public String id;
}

// [dataformat-xml#319]
static class Value319 {
public Long orderId, orderTypeId;
}

/*
/**********************************************************
/* Test methods
/**********************************************************
*/

private final XmlMapper MAPPER = new XmlMapper();


// [dataformat-xml#177]
public void testEmptyList() throws Exception
{
Config r = MAPPER.readValue(
Expand All @@ -44,4 +51,18 @@ public void testEmptyList() throws Exception
assertEquals(1, r.entry.size());
assertEquals("foo", r.entry.get(0).id);
}

// [dataformat-xml#319]
public void testEmptyList319() throws Exception
{
final String DOC = "<orders></orders>";

List<Value319> list = MAPPER.readValue(DOC, new TypeReference<List<Value319>>() { });
assertNotNull(list);
assertEquals(0, list.size());

Value319[] array = MAPPER.readValue(DOC, Value319[].class);
assertNotNull(array);
assertEquals(0, array.length);
}
}

0 comments on commit 5943277

Please sign in to comment.