Skip to content

Comments

ResultPath: Check object type before casting to int#3765

Merged
bbakerman merged 2 commits intographql-java:masterfrom
alex-cova:master
Dec 4, 2024
Merged

ResultPath: Check object type before casting to int#3765
bbakerman merged 2 commits intographql-java:masterfrom
alex-cova:master

Conversation

@alex-cova
Copy link
Contributor

This pull request adds a more robust validation to the ResultPath.fromList method. As you can pass any object to GraphqlErrorException.Builder.path, it can lead to a ClassCastException when casting directly to int. this happened to me lol.

public T path(List<Object> path) {
  this.path = path;
  return (T)this.asDerivedType();
}

GraphqlErrorException.Builder.path


def "pass any other object than string or int"(){
when:
ResultPath.fromList(["a", "b", true])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the graphql-java code itself would never use anything but a String or Integer - but I am happy to have this be more robust

@bbakerman bbakerman merged commit 7e5987e into graphql-java:master Dec 4, 2024
@dondonz dondonz added this to the 23.x breaking changes milestone Dec 4, 2024
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