Skip to content

Commit

Permalink
Fixed #844
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 1, 2015
1 parent 9317e54 commit 726b6e0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ Steve Sanbeg: (sanbeg@github)
Ian Barfield: (tea-dragon@github)
* Reported #580: delegate deserializers choke on a (single) abstract/polymorphic parameter
(2.4.4)
* Reported #844: Using JsonCreator still causes invalid path references in JsonMappingException
(2.5.5)

Eugene Lukash
* Reported #592: Wrong `TokenBuffer` delegate deserialization using `@JsonCreator`
Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Project: jackson-databind

2.5.5 (not released)

#844: Using JsonCreator still causes invalid path references in JsonMappingException
(reported by Ian B)
#852: Accept scientific number notation for quoted numbers too

2.5.4 (09-Jun-2015)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
try {
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
wrapInstantiationProblem(e, ctxt);
bean = null; // never gets here
}
if (bean == null) {
Expand Down Expand Up @@ -413,7 +413,8 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
// regular property? needs buffering
SettableBeanProperty prop = _beanProperties.find(propName);
if (prop != null) {
buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
buffer.bufferProperty(prop,
deserializeWithErrorWrapping(prop, p, ctxt, propName));
continue;
}
// As per [JACKSON-313], things marked as ignorable should not be
Expand All @@ -424,7 +425,11 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
}
// "any property"?
if (_anySetter != null) {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
try {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
}
continue;
}
// Ok then, let's collect the whole field; name and value
Expand Down Expand Up @@ -454,11 +459,11 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
return bean;
}

protected Object deserializeWithErrorWrapping(SettableBeanProperty creatorProp, JsonParser p, DeserializationContext ctxt,
String propName)
throws IOException {
protected Object deserializeWithErrorWrapping(SettableBeanProperty prop,
JsonParser p, DeserializationContext ctxt, String propName) throws IOException
{
try {
return creatorProp.deserialize(p, ctxt);
return prop.deserialize(p, ctxt);
} catch (IOException e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
// exception below will be throw only if someone overwrite default implementation of wrapAndThrow method
Expand Down Expand Up @@ -639,7 +644,7 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
try {
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
wrapInstantiationProblem(e, ctxt);
continue; // never gets here
}
// [databind#631]: Assign current value, to be accessible by custom serializers
Expand Down Expand Up @@ -668,9 +673,11 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
// regular property? needs buffering
SettableBeanProperty prop = _beanProperties.find(propName);
if (prop != null) {
buffer.bufferProperty(prop, prop.deserialize(p, ctxt));
buffer.bufferProperty(prop,
deserializeWithErrorWrapping(prop, p, ctxt, propName));
continue;
}

/* As per [JACKSON-313], things marked as ignorable should not be
* passed to any setter
*/
Expand All @@ -682,14 +689,18 @@ protected Object deserializeUsingPropertyBasedWithUnwrapped(JsonParser p, Deseri
tokens.copyCurrentStructure(p);
// "any property"?
if (_anySetter != null) {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
try {
buffer.bufferAnyProperty(_anySetter, propName, _anySetter.deserialize(p, ctxt));
} catch (Exception e) {
wrapAndThrow(e, _beanType.getRawClass(), propName, ctxt);
}
}
}

// We hit END_OBJECT, so:
Object bean;
try {
bean = creator.build(ctxt, buffer);
bean = creator.build(ctxt, buffer);
} catch (Exception e) {
wrapInstantiationProblem(e, ctxt);
return null; // never gets here
Expand Down

0 comments on commit 726b6e0

Please sign in to comment.