Skip to content

Commit

Permalink
Implement FasterXML#3177
Browse files Browse the repository at this point in the history
Addressing review comment.
Small refactoring in order to reduce code duplication.
  • Loading branch information
klaasdellschaft committed Jun 28, 2021
1 parent 66c239f commit 021000f
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,14 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
if (isMessage) {
if (hasStringCreator) {
throwable = _valueInstantiator.createFromString(ctxt, p.getValueAsString());
// any pending values?
if (pending != null) {
for (int i = 0, len = pendingIx; i < len; i += 2) {
prop = (SettableBeanProperty)pending[i];
prop.set(throwable, pending[i+1]);
}
pending = null;
}
continue;
}
}

// Maybe it's "suppressed"?
final boolean isSuppressed = PROP_NAME_SUPPRESSED.equals(propName);
if (isSuppressed) {
suppressed = p.readValueAs(Throwable[].class);
suppressed = ctxt.readValue(p, Throwable[].class);
continue;
}

Expand Down Expand Up @@ -158,15 +150,17 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
} else {
throwable = _valueInstantiator.createUsingDefault(ctxt);
}
// any pending values?
if (pending != null) {
for (int i = 0, len = pendingIx; i < len; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty)pending[i];
prop.set(throwable, pending[i+1]);
}
}

// any pending values?
if (pending != null) {
for (int i = 0, len = pendingIx; i < len; i += 2) {
SettableBeanProperty prop = (SettableBeanProperty)pending[i];
prop.set(throwable, pending[i+1]);
}
}

// any suppressed exceptions?
if (suppressed != null && throwable instanceof Throwable) {
Throwable t = (Throwable) throwable;
for (Throwable s : suppressed) {
Expand Down

0 comments on commit 021000f

Please sign in to comment.