3
3
import java .io .IOException ;
4
4
5
5
import com .fasterxml .jackson .annotation .JsonTypeInfo .As ;
6
+
6
7
import com .fasterxml .jackson .core .JsonParser ;
7
8
import com .fasterxml .jackson .core .JsonToken ;
8
9
import com .fasterxml .jackson .core .util .JsonParserSequence ;
9
- import com .fasterxml .jackson .databind .BeanProperty ;
10
- import com .fasterxml .jackson .databind .DeserializationContext ;
11
- import com .fasterxml .jackson .databind .DeserializationFeature ;
12
- import com .fasterxml .jackson .databind .JavaType ;
13
- import com .fasterxml .jackson .databind .JsonDeserializer ;
14
- import com .fasterxml .jackson .databind .MapperFeature ;
10
+
11
+ import com .fasterxml .jackson .databind .*;
15
12
import com .fasterxml .jackson .databind .jsontype .TypeDeserializer ;
16
13
import com .fasterxml .jackson .databind .jsontype .TypeIdResolver ;
17
14
import com .fasterxml .jackson .databind .util .TokenBuffer ;
@@ -31,9 +28,10 @@ public class AsPropertyTypeDeserializer extends AsArrayTypeDeserializer
31
28
32
29
protected final As _inclusion ;
33
30
34
- protected final String msgMissingId = _property == null ?
35
- String .format ("missing type id property '%s'" , _typePropertyName ) :
36
- String .format ("missing type id property '%s' (for POJO property '%s')" , _typePropertyName , _property .getName ());
31
+ // @since 2.12.2 (see [databind#3055]
32
+ protected final String _msgForMissingId = (_property == null )
33
+ ? String .format ("missing type id property '%s'" , _typePropertyName )
34
+ : String .format ("missing type id property '%s' (for POJO property '%s')" , _typePropertyName , _property .getName ());
37
35
38
36
/**
39
37
* @since 2.8
@@ -95,7 +93,7 @@ public Object deserializeTypedFromObject(JsonParser p, DeserializationContext ct
95
93
* But this can also be due to some custom handling: so, if "defaultImpl"
96
94
* is defined, it will be asked to handle this case.
97
95
*/
98
- return _deserializeTypedUsingDefaultImpl (p , ctxt , null , msgMissingId );
96
+ return _deserializeTypedUsingDefaultImpl (p , ctxt , null , _msgForMissingId );
99
97
}
100
98
// Ok, let's try to find the property. But first, need token buffer...
101
99
TokenBuffer tb = null ;
@@ -114,7 +112,7 @@ public Object deserializeTypedFromObject(JsonParser p, DeserializationContext ct
114
112
tb .writeFieldName (name );
115
113
tb .copyCurrentStructure (p );
116
114
}
117
- return _deserializeTypedUsingDefaultImpl (p , ctxt , tb , msgMissingId );
115
+ return _deserializeTypedUsingDefaultImpl (p , ctxt , tb , _msgForMissingId );
118
116
}
119
117
120
118
protected Object _deserializeTypedForId (JsonParser p , DeserializationContext ctxt ,
@@ -139,9 +137,17 @@ protected Object _deserializeTypedForId(JsonParser p, DeserializationContext ctx
139
137
return deser .deserialize (p , ctxt );
140
138
}
141
139
140
+ @ Deprecated // since 2.12.2 (remove from 2.14 or later)
141
+ protected Object _deserializeTypedUsingDefaultImpl (JsonParser p ,
142
+ DeserializationContext ctxt , TokenBuffer tb ) throws IOException {
143
+ return _deserializeTypedUsingDefaultImpl (p , ctxt , tb , null );
144
+ }
145
+
142
146
// off-lined to keep main method lean and mean...
147
+ // @since 2.12.2 (last arg added)
143
148
protected Object _deserializeTypedUsingDefaultImpl (JsonParser p ,
144
- DeserializationContext ctxt , TokenBuffer tb , String priorFailureMsg ) throws IOException
149
+ DeserializationContext ctxt , TokenBuffer tb , String priorFailureMsg )
150
+ throws IOException
145
151
{
146
152
// May have default implementation to use
147
153
// 13-Oct-2020, tatu: As per [databind#2775], need to be careful to
0 commit comments