You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The QuerydslPredicateBuilder expects a MultiValueMap<String, String> but a MultiValueMap<String, Object> is supplied. Later, the parameters map is parsed through:
which throws the exception, expecting a String instead of an Object.
The text was updated successfully, but these errors were encountered:
maxhov
changed the title
QuerydslDataFetcher throws ClassCastException when using a variable with type other than String
QuerydslDataFetcher: ClassCastException when using a variable with type other than String
Mar 1, 2022
This is the wrong usage of the Spring Data API. We decided to broaden the reuse of QuerydslPredicateBuilder so that we also accept Object values. The issue will be fixed with spring-projects/spring-data-commons#2573. We might need to apply some polishing to our code after the Spring Data fix is available.
The actual issue was fixed with 4d115c0. The only remaining thing to do here is to remove a bit of code that causes warnings and that isn't required anymore.
First of all, thanks for the great work on this project!
Noticed a potential issue today. When supplying a query with a
Boolean
variable aClassCastException
is thrown. The stack trace is as follows:Reproduction
I was able to reproduce the issue with the sample project 'webmvc-http' by changing the following line:
spring-graphql/samples/webmvc-http/src/main/resources/graphql/schema.graphqls
Line 3 in bdaaa0f
to
and running the following query
Potential cause
I had a look into it and the issue might have sneaked in because of the cast to
MultiValueMap
on the following line:spring-graphql/spring-graphql/src/main/java/org/springframework/graphql/data/query/QuerydslDataFetcher.java
Line 138 in bdaaa0f
The
QuerydslPredicateBuilder
expects aMultiValueMap<String, String>
but aMultiValueMap<String, Object>
is supplied. Later, the parameters map is parsed through:https://github.com/spring-projects/spring-data-commons/blob/8e5010c490459785316e8dc55817a9ff61227290/src/main/java/org/springframework/data/querydsl/binding/QuerydslPredicateBuilder.java#L229-L231
which throws the exception, expecting a
String
instead of anObject
.The text was updated successfully, but these errors were encountered: