Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support top-level scalar values in Jackson2Tokenizer [SPR-16166] #20714

Closed
spring-issuemaster opened this issue Nov 6, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Nov 6, 2017

Julien Hoarau opened SPR-16166 and commented

WebClient failed to convert a json response containing a top level JsonValue (true, false, null, NUMBER ) (Valid Json according to ECMA-404)

Simple code example for demonstration

package com.atlassian.product.fabric.tasksdecisions.rest;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;

@RestController
public class JsonValueResource {
    @GetMapping("/fail")
    public Mono<Boolean> fail() {
        return WebClient.builder().baseUrl("http://localhost:8000")
                .build().get().uri("/")
                .accept(MediaType.APPLICATION_JSON)
                .retrieve()
                .bodyToMono(Boolean.class)
                .switchIfEmpty(Mono.error(new RuntimeException("No response")));
    }

    @GetMapping
    Mono<Boolean> jsonValueBoolean() {
        return Mono.just(true);
    }

}

Jackson2Tokenizer seems to only return tokens if they are in an object or array.


Affects: 5.0.1

Issue Links:

  • #20770 Spring WebFlux (Netty/Jackson) treats Mono and Mono differently ("is duplicated by")
  • #20953 Support array of scalar values in Jackson2Tokenizer

Referenced from: pull request #1602, and commits 8e253a3

1 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 14, 2017

Arjen Poutsma commented

Fixed in 8e253a3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.