[freenet-cvs] r11944 - trunk/freenet/src/freenet/config
nextgens at freenetproject.org
nextgens at freenetproject.org
Sat Mar 3 16:58:47 UTC 2007
Author: nextgens
Date: 2007-03-03 16:58:31 +0000 (Sat, 03 Mar 2007)
New Revision: 11944
Modified:
trunk/freenet/src/freenet/config/IntOption.java
trunk/freenet/src/freenet/config/ShortOption.java
Log:
Do the same for IntOption adn ShortOption
Modified: trunk/freenet/src/freenet/config/IntOption.java
===================================================================
--- trunk/freenet/src/freenet/config/IntOption.java 2007-03-03 16:44:39 UTC (rev 11943)
+++ trunk/freenet/src/freenet/config/IntOption.java 2007-03-03 16:58:31 UTC (rev 11944)
@@ -47,14 +47,24 @@
}
public void setValue(String val) throws InvalidConfigValueException {
- int x = Fields.parseInt(val);
+ int x;
+ try{
+ x = Fields.parseInt(val);
+ } catch (NumberFormatException e) {
+ throw new InvalidConfigValueException("The value specified can't be parsed : "+val);
+ }
cb.set(x);
cachedStringValue = val;
currentValue = x;
}
- public void setInitialValue(String val) {
- int x = Fields.parseInt(val);
+ public void setInitialValue(String val) throws InvalidConfigValueException {
+ int x;
+ try{
+ x = Fields.parseInt(val);
+ } catch (NumberFormatException e) {
+ throw new InvalidConfigValueException("The value specified can't be parsed : "+val);
+ }
cachedStringValue = val;
currentValue = x;
}
Modified: trunk/freenet/src/freenet/config/ShortOption.java
===================================================================
--- trunk/freenet/src/freenet/config/ShortOption.java 2007-03-03 16:44:39 UTC (rev 11943)
+++ trunk/freenet/src/freenet/config/ShortOption.java 2007-03-03 16:58:31 UTC (rev 11944)
@@ -26,7 +26,12 @@
}
public void setValue(String val) throws InvalidConfigValueException {
- short x = Fields.parseShort(val);
+ short x;
+ try{
+ x= Fields.parseShort(val);
+ } catch (NumberFormatException e) {
+ throw new InvalidConfigValueException("The value specified can't be parsed : "+val);
+ }
cb.set(x);
currentValue = x;
}
@@ -36,7 +41,12 @@
}
public void setInitialValue(String val) throws InvalidConfigValueException {
- short x = Fields.parseShort(val);
+ short x;
+ try{
+ x = Fields.parseShort(val);
+ } catch (NumberFormatException e) {
+ throw new InvalidConfigValueException("The value specified can't be parsed : "+val);
+ }
currentValue = x;
}
More information about the cvs
mailing list