Skip to content

ArrayIndexOutOfBoundsException in ChainedInstrumentation when no instrumentations #780

Closed
@ind1go

Description

@ind1go

If you attach a ChainedInstrumentation with an empty list of sub-instrumentations, you get an ArrayIndexOutOfBoundsException:

java.lang.ArrayIndexOutOfBoundsException: -1
	at java.util.ArrayList.elementData(ArrayList.java:418)
	at java.util.ArrayList.get(ArrayList.java:431)
	at graphql.execution.instrumentation.ChainedInstrumentation.lambda$instrumentExecutionResult$8(ChainedInstrumentation.java:140)
	at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
	at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:614)
	at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:1983)
	at graphql.execution.instrumentation.ChainedInstrumentation.instrumentExecutionResult(ChainedInstrumentation.java:140)
	at graphql.GraphQL.lambda$executeAsync$1(GraphQL.java:474)
	at java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981)
	at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2124)
	at graphql.GraphQL.executeAsync(GraphQL.java:474)
	at graphql.GraphQL.execute(GraphQL.java:405)
	at graphql.GraphQL.execute(GraphQL.java:276)

This is sort of an edge case but was caused when the list of instrumentations can be turned on/off dynamically - not too unlikely, I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions