Jackson2JsonDecoder tolerates null literal

Fixes #22042
This commit is contained in:
Rossen Stoyanchev
2019-01-18 18:27:40 -05:00
parent 5dcde9e7d7
commit e373b46660
2 changed files with 16 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import org.springframework.core.codec.AbstractDecoderTestCase;
import org.springframework.core.codec.CodecException;
import org.springframework.core.codec.DecodingException;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.MediaType;
import org.springframework.http.codec.Pojo;
import org.springframework.util.MimeType;
@@ -174,6 +175,14 @@ public class Jackson2JsonDecoderTests extends AbstractDecoderTestCase<Jackson2Js
.verifyError(DecodingException.class));
}
@Test // #22042
public void decodeWithNullLiteral() {
Flux<Object> result = this.decoder.decode(Flux.concat(stringBuffer("null")),
ResolvableType.forType(Pojo.class), MediaType.APPLICATION_JSON, Collections.emptyMap());
StepVerifier.create(result).expectComplete().verify();
}
@Test
public void noDefaultConstructor() {
Flux<DataBuffer> input =