Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 3, 2017
1 parent 2339988 commit 41e31e1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.impl.FailingDeserializer; import com.fasterxml.jackson.databind.deser.impl.FailingDeserializer;
import com.fasterxml.jackson.databind.deser.impl.NullsConstantProvider;
import com.fasterxml.jackson.databind.introspect.*; import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
Expand Down Expand Up @@ -36,11 +35,6 @@ public abstract class SettableBeanProperty
protected static final JsonDeserializer<Object> MISSING_VALUE_DESERIALIZER = new FailingDeserializer( protected static final JsonDeserializer<Object> MISSING_VALUE_DESERIALIZER = new FailingDeserializer(
"No _valueDeserializer assigned"); "No _valueDeserializer assigned");


/**
* @since 2.9
*/
protected static final NullValueProvider MISSING_NULL_PROVIDER = NullsConstantProvider.nuller();

/** /**
* Logical name of the property (often but not always derived * Logical name of the property (often but not always derived
* from the setter method name) * from the setter method name)
Expand Down Expand Up @@ -169,7 +163,7 @@ protected SettableBeanProperty(PropertyName propName, JavaType type, PropertyNam
} }
_valueTypeDeserializer = typeDeser; _valueTypeDeserializer = typeDeser;
_valueDeserializer = MISSING_VALUE_DESERIALIZER; _valueDeserializer = MISSING_VALUE_DESERIALIZER;
_nullProvider = MISSING_NULL_PROVIDER; _nullProvider = MISSING_VALUE_DESERIALIZER;
} }


/** /**
Expand All @@ -194,7 +188,7 @@ protected SettableBeanProperty(PropertyName propName, JavaType type,
_valueTypeDeserializer = null; _valueTypeDeserializer = null;
_valueDeserializer = valueDeser; _valueDeserializer = valueDeser;
// 29-Jan-2017, tatu: Presumed to be irrelevant for ObjectId values... // 29-Jan-2017, tatu: Presumed to be irrelevant for ObjectId values...
_nullProvider = MISSING_NULL_PROVIDER; _nullProvider = valueDeser;
} }


/** /**
Expand All @@ -220,7 +214,7 @@ protected SettableBeanProperty(SettableBeanProperty src)
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected SettableBeanProperty(SettableBeanProperty src, protected SettableBeanProperty(SettableBeanProperty src,
JsonDeserializer<?> deser, NullValueProvider nullAccessor) JsonDeserializer<?> deser, NullValueProvider nuller)
{ {
super(src); super(src);
_propName = src._propName; _propName = src._propName;
Expand All @@ -238,10 +232,10 @@ protected SettableBeanProperty(SettableBeanProperty src,
} }
_viewMatcher = src._viewMatcher; _viewMatcher = src._viewMatcher;
// 29-Jan-2017, tatu: Bit messy, but for now has to do... // 29-Jan-2017, tatu: Bit messy, but for now has to do...
if (nullAccessor == MISSING_VALUE_DESERIALIZER) { if (nuller == MISSING_VALUE_DESERIALIZER) {
nullAccessor = MISSING_NULL_PROVIDER; nuller = _valueDeserializer;
} }
_nullProvider = nullAccessor; _nullProvider = nuller;
} }


/** /**
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
* Simple {@link NullValueProvider} that will always throw a * Simple {@link NullValueProvider} that will always throw a
* {@link InvalidNullException} when a null is encountered. * {@link InvalidNullException} when a null is encountered.
*/ */
public class NullsAsEmptyProvider implements NullValueProvider public class NullsAsEmptyProvider
implements NullValueProvider, java.io.Serializable
{ {
private static final long serialVersionUID = 1L;

protected final JsonDeserializer<?> _deserializer; protected final JsonDeserializer<?> _deserializer;


public NullsAsEmptyProvider(JsonDeserializer<?> deser) { public NullsAsEmptyProvider(JsonDeserializer<?> deser) {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
* Simple {@link NullValueProvider} that will always throw a * Simple {@link NullValueProvider} that will always throw a
* {@link InvalidNullException} when a null is encountered. * {@link InvalidNullException} when a null is encountered.
*/ */
public class NullsConstantProvider implements NullValueProvider public class NullsConstantProvider
implements NullValueProvider, java.io.Serializable
{ {
private static final long serialVersionUID = 1L;

private final static NullsConstantProvider SKIPPER = new NullsConstantProvider(NullValueProvider.SKIP_MARKER); private final static NullsConstantProvider SKIPPER = new NullsConstantProvider(NullValueProvider.SKIP_MARKER);


private final static NullsConstantProvider NULLER = new NullsConstantProvider(null); private final static NullsConstantProvider NULLER = new NullsConstantProvider(null);
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
* Simple {@link NullValueProvider} that will always throw a * Simple {@link NullValueProvider} that will always throw a
* {@link InvalidNullException} when a null is encountered. * {@link InvalidNullException} when a null is encountered.
*/ */
public class NullsFailProvider implements NullValueProvider public class NullsFailProvider
implements NullValueProvider, java.io.Serializable
{ {
private static final long serialVersionUID = 1L;

protected final PropertyName _name; protected final PropertyName _name;
protected final JavaType _type; protected final JavaType _type;


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ protected NullValueProvider findContentNullProvider(DeserializationContext ctxt,
return prov; return prov;
} }
} }
return NullsConstantProvider.nuller(); return valueDeser;
} }


// @since 2.9 // @since 2.9
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public final class StringCollectionDeserializer
public StringCollectionDeserializer(JavaType collectionType, public StringCollectionDeserializer(JavaType collectionType,
JsonDeserializer<?> valueDeser, ValueInstantiator valueInstantiator) JsonDeserializer<?> valueDeser, ValueInstantiator valueInstantiator)
{ {
this(collectionType, valueInstantiator, null, valueDeser, null, null); this(collectionType, valueInstantiator, null, valueDeser, valueDeser, null);
} }


@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Expand Down

0 comments on commit 41e31e1

Please sign in to comment.