- SusiDNS cleanups

- Logging cleanups
This commit is contained in:
zzz
2011-03-29 02:16:42 +00:00
parent 8ae398d786
commit fbfffa9987
5 changed files with 26 additions and 17 deletions

View File

@@ -163,7 +163,6 @@ public class BlockfileNamingService extends DummyNamingService {
info.setProperty(PROP_LISTS, list);
hdr.put(PROP_INFO, info);
// TODO all in one skiplist or separate?
int total = 0;
for (String hostsfile : getFilenames(list)) {
File file = new File(_context.getRouterDir(), hostsfile);
@@ -171,6 +170,7 @@ public class BlockfileNamingService extends DummyNamingService {
continue;
int count = 0;
BufferedReader in = null;
String sourceMsg = "Imported from " + hostsfile + " file";
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"), 16*1024);
String line = null;
@@ -189,8 +189,11 @@ public class BlockfileNamingService extends DummyNamingService {
String b64 = line.substring(split+1); //.trim() ??????????????
Destination d = lookupBase64(b64);
if (d != null) {
addEntry(rv, hostsfile, key, d, hostsfile);
addEntry(rv, hostsfile, key, d, sourceMsg);
count++;
} else {
_log.logAlways(Log.WARN, "Unable to import entry for " + key +
" from file " + file + " - bad Base 64: " + b64);
}
}
} catch (IOException ioe) {

View File

@@ -83,7 +83,7 @@ public abstract class NamingService {
result.fromBase64(hostname);
return result;
} catch (DataFormatException dfe) {
if (_log.shouldLog(Log.WARN)) _log.warn("Error translating [" + hostname + "]", dfe);
if (_log.shouldLog(Log.WARN)) _log.warn("Bad B64 dest [" + hostname + "]", dfe);
return null;
}
}