Skip to content

Conversation

@bbakerman
Copy link
Member

Two bugs where discovered in rthe Atlassian graphql gateway

java.lang.NullPointerException: null
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValue(ValueToVariableValueCompiler.java:56)
    at graphql.normalized.ValueToVariableValueCompiler.lambda$normalisedValueToVariableValues$0(ValueToVariableValueCompiler.java:79)
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValues(ValueToVariableValueCompiler.java:78)
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValue(ValueToVariableValueCompiler.java:54)
    at graphql.normalized.ValueToVariableValueCompiler.normalizedInputValueToVariable(ValueToVariableValueCompiler.java:31)
    at graphql.normalized.VariableAccumulator.accumulateVariable(VariableAccumulator.java:35)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.argValue(ExecutableNormalizedOperationToAstCompiler.java:228)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.createArguments(ExecutableNormalizedOperationToAstCompiler.java:187)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.selectionForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:162)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.subselectionsForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:108)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.selectionForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:153)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.subselectionsForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:108)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.compileToDocument(ExecutableNormalizedOperationToAstCompiler.java:72)
graphql.AssertException: Should never happen. Cannot handle node of type: class graphql.language.EnumValue
    at graphql.normalized.ValueToVariableValueCompiler.toVariableValue(ValueToVariableValueCompiler.java:121)
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValue(ValueToVariableValueCompiler.java:50)
    at graphql.normalized.ValueToVariableValueCompiler.lambda$normalisedValueToVariableValues$0(ValueToVariableValueCompiler.java:79)
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValues(ValueToVariableValueCompiler.java:78)
    at graphql.normalized.ValueToVariableValueCompiler.normalisedValueToVariableValue(ValueToVariableValueCompiler.java:54)
    at graphql.normalized.ValueToVariableValueCompiler.normalizedInputValueToVariable(ValueToVariableValueCompiler.java:31)
    at graphql.normalized.VariableAccumulator.accumulateVariable(VariableAccumulator.java:35)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.argValue(ExecutableNormalizedOperationToAstCompiler.java:228)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.createArguments(ExecutableNormalizedOperationToAstCompiler.java:187)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.selectionForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:162)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.subselectionsForNormalizedField(ExecutableNormalizedOperationToAstCompiler.java:108)
    at graphql.normalized.ExecutableNormalizedOperationToAstCompiler.compileToDocument(ExecutableNormalizedOperationToAstCompiler.java:72)

This fixes both of these exceptions. It handles the missing EnumValue and also that a NormalizedInputValue value can sometimes be null

@bbakerman bbakerman added this to the 19.0 milestone Apr 7, 2022
public static EnumValue of(String name) {
return newEnumValue().name(name).build();
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Consistent with the other scalar Value classes


public static NullValue of() {
return NullValue.newNullValue().build();
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Same consistency

@bbakerman bbakerman merged commit 2148cdf into master Apr 13, 2022
@dondonz dondonz modified the milestones: 19.0, 18.1 May 3, 2022
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