Protect against NPE when resolving generic array

Update ResolvableType to check that the resolved component type from
a generic array is not null before attempting to use it to generate the
resolved array class.

Issue: SPR-11044
This commit is contained in:
Phillip Webb
2013-10-30 10:48:32 -07:00
parent a7af9505de
commit e5aef5ee9d
3 changed files with 56 additions and 1 deletions

View File

@@ -575,7 +575,8 @@ public final class ResolvableType implements Serializable {
return (Class<?>) this.type;
}
if (this.type instanceof GenericArrayType) {
return Array.newInstance(getComponentType().resolve(), 0).getClass();
Class<?> resolvedComponent = getComponentType().resolve();
return (resolvedComponent == null ? null : Array.newInstance(resolvedComponent, 0).getClass());
}
return resolveType().resolve();
}