Skip to content

Commit 617665b

Browse files
authored
Merge pull request #108 from graphql-java/fix-null-pointer-exception-batched
hotfix- fixing null pointer exception bug when using @GraphQLBatched
2 parents 1ab7123 + 3406db6 commit 617665b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/graphql/annotations/BatchedTypeFunction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public boolean canBuildType(final Class<?> aClass, final AnnotatedType type) {
3737
}
3838

3939
@Override
40-
public graphql.schema.GraphQLType buildType(final String typeName, final Class<?> aClass, final AnnotatedType annotatedType) {
40+
public graphql.schema.GraphQLType buildType(String typeName, final Class<?> aClass, final AnnotatedType annotatedType) {
4141
if (!aClass.isAssignableFrom(List.class)) {
4242
throw new IllegalArgumentException("Batched method should return a List");
4343
}
@@ -48,10 +48,11 @@ public graphql.schema.GraphQLType buildType(final String typeName, final Class<?
4848
AnnotatedType arg = parameterizedType.getAnnotatedActualTypeArguments()[0];
4949
Class<?> klass;
5050
if (arg.getType() instanceof ParameterizedType) {
51-
klass = (Class<?>)((ParameterizedType)(arg.getType())).getRawType();
51+
klass = (Class<?>) ((ParameterizedType) (arg.getType())).getRawType();
5252
} else {
5353
klass = (Class<?>) arg.getType();
5454
}
55+
typeName = klass.getSimpleName();
5556
return defaultTypeFunction.buildType(typeName, klass, arg);
5657
}
5758
}

0 commit comments

Comments
 (0)