@@ -1133,6 +1133,25 @@ public JsonMappingException mappingException(String msgTemplate, Object... args)
1133
1133
/**********************************************************
1134
1134
*/
1135
1135
1136
+ /**
1137
+ * Helper method for constructing {@link JsonMappingException} to indicated
1138
+ * that the token encountered was of type different than what <b>should</b>
1139
+ * be seen at that position, usually within a sequence of expected tokens.
1140
+ * Note that most of the time this method should NOT be directly called;
1141
+ * instead, {@link #reportWrongTokenException} should be called and will
1142
+ * call this method as necessary.
1143
+ */
1144
+ public JsonMappingException wrongTokenException (JsonParser p , JsonToken expToken ,
1145
+ String msg0 )
1146
+ {
1147
+ String msg = String .format ("Unexpected token (%s), expected %s" ,
1148
+ p .getCurrentToken (), expToken );
1149
+ if (msg0 != null ) {
1150
+ msg = msg + ": " +msg0 ;
1151
+ }
1152
+ return JsonMappingException .from (p , msg );
1153
+ }
1154
+
1136
1155
/**
1137
1156
* Helper method for constructing exception to indicate that given JSON
1138
1157
* Object field name was not in format to be able to deserialize specified
@@ -1234,22 +1253,6 @@ public JsonMappingException instantiationException(Class<?> instClass, String ms
1234
1253
instClass .getName (), msg ));
1235
1254
}
1236
1255
1237
- /**
1238
- * Helper method for indicating that the current token was expected to be another
1239
- * token.
1240
- *
1241
- * @deprecated Since 2.8 use {@link #reportWrongTokenException} instead
1242
- */
1243
- @ Deprecated
1244
- public JsonMappingException wrongTokenException (JsonParser p , JsonToken expToken , String msg0 ) {
1245
- String msg = String .format ("Unexpected token (%s), expected %s" ,
1246
- p .getCurrentToken (), expToken );
1247
- if (msg0 != null ) {
1248
- msg = msg + ": " +msg0 ;
1249
- }
1250
- return JsonMappingException .from (p , msg );
1251
- }
1252
-
1253
1256
/**
1254
1257
* @since 2.5
1255
1258
*
0 commit comments