Skip to content

Commit

Permalink
Fixed (#1879)
Browse files Browse the repository at this point in the history
  • Loading branch information
reda-alaoui authored and cowtowncoder committed Jan 17, 2018
1 parent 2da6113 commit 8cfe3ee
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void addBackReferenceProperty(String referenceName, SettableBeanProperty
_backRefProperties.put(referenceName, prop);
// also: if we had property with same name, actually remove it
if (_properties != null) {
_properties.remove(prop.getName());
_properties.remove(referenceName);
}
// ??? 23-Jul-2012, tatu: Should it be included in list of all properties?
// For now, won't add, since it is inferred, not explicit...
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.fasterxml.jackson.failing;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.databind.BaseMapTest;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
* Created on 09/01/18.
*
* @author Reda.Housni-Alaoui
*/
public class BackReference1878Test extends BaseMapTest {

static class Child {
@JsonBackReference
public Parent b;
}

static class Parent {
@JsonManagedReference
public Child a;
}

private final ObjectMapper MAPPER = new ObjectMapper();

public void testChildDeserialization() throws Exception {
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Child child = MAPPER.readValue("{\"b\": {}}", Child.class);
assertNotNull(child.b);
}

}

0 comments on commit 8cfe3ee

Please sign in to comment.