mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-18 08:29:09 +00:00
[Android] Change ConfigFile's get[x] methods to throw IllegalArgumentExceptions instead on NumberFormatExceptions. It was incorrect to throw that exception, since it had nothing to do with how the number was formatted in the string.
If a number formatting problem occurred, [type object].parse[type]() methods would throw a NumberFormatException. Also fixed a slight typo in CoreManagerActivity.
This commit is contained in:
parent
e11b678ddd
commit
03260c3e6f
@ -75,7 +75,7 @@ public final class CoreManagerActivity extends ActionBarActivity implements TabL
|
||||
// Do nothing. Not used.
|
||||
}
|
||||
|
||||
// Adapter for the CoreView ViewPager class.
|
||||
// Adapter for the core manager ViewPager.
|
||||
private final class ViewPagerAdapter extends FragmentPagerAdapter
|
||||
{
|
||||
/**
|
||||
|
@ -215,14 +215,14 @@ public final class ConfigFile
|
||||
*
|
||||
* @return the Integer value associated with the given key.
|
||||
*/
|
||||
public int getInt(String key) throws NumberFormatException
|
||||
public int getInt(String key)
|
||||
{
|
||||
String str = getString(key);
|
||||
|
||||
if (str != null)
|
||||
return Integer.parseInt(str);
|
||||
else
|
||||
throw new NumberFormatException();
|
||||
throw new IllegalArgumentException("Config key '" + key + "' is invalid.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,14 +232,14 @@ public final class ConfigFile
|
||||
*
|
||||
* @return the double value associated with the given key.
|
||||
*/
|
||||
public double getDouble(String key) throws NumberFormatException
|
||||
public double getDouble(String key)
|
||||
{
|
||||
String str = getString(key);
|
||||
|
||||
if (str != null)
|
||||
return Double.parseDouble(str);
|
||||
else
|
||||
throw new NumberFormatException();
|
||||
throw new IllegalArgumentException("Config key '" + key + "' is invalid.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,14 +249,14 @@ public final class ConfigFile
|
||||
*
|
||||
* @return the float value associated with the given key.
|
||||
*/
|
||||
public float getFloat(String key) throws NumberFormatException
|
||||
public float getFloat(String key)
|
||||
{
|
||||
String str = getString(key);
|
||||
|
||||
if (str != null)
|
||||
return Float.parseFloat(str);
|
||||
else
|
||||
throw new NumberFormatException();
|
||||
throw new IllegalArgumentException("Config key '" + key + "' is invalid.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -270,6 +270,9 @@ public final class ConfigFile
|
||||
{
|
||||
String str = getString(key);
|
||||
|
||||
return Boolean.parseBoolean(str);
|
||||
if (str != null)
|
||||
return Boolean.parseBoolean(str);
|
||||
else
|
||||
throw new IllegalArgumentException("Config key '" + key + "' is invalid.");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user