Findbugs all over #4

char encoding
This commit is contained in:
zzz
2015-07-12 19:19:32 +00:00
parent d087fd674b
commit 1ed1e4414b
10 changed files with 47 additions and 31 deletions

View File

@ -228,7 +228,7 @@ public class DBHistory {
add(buf, "unpromptedDbStoreOld", _unpromptedDbStoreOld, "How times have they sent us something we didn't ask for but have seen before?");
add(buf, "lastLookupReceived", _lastLookupReceived, "When was the last time they send us a lookup? (milliseconds since the epoch)");
add(buf, "avgDelayBetweenLookupsReceived", _avgDelayBetweenLookupsReceived, "How long is it typically between each db lookup they send us? (in milliseconds)");
out.write(buf.toString().getBytes());
out.write(buf.toString().getBytes("UTF-8"));
_failedLookupRate.store(out, "dbHistory.failedLookupRate");
_invalidReplyRate.store(out, "dbHistory.invalidReplyRate");
}

View File

@ -139,7 +139,7 @@ class ProfilePersistenceHelper {
add(buf, "tunnelPeakTunnel1mThroughput", profile.getPeakTunnel1mThroughputKBps(), "KBytes/sec");
buf.append(NL);
out.write(buf.toString().getBytes());
out.write(buf.toString().getBytes("UTF-8"));
if (profile.getIsExpanded()) {
// only write out expanded data if, uh, we've got it

View File

@ -151,7 +151,7 @@ public class TunnelHistory {
add(buf, "lifetimeAgreedTo", _lifetimeAgreedTo.get(), "How many tunnels has the peer ever agreed to participate in?");
add(buf, "lifetimeFailed", _lifetimeFailed.get(), "How many tunnels has the peer ever agreed to participate in that failed prematurely?");
add(buf, "lifetimeRejected", _lifetimeRejected.get(), "How many tunnels has the peer ever refused to participate in?");
out.write(buf.toString().getBytes());
out.write(buf.toString().getBytes("UTF-8"));
_rejectRate.store(out, "tunnelHistory.rejectRate");
_failRate.store(out, "tunnelHistory.failRate");
}

View File

@ -252,7 +252,7 @@ public class WorkingDir {
}
System.setProperty(PROP_WRAPPER_LOG, logfile.getAbsolutePath());
try {
PrintStream ps = new PrintStream(new SecureFileOutputStream(logfile, true));
PrintStream ps = new PrintStream(new SecureFileOutputStream(logfile, true), true, "UTF-8");
System.setOut(ps);
System.setErr(ps);
} catch (IOException ioe) {

View File

@ -12,6 +12,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import net.i2p.data.DataHelper;
import net.i2p.router.Router;
import net.i2p.util.Log;
import net.i2p.util.SecureFileOutputStream;
@ -45,7 +46,7 @@ public class MarkLiveliness implements SimpleTimer.TimedEvent {
FileOutputStream fos = null;
try {
fos = new SecureFileOutputStream(_pingFile);
fos.write(Long.toString(System.currentTimeMillis()).getBytes());
fos.write(DataHelper.getASCII(Long.toString(System.currentTimeMillis())));
} catch (IOException ioe) {
if (!_errorLogged) {
Log log = _router.getContext().logManager().getLog(MarkLiveliness.class);