Added config file existence check
This commit is contained in:
parent
2a04f3a29b
commit
0afb7553a9
@ -52,7 +52,7 @@ dependencies {
|
||||
compile 'org.pcap4j:pcap4j-core:1.7.0'
|
||||
compile 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.0'
|
||||
compile 'de.measite.minidns:minidns-core:0.2.1'
|
||||
compile 'com.google.code.gson:gson:2.8.0'
|
||||
compile 'com.google.code.gson:gson:2.8.1'
|
||||
|
||||
compile 'com.google.firebase:firebase-crash:10.2.6'
|
||||
|
||||
|
@ -130,7 +130,7 @@ public class DnsTestFragment extends ToolbarFragment {
|
||||
|
||||
|
||||
private StringBuilder testServer(DNSQuery dnsQuery, Record.TYPE type, String server, String domain, StringBuilder testText) {
|
||||
Logger.debug("Testing DNS server" + server);
|
||||
Logger.debug("Testing DNS server " + server);
|
||||
testText.append(getString(R.string.test_domain)).append(" ").append(domain).append("\n").append(getString(R.string.test_dns_server)).append(" ").append(server);
|
||||
|
||||
mHandler.obtainMessage(DnsTestHandler.MSG_DISPLAY_STATUS, testText.toString()).sendToTarget();
|
||||
|
@ -125,11 +125,13 @@ public class Configurations {
|
||||
public static Configurations load(File file) {
|
||||
Configurations.file = file;
|
||||
Configurations config = null;
|
||||
try {
|
||||
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
|
||||
Logger.info("Loading configuration successfully from " + file);
|
||||
} catch (Exception e) {
|
||||
Logger.logException(e);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
|
||||
Logger.info("Loading configuration successfully from " + file);
|
||||
} catch (Exception e) {
|
||||
Logger.logException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (config == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user