Skip to content

Commit e7eaf76

Browse files
committed
remove non-working lock that was meant to fix #357 but does not actually do that
1 parent 5b75309 commit e7eaf76

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ public JsonSerializer<?> createContextual(SerializerProvider provider, BeanPrope
115115
if (delegateType == null) {
116116
delegateType = _converter.getOutputType(provider.getTypeFactory());
117117
}
118-
/* 02-Apr-2015, tatu: For "dynamic case", where type is only specified as
119-
* java.lang.Object (or missing generic), [databind#731]
120-
*/
118+
// 02-Apr-2015, tatu: For "dynamic case", where type is only specified as
119+
// java.lang.Object (or missing generic), [databind#731]
121120
if (!delegateType.isJavaLangObject()) {
122121
delSer = provider.findValueSerializer(delegateType);
123122
}

src/main/java/com/fasterxml/jackson/databind/ser/std/StdSerializer.java

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ public abstract class StdSerializer<T>
3030
extends JsonSerializer<T>
3131
implements JsonFormatVisitable, SchemaAware, java.io.Serializable
3232
{
33-
/**
34-
* Unique key we use to store a temporary lock, to prevent infinite recursion
35-
* when resolving content converters (see [databind#357]).
36-
*<p>
37-
* NOTE: may need to revisit this if nested content converters are needed; if so,
38-
* may need to create per-call lock object. But let's start with a simpler
39-
* solution for now.
40-
*
41-
* @since 2.7
42-
*/
43-
private final static Object CONVERTING_CONTENT_CONVERTER_LOCK = new Object();
44-
4533
private static final long serialVersionUID = 1L;
4634

4735
/**
@@ -363,28 +351,11 @@ protected JsonSerializer<?> findConvertingContentSerializer(SerializerProvider p
363351
BeanProperty prop, JsonSerializer<?> existingSerializer)
364352
throws JsonMappingException
365353
{
366-
/* 19-Oct-2014, tatu: As per [databind#357], need to avoid infinite loop
367-
* when applying contextual content converter; this is not ideal way,
368-
* but should work for most cases.
369-
*/
370-
Object ob = provider.getAttribute(CONVERTING_CONTENT_CONVERTER_LOCK);
371-
if (ob != null) {
372-
if (ob == Boolean.TRUE) { // just to ensure it's value we added.
373-
return existingSerializer;
374-
}
375-
}
376-
377354
final AnnotationIntrospector intr = provider.getAnnotationIntrospector();
378355
if (intr != null && prop != null) {
379356
AnnotatedMember m = prop.getMember();
380357
if (m != null) {
381-
provider.setAttribute(CONVERTING_CONTENT_CONVERTER_LOCK, Boolean.TRUE);
382-
Object convDef;
383-
try {
384-
convDef = intr.findSerializationContentConverter(m);
385-
} finally {
386-
provider.setAttribute(CONVERTING_CONTENT_CONVERTER_LOCK, null);
387-
}
358+
Object convDef = intr.findSerializationContentConverter(m);
388359
if (convDef != null) {
389360
Converter<Object,Object> conv = provider.converterInstance(prop.getMember(), convDef);
390361
JavaType delegateType = conv.getOutputType(provider.getTypeFactory());

0 commit comments

Comments
 (0)