Skip to content

JsonObjectDecoder throws ArrayIndexOutOfBoundsException: -1 with valid input [SPR-15013] #19580

@spring-projects-issues

Description

@spring-projects-issues

Sébastien Deleuze opened SPR-15013 and commented

JsonObjectDecoder fails with ArrayIndexOutOfBoundsException: -1 error with this test case:

JsonObjectDecoder decoder = new JsonObjectDecoder();

		Flux<DataBuffer> source =
				Flux.just(stringBuffer("["), stringBuffer("{\"id\":1,\"name\":\"Robert\"}"), stringBuffer(","), stringBuffer("{\"id\":2,\"name\":\"Raide\"}"), stringBuffer(","), stringBuffer("{\"id\":3,\"name\":\"Ford\"}"), stringBuffer("]"));
		Flux<String> output =
				decoder.decode(source, null, null, Collections.emptyMap()).map(JsonObjectDecoderTests::toString);
		StepVerifier.create(output)
				.expectNext("{\"id\":1,\"name\":\"Robert\"}")
				.expectNext("{\"id\":2,\"name\":\"Raide\"}")
				.expectNext("{\"id\":3,\"name\":\"Ford\"}")
				.expectComplete()
				.verify();

Affects: 5.0 M3

Issue Links:

Referenced from: commits 4021d23

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions