diff --git a/src/acr/browser/lightning/AdBlock.java b/src/acr/browser/lightning/AdBlock.java index e5a679b..fd930ea 100644 --- a/src/acr/browser/lightning/AdBlock.java +++ b/src/acr/browser/lightning/AdBlock.java @@ -10,21 +10,19 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.net.URI; import java.net.URISyntaxException; +import java.util.SortedMap; import java.util.TreeMap; public class AdBlock { - private static TreeMap mAdBlockMap = null; + private static SortedMap mAdBlockMap = + new TreeMap(String.CASE_INSENSITIVE_ORDER); private SharedPreferences mPreferences; - private boolean mBlockAds = false; + private boolean mBlockAds; public AdBlock(Context context) { - if (mAdBlockMap == null) { - mAdBlockMap = new TreeMap( - String.CASE_INSENSITIVE_ORDER); - } if (mAdBlockMap.isEmpty()) { fillSearchTree(context); } @@ -68,7 +66,7 @@ public class AdBlock { if (!mBlockAds) { return false; } - String domain = ""; + String domain; try { domain = getDomainName(url); } catch (URISyntaxException e) { @@ -79,7 +77,7 @@ public class AdBlock { } private static String getDomainName(String url) throws URISyntaxException { - int index = url.indexOf("/", 8); + int index = url.indexOf('/', 8); if (index != -1) { url = url.substring(0, index); }