@@ -813,10 +813,6 @@ public <T> T readPropertyValue(JsonParser p, BeanProperty prop, JavaType type) t
813
813
* @return True if there was a configured problem handler that was able to handle the
814
814
* problem
815
815
*/
816
- /**
817
- * Method deserializers can call to inform configured {@link DeserializationProblemHandler}s
818
- * of an unrecognized property.
819
- */
820
816
public boolean handleUnknownProperty (JsonParser p , JsonDeserializer <?> deser ,
821
817
Object instanceOrClass , String propName )
822
818
throws IOException , JsonProcessingException
@@ -855,7 +851,109 @@ public void reportUnknownProperty(Object instanceOrClass, String fieldName,
855
851
throw UnrecognizedPropertyException .from (_parser ,
856
852
instanceOrClass , fieldName , propIds );
857
853
}
858
-
854
+
855
+ /**
856
+ * @since 2.8
857
+ */
858
+ public JsonMappingException reportMappingException (String msg , Object ... msgArgs )
859
+ throws JsonMappingException
860
+ {
861
+ if (msgArgs .length > 0 ) {
862
+ msg = String .format (msg , msgArgs );
863
+ }
864
+ throw mappingException (msg );
865
+ }
866
+
867
+ /**
868
+ * @since 2.8
869
+ */
870
+ public JsonMappingException reportInstantiationException (Class <?> instClass , Throwable t )
871
+ throws JsonMappingException
872
+ {
873
+ throw instantiationException (instClass , t );
874
+ }
875
+
876
+ /**
877
+ * @since 2.8
878
+ */
879
+ public JsonMappingException reportInstantiationException (Class <?> instClass ,
880
+ String msg , Object ... msgArgs )
881
+ throws JsonMappingException
882
+ {
883
+ if (msgArgs .length > 0 ) {
884
+ msg = String .format (msg , msgArgs );
885
+ }
886
+ throw instantiationException (instClass , msg );
887
+ }
888
+
889
+ /**
890
+ * @since 2.8
891
+ */
892
+ public <T > T reportWeirdStringException (String value , Class <?> instClass ,
893
+ String msg , Object ... msgArgs )
894
+ throws JsonMappingException
895
+ {
896
+ if (msgArgs .length > 0 ) {
897
+ msg = String .format (msg , msgArgs );
898
+ }
899
+ throw weirdStringException (value , instClass , msg );
900
+ }
901
+
902
+ /**
903
+ * @since 2.8
904
+ */
905
+ public <T > T reportWeirdNumberException (Number value , Class <?> instClass ,
906
+ String msg , Object ... msgArgs )
907
+ throws JsonMappingException
908
+ {
909
+ if (msgArgs .length > 0 ) {
910
+ msg = String .format (msg , msgArgs );
911
+ }
912
+ throw weirdNumberException (value , instClass , msg );
913
+ }
914
+
915
+ /**
916
+ * @since 2.8
917
+ */
918
+ public <T > T reportWeirdKeyException (Class <?> keyClass , String keyValue ,
919
+ String msg , Object ... msgArgs )
920
+ throws JsonMappingException
921
+ {
922
+ if (msgArgs .length > 0 ) {
923
+ msg = String .format (msg , msgArgs );
924
+ }
925
+ throw weirdKeyException (keyClass , keyValue , msg );
926
+ }
927
+
928
+ /**
929
+ * @since 2.8
930
+ */
931
+ public <T > T reportWrongTokenException (JsonParser p ,
932
+ JsonToken expToken , String msg , Object ... msgArgs )
933
+ throws JsonMappingException
934
+ {
935
+ if (msgArgs .length > 0 ) {
936
+ msg = String .format (msg , msgArgs );
937
+ }
938
+ throw wrongTokenException (p , expToken , msg );
939
+ }
940
+
941
+ /**
942
+ * @since 2.8
943
+ */
944
+ public <T > T reportUnknownTypeException (JavaType type , String id ,
945
+ String extraDesc ) throws JsonMappingException
946
+ {
947
+ throw unknownTypeException (type , id , extraDesc );
948
+ }
949
+
950
+ /**
951
+ * @since 2.8
952
+ */
953
+ public <T > T reportEndOfInputException (Class <?> instClass ) throws JsonMappingException {
954
+ throw endOfInputException (instClass );
955
+ }
956
+
859
957
/*
860
958
/**********************************************************
861
959
/* Methods for constructing exceptions
@@ -976,7 +1074,8 @@ public JsonMappingException unknownTypeException(JavaType type, String id) {
976
1074
*/
977
1075
public JsonMappingException unknownTypeException (JavaType type , String id ,
978
1076
String extraDesc ) {
979
- String msg = "Could not resolve type id '" +id +"' into a subtype of " +type ;
1077
+ String msg = String .format ("Could not resolve type id '%s' into a subtype of %s" ,
1078
+ id , type );
980
1079
if (extraDesc != null ) {
981
1080
msg = msg + ": " +extraDesc ;
982
1081
}
0 commit comments