diff --git a/router/java/src/net/i2p/router/MessageHistory.java b/router/java/src/net/i2p/router/MessageHistory.java index a116aaca7cc209cc889ad894d9d31dc1af2522a3..ed5f9fc6d1d4a6fa0c34eef2137c60f43a9fe939 100644 --- a/router/java/src/net/i2p/router/MessageHistory.java +++ b/router/java/src/net/i2p/router/MessageHistory.java @@ -39,9 +39,8 @@ public class MessageHistory { private final static byte[] NL = System.getProperty("line.separator").getBytes(); private final static int FLUSH_SIZE = 1000; // write out at least once every 1000 entries - /** config property determining whether we want to debug with the message history */ + /** config property determining whether we want to debug with the message history - default false */ public final static String PROP_KEEP_MESSAGE_HISTORY = "router.keepHistory"; - public final static boolean DEFAULT_KEEP_MESSAGE_HISTORY = false; /** config property determining where we want to log the message history, if we're keeping one */ public final static String PROP_MESSAGE_HISTORY_FILENAME = "router.historyFilename"; public final static String DEFAULT_MESSAGE_HISTORY_FILENAME = "messageHistory.txt"; @@ -67,19 +66,8 @@ public class MessageHistory { String getFilename() { return _historyFile; } private void updateSettings() { - String keepHistory = _context.router().getConfigSetting(PROP_KEEP_MESSAGE_HISTORY); - if (keepHistory != null) { - _doLog = Boolean.TRUE.toString().equalsIgnoreCase(keepHistory); - } else { - _doLog = DEFAULT_KEEP_MESSAGE_HISTORY; - } - - String filename = null; - if (_doLog) { - filename = _context.router().getConfigSetting(PROP_MESSAGE_HISTORY_FILENAME); - if ( (filename == null) || (filename.trim().length() <= 0) ) - filename = DEFAULT_MESSAGE_HISTORY_FILENAME; - } + _doLog = Boolean.valueOf(_context.getProperty(PROP_KEEP_MESSAGE_HISTORY)).booleanValue(); + _historyFile = _context.getProperty(PROP_MESSAGE_HISTORY_FILENAME, DEFAULT_MESSAGE_HISTORY_FILENAME); } /** @@ -96,13 +84,6 @@ public class MessageHistory { _reinitializeJob.getTiming().setStartAfter(_context.clock().now()+5000); _context.jobQueue().addJob(_reinitializeJob); } else { - String filename = null; - filename = _context.router().getConfigSetting(PROP_MESSAGE_HISTORY_FILENAME); - if ( (filename == null) || (filename.trim().length() <= 0) ) - filename = DEFAULT_MESSAGE_HISTORY_FILENAME; - - _doLog = DEFAULT_KEEP_MESSAGE_HISTORY; - _historyFile = filename; _localIdent = getName(_context.routerHash()); // _unwrittenEntries = new ArrayList(64); updateSettings();