Author: nextgens
Date: 2008-08-12 17:11:25 +0000 (Tue, 12 Aug 2008)
New Revision: 21770
Modified:
trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
trunk/freenet/src/freenet/config/IntOption.java
trunk/freenet/src/freenet/config/LongOption.java
Log:
Fix the code, strip the "ib" part of config options
Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
2008-08-12 16:39:59 UTC (rev 21769)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
2008-08-12 17:11:25 UTC (rev 21770)
@@ -315,14 +315,14 @@
int upstreamBWLimit = (bwIndicator != null ?
bwIndicator.getUpstramMaxBitRate() : -1);
if((bwIndicator != null) && (upstreamBWLimit > 0)) {
int bytes = (upstreamBWLimit / 8) - 1;
- String upstreamBWLimitString = (bytes < 16384 ?
"8K" : SizeUtil.formatSize(Math.round(bytes / 2)));
+ String upstreamBWLimitString = (bytes < 16384 ?
"8K" : SizeUtil.formatSize(bytes / 2));
_setUpstreamBandwidthLimit(upstreamBWLimitString);
Logger.normal(this, "The node has a
bandwidthIndicator: it has reported upstream="+upstreamBWLimit+ "bits/sec... we
will use "+ upstreamBWLimitString +" and skip the bandwidth selection step of
the wizard.");
int downstreamBWLimit =
bwIndicator.getDownstreamMaxBitRate();
if(downstreamBWLimit > 0) {
bytes = (downstreamBWLimit / 8) - 1;
- String downstreamBWLimitString =
SizeUtil.formatSize(Math.round(bytes * 2/3));
+ String downstreamBWLimitString =
SizeUtil.stripBytesEtc(SizeUtil.formatSize(bytes * 2/3));
_setDownstreamBandwidthLimit(downstreamBWLimitString);
Logger.normal(this, "The node has a
bandwidthIndicator: it has reported downstream="+downstreamBWLimit+
"bits/sec... we will use "+ downstreamBWLimitString +" and skip the bandwidth
selection step of the wizard.");
}
Modified: trunk/freenet/src/freenet/config/IntOption.java
===================================================================
--- trunk/freenet/src/freenet/config/IntOption.java 2008-08-12 16:39:59 UTC
(rev 21769)
+++ trunk/freenet/src/freenet/config/IntOption.java 2008-08-12 17:11:25 UTC
(rev 21770)
@@ -5,6 +5,7 @@
import freenet.l10n.L10n;
import freenet.support.Fields;
+import freenet.support.SizeUtil;
import freenet.support.api.IntCallback;
/** Integer config variable */
@@ -50,7 +51,8 @@
public void setValue(String val) throws InvalidConfigValueException {
int x;
try{
- x = Fields.parseSIInt(val);
+ // FIXME: don't strip, parse properly!
+ x = Fields.parseSIInt(SizeUtil.stripBytesEtc(val));
} catch (NumberFormatException e) {
throw new
InvalidConfigValueException(l10n("parseError", "val", val));
}
Modified: trunk/freenet/src/freenet/config/LongOption.java
===================================================================
--- trunk/freenet/src/freenet/config/LongOption.java 2008-08-12 16:39:59 UTC
(rev 21769)
+++ trunk/freenet/src/freenet/config/LongOption.java 2008-08-12 17:11:25 UTC
(rev 21770)
@@ -5,6 +5,7 @@
import freenet.l10n.L10n;
import freenet.support.Fields;
+import freenet.support.SizeUtil;
import freenet.support.api.LongCallback;
/** Long config variable */
@@ -50,7 +51,8 @@
public void setValue(String val) throws InvalidConfigValueException {
long x;
try{
- x = Fields.parseSILong(val);
+ // FIXME: don't strip, parse properly!
+ x = Fields.parseSILong(SizeUtil.stripBytesEtc(val));
}catch (NumberFormatException e) {
throw new
InvalidConfigValueException(l10n("parseError", "val", val));
}