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

NPE in CompositeConnectionAdapter when data fetcher returns null #707

Closed
bclozel opened this issue May 16, 2023 · 2 comments
Closed

NPE in CompositeConnectionAdapter when data fetcher returns null #707

bclozel opened this issue May 16, 2023 · 2 comments
Assignees
Labels
in: core Issues related to config and core support type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented May 16, 2023

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]
@bclozel bclozel added type: bug A general bug in: core Issues related to config and core support labels May 16, 2023
@bclozel bclozel added this to the 1.2.0 milestone May 16, 2023
@rstoyanchev rstoyanchev self-assigned this May 16, 2023
@rstoyanchev
Copy link
Contributor

I'll have a look.

@bclozel
Copy link
Member Author

bclozel commented May 16, 2023

I've reproduced this with a schema like the follwing, and no DataFetcher defined for it:

type Query {
  demo: String
}

When sending a request for demo, the ConnectionFieldTypeVisitor delegates to a PropertyDataFetcher for the property name "demo".

wilkinsona pushed a commit to spring-projects/spring-boot that referenced this issue May 16, 2023
This commit removes an unnecessary test that checks for the pagination
and Connection support in Spring for GraphQL. After a change in
spring-projects/spring-graphql#707, we no longer can test this in
isolation, nor does it make sense to test this integration that
deeply.

See gh-35449
varunteja321 pushed a commit to varunteja321/test1712 that referenced this issue Apr 17, 2024
This commit removes an unnecessary test that checks for the pagination
and Connection support in Spring for GraphQL.
After a change in spring-projects/spring-graphql#707, we no longer can
test this in isolation, nor it make sense to test this integration that
deeply.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues related to config and core support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants