* Addressbook: Don't write to log file on Android (ticket #859)

This commit is contained in:
zzz
2013-08-31 15:35:57 +00:00
parent d6c4e411be
commit 41595cafce
2 changed files with 4 additions and 3 deletions

View File

@ -260,7 +260,7 @@ class AddressBook {
* An AddressBook to merge with. * An AddressBook to merge with.
* @param overwrite True to overwrite * @param overwrite True to overwrite
* @param log * @param log
* The log to write messages about new addresses or conflicts to. * The log to write messages about new addresses or conflicts to. May be null.
* *
* @throws IllegalStateException if this was created with the Subscription constructor. * @throws IllegalStateException if this was created with the Subscription constructor.
*/ */

View File

@ -37,6 +37,7 @@ import net.i2p.client.naming.SingleFileNamingService;
import net.i2p.data.DataFormatException; import net.i2p.data.DataFormatException;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.util.SecureDirectory; import net.i2p.util.SecureDirectory;
import net.i2p.util.SystemVersion;
/** /**
* Main class of addressbook. Performs updates, and runs the main loop. * Main class of addressbook. Performs updates, and runs the main loop.
@ -168,7 +169,7 @@ public class Daemon {
if (publishedNS == null) if (publishedNS == null)
publishedNS = new SingleFileNamingService(I2PAppContext.getGlobalContext(), published.getAbsolutePath()); publishedNS = new SingleFileNamingService(I2PAppContext.getGlobalContext(), published.getAbsolutePath());
success = publishedNS.putIfAbsent(key, dest); success = publishedNS.putIfAbsent(key, dest);
if (!success) { if (log != null && !success) {
try { try {
log.append("Save to published address book " + published.getCanonicalPath() + " failed for new key " + key); log.append("Save to published address book " + published.getCanonicalPath() + " failed for new key " + key);
} catch (IOException ioe) {} } catch (IOException ioe) {}
@ -257,7 +258,7 @@ public class Daemon {
SubscriptionList subscriptions = new SubscriptionList(subscriptionFile, SubscriptionList subscriptions = new SubscriptionList(subscriptionFile,
etagsFile, lastModifiedFile, lastFetchedFile, delay, defaultSubs, settings etagsFile, lastModifiedFile, lastFetchedFile, delay, defaultSubs, settings
.get("proxy_host"), Integer.parseInt(settings.get("proxy_port"))); .get("proxy_host"), Integer.parseInt(settings.get("proxy_port")));
Log log = new Log(logFile); Log log = SystemVersion.isAndroid() ? null : new Log(logFile);
// If false, add hosts via naming service; if true, write hosts.txt file directly // If false, add hosts via naming service; if true, write hosts.txt file directly
// Default false // Default false