Skip to content

Commit

Permalink
trivial simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 10, 2014
1 parent 2ef09f8 commit e78d39d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,14 @@ protected Object deserializeWithExternalTypeId(JsonParser p, DeserializationCont
{
final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null;
final ExternalTypeHandler ext = _externalTypeIdHandler.start();
JsonToken t = p.getCurrentToken();
for (; t == JsonToken.FIELD_NAME; t = p.nextToken()) {

for (JsonToken t = p.getCurrentToken(); t == JsonToken.FIELD_NAME; t = p.nextToken()) {
String propName = p.getCurrentName();
p.nextToken();
t = p.nextToken();
SettableBeanProperty prop = _beanProperties.find(propName);
if (prop != null) { // normal case
// [JACKSON-831]: may have property AND be used as external type id:
if (p.getCurrentToken().isScalarValue()) {
if (t.isScalarValue()) {
ext.handleTypePropertyValue(p, ctxt, propName, bean);
}
if (activeView != null && !prop.visibleInView(activeView)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public JSOGRef(int val) {
*/
@JsonIdentityInfo(generator=JSOGGenerator.class)
public static class IdentifiableExampleJSOG {
public int foo;
public IdentifiableExampleJSOG next;
public int foo;
public IdentifiableExampleJSOG next;
}

/*
Expand All @@ -126,14 +126,13 @@ public static class IdentifiableExampleJSOG {

// for [databind#622]
public void testStructJSOGRef() throws Exception {

// Because the value ({@ref:1}) is not scalar, parser thinks it is not an id
// and tries to deserialize as normal a new IdentifiableExampleJSOG
// then complains about unrecognized field "@ref"
IdentifiableExampleJSOG result = mapper.readValue(EXP_EXAMPLE_JSOG,
IdentifiableExampleJSOG.class);

assertEquals(66, result.foo);
assertSame(result, result.next);
// Because the value ({@ref:1}) is not scalar, parser thinks it is not an id
// and tries to deserialize as normal a new IdentifiableExampleJSOG
// then complains about unrecognized field "@ref"
IdentifiableExampleJSOG result = mapper.readValue(EXP_EXAMPLE_JSOG,
IdentifiableExampleJSOG.class);

assertEquals(66, result.foo);
assertSame(result, result.next);
}
}

0 comments on commit e78d39d

Please sign in to comment.