spring-graphql icon indicating copy to clipboard operation
spring-graphql copied to clipboard

Fix NPE in argument binder

Open turboezh opened this issue 2 years ago • 2 comments

In case of collection-argument with nullable items.

Passing null items in collection-argument causes NPE in org.springframework.graphql.data.GraphQlArgumentBinder#createCollection: Cannot invoke "Object.getClass()" because "rawValue" is null.

Test case: Schema:

type Query {
    theData(idList: [ID]!): [String]!
}

Query:

{
  theData(idList: ["123", null, "234"])
}

turboezh avatar Aug 11 '22 12:08 turboezh

@turboezh Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla avatar Aug 11 '22 12:08 pivotal-cla

@turboezh Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Aug 11 '22 12:08 pivotal-cla

Hi, @rstoyanchev. This request was made based on the main branch and I guess this is not a right way. I've made a new one (#486) based on 1.0.x.

turboezh avatar Sep 08 '22 22:09 turboezh

Thanks. Keep in mind that we do rebase the PR onto 1.0.x or on top of the latest in main, depending on the target milestones, so typically no need to be concerned with this.

rstoyanchev avatar Sep 09 '22 12:09 rstoyanchev