Skip to content

Commit f6fbed5

Browse files
committed
Backport #1288 fix
1 parent 261ea42 commit f6fbed5

File tree

3 files changed

+529
-2
lines changed

3 files changed

+529
-2
lines changed

release-notes/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Project: jackson-databind
99
#1215: Problem with type specialization for Maps with `@JsonDeserialize(as=subtype)`
1010
(reported by brentryan@github)
1111
#1279: Ensure DOM parsing defaults to not expanding external entities
12+
#1288: Type id not exposed for `JsonTypeInfo.As.EXTERNAL_PROPERTY` even when `visible` set to `true`
1213

1314
2.7.5 (11-Jun-2016)
1415

src/main/java/com/fasterxml/jackson/databind/deser/BuilderBasedDeserializer.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,16 @@ protected Object deserializeWithExternalTypeId(JsonParser p,
652652
{
653653
final Class<?> activeView = _needViewProcesing ? ctxt.getActiveView() : null;
654654
final ExternalTypeHandler ext = _externalTypeIdHandler.start();
655-
for (; p.getCurrentToken() != JsonToken.END_OBJECT; p.nextToken()) {
655+
656+
for (JsonToken t = p.getCurrentToken(); t == JsonToken.FIELD_NAME; t = p.nextToken()) {
656657
String propName = p.getCurrentName();
657-
p.nextToken();
658+
t = p.nextToken();
658659
SettableBeanProperty prop = _beanProperties.find(propName);
659660
if (prop != null) { // normal case
661+
// [JACKSON-831]: may have property AND be used as external type id:
662+
if (t.isScalarValue()) {
663+
ext.handleTypePropertyValue(p, ctxt, propName, bean);
664+
}
660665
if (activeView != null && !prop.visibleInView(activeView)) {
661666
p.skipChildren();
662667
continue;

0 commit comments

Comments
 (0)