runelite-client: Don't fail on invalid config values.

This commit is contained in:
Max Weber
2018-06-04 01:17:51 -06:00
parent 7c048a00bc
commit d97eef0c10
2 changed files with 22 additions and 11 deletions

View File

@@ -78,16 +78,20 @@ class ConfigInvocationHandler implements InvocationHandler
// Convert value to return type
Class<?> returnType = method.getReturnType();
Object objectValue = ConfigManager.stringToObject(value, returnType);
// objectValue automatically gets unboxed
// if (!objectValue.getClass().equals(returnType))
// {
// log.warn("Unable to convert return type for configuration item {}.{}: {}", group.keyName(), item.keyName(), returnType);
// return null;
// }
return objectValue;
try
{
return ConfigManager.stringToObject(value, returnType);
}
catch (Exception e)
{
log.warn("Unable to unmarshal {}.{} ", group.keyName(), item.keyName(), e);
if (method.isDefault())
{
return callDefaultMethod(proxy, method, args);
}
return null;
}
}
else
{

View File

@@ -254,7 +254,14 @@ public class ConfigManager
String value = getConfiguration(groupName, key);
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;
}