Skip to content

Conversation

richharms
Copy link
Contributor

@richharms richharms commented Nov 28, 2018

A ClassCastException was being thrown when executing the standard introspection query to retrieve the GraphQL schema. In the release notes for graphql-java 11.0, in the Breaking Changes section, there was the following comment: "If you used .getType() please change it to .getUnwrappedNonNullType() to avoid any logic changes." I switched EnhancedExecutionStrategy to utilize getUnwrappedNonNullType() and that appears to have taken care of the issue.

Caused by: java.lang.ClassCastException: graphql.schema.GraphQLNonNull cannot be cast to graphql.schema.GraphQLObjectType
	at graphql.annotations.strategies.EnhancedExecutionStrategy.resolveField(EnhancedExecutionStrategy.java:34)
	at graphql.execution.AsyncSerialExecutionStrategy.lambda$execute$1(AsyncSerialExecutionStrategy.java:43)
	at graphql.execution.Async.eachSequentiallyImpl(Async.java:75)
	at graphql.execution.Async.eachSequentially(Async.java:64)
	at graphql.execution.AsyncSerialExecutionStrategy.execute(AsyncSerialExecutionStrategy.java:38)
	at graphql.execution.ExecutionStrategy.completeValueForObject(ExecutionStrategy.java:636)
	at graphql.execution.ExecutionStrategy.completeValue(ExecutionStrategy.java:416)
	at graphql.annotations.strategies.EnhancedExecutionStrategy.completeValue(EnhancedExecutionStrategy.java:83)
	at graphql.execution.ExecutionStrategy.completeField(ExecutionStrategy.java:366)
	at graphql.execution.ExecutionStrategy.lambda$resolveFieldWithInfo$0(ExecutionStrategy.java:204)
(etc.)

@chenshoo
Copy link
Contributor

Hey, have you checked if there's another place that should be changed in the same way?

@richharms
Copy link
Contributor Author

I do not believe that there is. The only other use that I could find was in completeValue() in that same class, and it's only called by resolveField() after the type is successfully retrieved and called. completeValue() also calls itself recursively, but again only with a safe type.

@yarinvak yarinvak merged commit 613f429 into Enigmatis:development Dec 2, 2018
@richharms richharms deleted the graphql-java-11-fix branch December 2, 2018 15:36
@yarinvak yarinvak added this to the v7 milestone Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants