Skip to content

NPE in CompositeConnectionAdapter when data fetcher returns null #707

Closed
@bclozel

Description

@bclozel

I've just noticed that when defining a query that returns a SomethingConnection, the following NullPointerException is thrown if the DataFetcher is not yet implemented and we send execute that query:

java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "container" is null
	at org.springframework.graphql.data.pagination.CompositeConnectionAdapter.getAdapter(CompositeConnectionAdapter.java:73) ~[spring-graphql-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
	at org.springframework.graphql.data.pagination.CompositeConnectionAdapter.getRequiredAdapter(CompositeConnectionAdapter.java:65) ~[spring-graphql-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
	at org.springframework.graphql.data.pagination.CompositeConnectionAdapter.getContent(CompositeConnectionAdapter.java:49) ~[spring-graphql-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
	at org.springframework.graphql.data.pagination.ConnectionFieldTypeVisitor$ConnectionDataFetcher.adapt(ConnectionFieldTypeVisitor.java:146) ~[spring-graphql-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]
	at org.springframework.graphql.data.pagination.ConnectionFieldTypeVisitor$ConnectionDataFetcher.get(ConnectionFieldTypeVisitor.java:136) ~[spring-graphql-1.2.0-SNAPSHOT.jar:1.2.0-SNAPSHOT]

Metadata

Metadata

Assignees

Labels

in: coreIssues related to config and core supporttype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions