Skip to content

Commit

Permalink
Fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 21, 2017
1 parent c3fa184 commit acdfda5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;
import com.fasterxml.jackson.databind.type.ReferenceType;

class Jdk8Deserializers extends Deserializers.Base
public class Jdk8Deserializers extends Deserializers.Base
{
// 21-Oct-2015, tatu: Code much simplified with 2.7 where we should be getting much
// of boilerplate handling automatically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.stream.LongStream;
import java.util.stream.Stream;

class Jdk8Serializers extends Serializers.Base
public class Jdk8Serializers extends Serializers.Base
{
@Override
public JsonSerializer<?> findReferenceSerializer(SerializationConfig config,
Expand All @@ -38,7 +38,7 @@ public JsonSerializer<?> findReferenceSerializer(SerializationConfig config,
if (OptionalDouble.class.isAssignableFrom(raw)) {
return OptionalDoubleSerializer.INSTANCE;
}
return findReferenceSerializer(config, refType, beanDesc, contentTypeSerializer, contentValueSerializer);
return null;
}

@Override
Expand All @@ -59,6 +59,6 @@ public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType typ
JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0];
return new StreamSerializer(config.getTypeFactory().constructParametrizedType(Stream.class, Stream.class, vt), vt);
}
return super.findSerializer(config, type, beanDesc);
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.fasterxml.jackson.datatype.jdk8;

import java.util.*;
import java.util.concurrent.atomic.AtomicReference;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;

import com.fasterxml.jackson.annotation.*;

Expand All @@ -11,6 +12,7 @@
import com.fasterxml.jackson.core.type.TypeReference;

import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -250,6 +252,13 @@ public void testCustomSerializer() throws Exception
assertEquals(json, aposToQuotes("{'value':'FOOBAR'}"));
}

// [modules-java8#33]: Verify against regression...
public void testOtherRefSerializers() throws Exception
{
String json = MAPPER.writeValueAsString(new AtomicReference<String>("foo"));
assertEquals(quote("foo"), json);
}

/*
/**********************************************************
/* Helper methods
Expand Down
5 changes: 5 additions & 0 deletions release-notes/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ Louis-Rémi Paquet (lrpg@github)
* Reported #15: Optional<Long> and OptionalLong deserialization
not consistent when deserializing from String
(2.8.8)

Mikko Tiihonen (gmokki@github)
* Reported #33: `Jdk8Serializer.findReferenceSerializer()` leads to `StackOverflowError`
in 2.8.9
(2.8.10)
5 changes: 5 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Modules:
=== Releases ===
------------------------------------------------------------------------

2.8.10 (not yet released)

#33: `Jdk8Serializer.findReferenceSerializer()` leads to `StackOverflowError` in 2.8.9
(reported by Mikko T)

2.8.9 (12-Jun-2017)

No changes since 2.8.8
Expand Down

0 comments on commit acdfda5

Please sign in to comment.