All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.jackson.map.deser.BasicDeserializerFactory.rej Maven / Gradle / Ivy

Go to download

Data Mapper package is a high-performance data binding package built on Jackson JSON processor

There is a newer version: 1.9.13
Show newest version
***************
*** 659,674 ****
      {
          Object deserDef = config.getAnnotationIntrospector().findDeserializer(ann);
          if (deserDef != null) {
-             return _constructDeserializer(config, ann, deserDef);
          }
          return null;
      }
      
      @SuppressWarnings("unchecked")
-     JsonDeserializer _constructDeserializer(DeserializationConfig config, Annotated ann, Object deserDef)
      {
          if (deserDef instanceof JsonDeserializer) {
-             return (JsonDeserializer) deserDef;
          }
          /* Alas, there's no way to force return type of "either class
           * X or Y" -- need to throw an exception after the fact
--- 659,685 ----
      {
          Object deserDef = config.getAnnotationIntrospector().findDeserializer(ann);
          if (deserDef != null) {
+             try {
+                 return _constructDeserializer(config, ann, property, deserDef);
+             } catch (JsonMappingException e) {
+                 throw new RuntimeJsonMappingException(e);
+             }
          }
          return null;
      }
      
      @SuppressWarnings("unchecked")
+     JsonDeserializer _constructDeserializer(DeserializationConfig config, Annotated ann, BeanProperty property,
+             Object deserDef)
+         throws JsonMappingException
      {
          if (deserDef instanceof JsonDeserializer) {
+             JsonDeserializer deser = (JsonDeserializer) deserDef;
+             // related to [JACKSON-569], need contextualization:
+             if (deser instanceof ContextualDeserializer) {
+                 deser = (JsonDeserializer)((ContextualDeserializer) deser).createContextual(config, property);
+             }
+             return deser;
          }
          /* Alas, there's no way to force return type of "either class
           * X or Y" -- need to throw an exception after the fact
***************
*** 680,686 ****
          if (!JsonDeserializer.class.isAssignableFrom(deserClass)) {
              throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName()+"; expected Class");
          }
-         return config.deserializerInstance(ann, deserClass);
      }
  
      /**
--- 691,702 ----
          if (!JsonDeserializer.class.isAssignableFrom(deserClass)) {
              throw new IllegalStateException("AnnotationIntrospector returned Class "+deserClass.getName()+"; expected Class");
          }
+         JsonDeserializer deser = config.deserializerInstance(ann, deserClass);
+         // related to [JACKSON-569], need contextualization:
+         if (deser instanceof ContextualDeserializer) {
+             deser = (JsonDeserializer)((ContextualDeserializer) deser).createContextual(config, property);
+         }
+         return deser;
      }
  
      /**