Catch NumberFormatException

This commit is contained in:
snowleo 2011-06-08 03:44:16 +02:00
parent e0597f2df1
commit dea44d7cbc

View File

@ -136,6 +136,8 @@ public class EssentialsSign
{
throw new SignException(Util.i18n("invalidCharge"));
}
try
{
final int quantity = Integer.parseInt(split[0]);
if (quantity <= 1)
{
@ -148,6 +150,11 @@ public class EssentialsSign
}
sign.setLine(index, quantity + " " + item);
}
catch (NumberFormatException ex)
{
throw new SignException(Util.i18n("invalidCharge"), ex);
}
}
}
protected final ItemStack getItemStack(final String itemName) throws SignException
@ -187,6 +194,8 @@ public class EssentialsSign
{
throw new SignException(Util.i18n("invalidCharge"));
}
try
{
final int quantity = Integer.parseInt(split[0]);
if (quantity <= 1)
{
@ -205,6 +214,11 @@ public class EssentialsSign
return new Charge(quantity, ess);
}
}
catch (NumberFormatException ex)
{
throw new SignException(Util.i18n("invalidCharge"), ex);
}
}
}