-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Description
/*copied from FasterXML/jackson-databind#2163 */
Hello,
I have a strange problem with jackson-dataformat 2.9.* (with 2.8.* everything work good):
Data class: (Lombok -- modify for test)
@Data
public class PackInstanceOrder {
private Long orderId;
private Long orderTypeId;
}
Simple test (Kotlin?):
@Test
fun test() {
val XML_OBJECT_MAPPER = XmlMapper()
val xml = "<orders></orders>"Labels
val orders: List<PackInstanceOrder> = XML_OBJECT_MAPPER.readValue(xml,
XML_OBJECT_MAPPER.getTypeFactory().constructCollectionType(List::class.java, PackInstanceOrder::class.java))
assertThat(orders, notNullValue())
}
throw an error:
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "" (class PackInstanceOrder), not marked as ignorable (2 known properties: "orderId", "orderTypeId"])
at [Source: (StringReader); line: 1, column: 18] (through reference chain: java.util.ArrayList[0]->PackInstanceOrder[""])
When adding @JsonIgnoreProperties(ignoreUnknown = true) annotation to PackInstanceOrder, error was changed:
com.fasterxml.jackson.databind.exc.MismatchedInputException: Unexpected end-of-input when binding data into PackInstanceOrder
at [Source: (StringReader); line: 1, column: 18] (through reference chain: java.util.ArrayList[1])
BUT! When I change xml to
<orders/>
test didn't throw any errors and pass well.
Metadata
Metadata
Assignees
Labels
No labels