@@ -685,11 +685,8 @@ public JsonMappingException mappingException(Class<?> targetClass) {
685
685
return mappingException (targetClass , _parser .getCurrentToken ());
686
686
}
687
687
688
- public JsonMappingException mappingException (Class <?> targetClass , JsonToken token )
689
- {
690
- String clsName = _calcName (targetClass );
691
- return JsonMappingException .from (_parser ,
692
- "Can not deserialize instance of " +clsName +" out of " +token +" token" );
688
+ public JsonMappingException mappingException (Class <?> targetClass , JsonToken token ) {
689
+ return JsonMappingException .from (_parser , "Can not deserialize instance of " +_calcName (targetClass )+" out of " +token +" token" );
693
690
}
694
691
695
692
/**
@@ -705,11 +702,9 @@ public JsonMappingException mappingException(String message) {
705
702
* to indicate problem with physically constructing instance of
706
703
* specified class (missing constructor, exception from constructor)
707
704
*/
708
- public JsonMappingException instantiationException (Class <?> instClass , Throwable t )
709
- {
705
+ public JsonMappingException instantiationException (Class <?> instClass , Throwable t ) {
710
706
return JsonMappingException .from (_parser ,
711
- "Can not construct instance of " +instClass .getName ()+", problem: " +t .getMessage (),
712
- t );
707
+ "Can not construct instance of " +instClass .getName ()+", problem: " +t .getMessage (), t );
713
708
}
714
709
715
710
public JsonMappingException instantiationException (Class <?> instClass , String msg ) {
@@ -768,8 +763,7 @@ public JsonMappingException weirdNumberException(Number value, Class<?> instClas
768
763
* Object field name was not in format to be able to deserialize specified
769
764
* key type.
770
765
*/
771
- public JsonMappingException weirdKeyException (Class <?> keyClass , String keyValue , String msg )
772
- {
766
+ public JsonMappingException weirdKeyException (Class <?> keyClass , String keyValue , String msg ) {
773
767
return InvalidFormatException .from (_parser ,
774
768
"Can not construct Map key of type " +keyClass .getName ()+" from String \" " +_desc (keyValue )+"\" : " +msg ,
775
769
keyValue , keyClass );
@@ -779,22 +773,19 @@ public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue
779
773
* Helper method for indicating that the current token was expected to be another
780
774
* token.
781
775
*/
782
- public JsonMappingException wrongTokenException (JsonParser jp , JsonToken expToken , String msg )
783
- {
776
+ public JsonMappingException wrongTokenException (JsonParser jp , JsonToken expToken , String msg ) {
784
777
return JsonMappingException .from (jp , "Unexpected token (" +jp .getCurrentToken ()+"), expected " +expToken +": " +msg );
785
778
}
786
779
787
780
/**
788
781
* Helper method for constructing exception to indicate that given
789
782
* type id (parsed from JSON) could not be converted to a Java type.
790
783
*/
791
- public JsonMappingException unknownTypeException (JavaType type , String id )
792
- {
784
+ public JsonMappingException unknownTypeException (JavaType type , String id ) {
793
785
return JsonMappingException .from (_parser , "Could not resolve type id '" +id +"' into a subtype of " +type );
794
786
}
795
787
796
- public JsonMappingException endOfInputException (Class <?> instClass )
797
- {
788
+ public JsonMappingException endOfInputException (Class <?> instClass ) {
798
789
return JsonMappingException .from (_parser , "Unexpected end-of-input when trying to deserialize a "
799
790
+instClass .getName ());
800
791
}
@@ -820,8 +811,7 @@ protected DateFormat getDateFormat()
820
811
return df ;
821
812
}
822
813
823
- protected String determineClassName (Object instance )
824
- {
814
+ protected String determineClassName (Object instance ) {
825
815
return ClassUtil .getClassDescription (instance );
826
816
}
827
817
@@ -831,24 +821,22 @@ protected String determineClassName(Object instance)
831
821
/**********************************************************
832
822
*/
833
823
834
- protected String _calcName (Class <?> cls )
835
- {
824
+ protected String _calcName (Class <?> cls ) {
836
825
if (cls .isArray ()) {
837
826
return _calcName (cls .getComponentType ())+"[]" ;
838
827
}
839
828
return cls .getName ();
840
829
}
841
830
842
- protected String _valueDesc ()
843
- {
831
+ protected String _valueDesc () {
844
832
try {
845
833
return _desc (_parser .getText ());
846
834
} catch (Exception e ) {
847
835
return "[N/A]" ;
848
836
}
849
837
}
850
- protected String _desc ( String desc )
851
- {
838
+
839
+ protected String _desc ( String desc ) {
852
840
// !!! should we quote it? (in case there are control chars, linefeeds)
853
841
if (desc .length () > MAX_ERROR_STR_LEN ) {
854
842
desc = desc .substring (0 , MAX_ERROR_STR_LEN ) + "]...[" + desc .substring (desc .length () - MAX_ERROR_STR_LEN );
0 commit comments