Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public Collection<Object> deserialize(JsonParser p, DeserializationContext ctxt,
return handleNonArray(p, ctxt, new ArrayBlockingQueue<Object>(1));
}
result0 = super.deserialize(p, ctxt, new ArrayList<Object>());
if (result0.isEmpty()) return new ArrayBlockingQueue<Object>(1, false);
return new ArrayBlockingQueue<Object>(result0.size(), false, result0);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.fasterxml.jackson.databind.deser;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.Test;

import java.io.IOException;
import java.util.Collection;
import java.util.concurrent.ArrayBlockingQueue;

public class TestEmptyArrayBlockingQueueDeser {

@Test
public void emptyCollectionDeser() throws JsonProcessingException, IOException {
ObjectMapper om = new ObjectMapper();
String json = om.writeValueAsString(new RemoteEntity());
Entity entity = om.readValue(json, Entity.class);
Assert.assertEquals(0, entity.values.size());
}



private static class RemoteEntity{
private Collection<Double> values = new ArrayBlockingQueue<>(20);

public Collection<Double> getValues() {
return values;
}
}

private static class Entity{
private ArrayBlockingQueue<Double> values;

public Collection<Double> getValues() {
return values;
}
}
}