Skip to content

Commit ab1ce8d

Browse files
committed
Remove null checks
1 parent f4b05bb commit ab1ce8d

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/graphql/GraphQL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ private List<ValidationError> validate(ExecutionInput executionInput, Document d
599599
validationCtx.onDispatched();
600600

601601
Predicate<Class<?>> validationRulePredicate = executionInput.getGraphQLContext().getOrDefault(ParseAndValidate.INTERNAL_VALIDATION_PREDICATE_HINT, r -> true);
602-
Locale locale = executionInput.getLocale() != null ? executionInput.getLocale() : Locale.getDefault();
602+
Locale locale = executionInput.getLocale();
603603
List<ValidationError> validationErrors = ParseAndValidate.validate(graphQLSchema, document, validationRulePredicate, locale);
604604

605605
validationCtx.onCompleted(validationErrors, null);

src/main/java/graphql/ParseAndValidate.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ public static ParseAndValidateResult parse(ExecutionInput executionInput) {
6868
// we use the query parser options by default if they are not specified
6969
parserOptions = ofNullable(parserOptions).orElse(ParserOptions.getDefaultOperationParserOptions());
7070
Parser parser = new Parser();
71-
// DZ TODO talking point: we can now delete null checks like the line below - you get an IDE warning about it
72-
Locale locale = executionInput.getLocale() == null ? Locale.getDefault() : executionInput.getLocale();
71+
Locale locale = executionInput.getLocale();
7372
ParserEnvironment parserEnvironment = ParserEnvironment.newParserEnvironment()
7473
.document(executionInput.getQuery()).parserOptions(parserOptions)
7574
.locale(locale)

0 commit comments

Comments
 (0)