mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-25 16:42:34 +00:00
fix: addressing possible npes (#41944)
close: #40659 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
@@ -436,16 +436,13 @@ public class ReflectionUtil {
|
||||
}
|
||||
|
||||
public static String getTypeString(Type type, Field field) {
|
||||
Class clazz = null;
|
||||
if (type == null) {
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException("type == null and field == null");
|
||||
}
|
||||
type = field.getGenericType();
|
||||
}
|
||||
if (type instanceof Class) {
|
||||
clazz = (Class) type;
|
||||
} else if (type instanceof ParameterizedType) {
|
||||
if (type instanceof ParameterizedType) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String rtype = getTypeString(((ParameterizedType) type).getRawType(), null);
|
||||
|
||||
@@ -463,6 +460,12 @@ public class ReflectionUtil {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
if (!(type instanceof Class)) {
|
||||
throw new IllegalArgumentException("unsupported type " + type.getClass().getName());
|
||||
}
|
||||
|
||||
Class clazz = (Class) type;
|
||||
|
||||
if (CharSequence.class.isAssignableFrom(clazz)) {
|
||||
return "string";
|
||||
} else if (Integer.class.isAssignableFrom(clazz) || int.class.isAssignableFrom(clazz)) {
|
||||
|
||||
Reference in New Issue
Block a user