@@ -108,7 +108,7 @@ private void load() {
108108 for (String hostsFile : hostsFiles ) {
109109 File file = new File (hostsFile );
110110 if (file .canRead ()) {
111- Logger .info ("Loading hosts from " + file . toString () );
111+ Logger .info ("Loading hosts from " + file );
112112 FileInputStream stream = new FileInputStream (file );
113113 BufferedReader dataIO = new BufferedReader (new InputStreamReader (stream ));
114114 String strLine ;
@@ -136,7 +136,7 @@ private void load() {
136136 for (String dnsmasqFile : dnsmasqFiles ) {
137137 File file = new File (dnsmasqFile );
138138 if (file .canRead ()) {
139- Logger .info ("Loading DNSMasq configuration from " + file . toString () );
139+ Logger .info ("Loading DNSMasq configuration from " + file );
140140 FileInputStream stream = new FileInputStream (file );
141141 BufferedReader dataIO = new BufferedReader (new InputStreamReader (stream ));
142142 String strLine ;
@@ -145,14 +145,21 @@ private void load() {
145145 while ((strLine = dataIO .readLine ()) != null ) {
146146 if (!strLine .equals ("" ) && !strLine .startsWith ("#" )) {
147147 data = strLine .split ("/" );
148- if (data .length == 3 && data [0 ].equals ("address=" )) {
148+ if (data .length >= 2 && data [0 ].equals ("address=" )) {
149+ if (data .length == 2 ) {
150+ rulesA .put (data [1 ], "0.0.0.0" );
151+ count ++;
152+ continue ;
153+ }
149154 if (data [1 ].startsWith ("." )) {
150155 data [1 ] = data [1 ].substring (1 );
151156 }
152157 if (strLine .contains (":" )) {//IPv6
153158 rulesAAAA .put (data [1 ], data [2 ]);
154159 } else if (strLine .contains ("." )) {//IPv4
155160 rulesA .put (data [1 ], data [2 ]);
161+ } else {
162+ rulesA .put (data [1 ], "0.0.0.0" );
156163 }
157164 count ++;
158165 }
0 commit comments