Skip to content

Commit 0afb755

Browse files
committed
Added config file existence check
1 parent 2a04f3a commit 0afb755

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies {
5252
compile 'org.pcap4j:pcap4j-core:1.7.0'
5353
compile 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.0'
5454
compile 'de.measite.minidns:minidns-core:0.2.1'
55-
compile 'com.google.code.gson:gson:2.8.0'
55+
compile 'com.google.code.gson:gson:2.8.1'
5656

5757
compile 'com.google.firebase:firebase-crash:10.2.6'
5858

app/src/main/java/org/itxtech/daedalus/fragment/DnsTestFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void run() {
130130

131131

132132
private StringBuilder testServer(DNSQuery dnsQuery, Record.TYPE type, String server, String domain, StringBuilder testText) {
133-
Logger.debug("Testing DNS server" + server);
133+
Logger.debug("Testing DNS server " + server);
134134
testText.append(getString(R.string.test_domain)).append(" ").append(domain).append("\n").append(getString(R.string.test_dns_server)).append(" ").append(server);
135135

136136
mHandler.obtainMessage(DnsTestHandler.MSG_DISPLAY_STATUS, testText.toString()).sendToTarget();

app/src/main/java/org/itxtech/daedalus/util/Configurations.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ public int getUsingRuleType() {
125125
public static Configurations load(File file) {
126126
Configurations.file = file;
127127
Configurations config = null;
128-
try {
129-
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
130-
Logger.info("Loading configuration successfully from " + file);
131-
} catch (Exception e) {
132-
Logger.logException(e);
128+
if (file.exists()) {
129+
try {
130+
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
131+
Logger.info("Loading configuration successfully from " + file);
132+
} catch (Exception e) {
133+
Logger.logException(e);
134+
}
133135
}
134136

135137
if (config == null) {

0 commit comments

Comments
 (0)