Closed maxhov closed 2 years ago
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 https://github.com/spring-projects/spring-data-commons/issues/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: https://github.com/spring-projects/spring-graphql/blob/bdaaa0f2dd663b1453c46f25d0c14ee70e620791/samples/webmvc-http/src/main/resources/graphql/schema.graphqls#L3
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: https://github.com/spring-projects/spring-graphql/blob/bdaaa0f2dd663b1453c46f25d0c14ee70e620791/spring-graphql/src/main/java/org/springframework/graphql/data/query/QuerydslDataFetcher.java#L138The
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
.