runelite-client: Don't fail on invalid config values.
This commit is contained in:
@@ -78,16 +78,20 @@ class ConfigInvocationHandler implements InvocationHandler
|
|||||||
|
|
||||||
// Convert value to return type
|
// Convert value to return type
|
||||||
Class<?> returnType = method.getReturnType();
|
Class<?> returnType = method.getReturnType();
|
||||||
Object objectValue = ConfigManager.stringToObject(value, returnType);
|
|
||||||
|
try
|
||||||
// objectValue automatically gets unboxed
|
{
|
||||||
// if (!objectValue.getClass().equals(returnType))
|
return ConfigManager.stringToObject(value, returnType);
|
||||||
// {
|
}
|
||||||
// log.warn("Unable to convert return type for configuration item {}.{}: {}", group.keyName(), item.keyName(), returnType);
|
catch (Exception e)
|
||||||
// return null;
|
{
|
||||||
// }
|
log.warn("Unable to unmarshal {}.{} ", group.keyName(), item.keyName(), e);
|
||||||
|
if (method.isDefault())
|
||||||
return objectValue;
|
{
|
||||||
|
return callDefaultMethod(proxy, method, args);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -254,7 +254,14 @@ public class ConfigManager
|
|||||||
String value = getConfiguration(groupName, key);
|
String value = getConfiguration(groupName, key);
|
||||||
if (!Strings.isNullOrEmpty(value))
|
if (!Strings.isNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
return (T) stringToObject(value, clazz);
|
try
|
||||||
|
{
|
||||||
|
return (T) stringToObject(value, clazz);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.warn("Unable to unmarshal {}.{} ", groupName, key, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user