Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java

Issue 29453722: Noissue - Lint adjustments and optimizations (Closed)
Patch Set: Adjustments based on review comments Created June 13, 2017, 9:23 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
===================================================================
--- a/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
+++ b/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
@@ -22,16 +22,17 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.adblockplus.sbrowser.contentblocker.engine.Subscription.Type;
import android.util.Log;
/**
* This class holds all listed subscriptions and manages the subscription
@@ -45,36 +46,36 @@ final class Subscriptions
// Filters that begin with '|$' , '||$' , '@@|$' or '@@||$'
// See https://issues.adblockplus.org/ticket/4772
private static final String UNSUPPORTED_FILTERS_REGEX = "^(\\|\\$|\\|\\|\\$|@@\\|\\$|@@\\|\\|\\$).*";
private final HashMap<String, Subscription> subscriptions = new HashMap<>();
private final Engine engine;
private final File subscriptionFolder;
private final File cacheFolder;
- private final boolean wasUnitialized;
+ private final boolean wasUninitialized;
private Subscriptions(final Engine engine, final File appFolder, final File cacheFolder)
{
this.engine = engine;
this.subscriptionFolder = appFolder;
- this.wasUnitialized = !this.subscriptionFolder.exists();
+ this.wasUninitialized = !this.subscriptionFolder.exists();
this.cacheFolder = cacheFolder;
}
public boolean wasUnitialized()
{
- return this.wasUnitialized;
+ return this.wasUninitialized;
}
public File createAndWriteFile() throws IOException
{
for (;;)
{
- final File file = new File(this.cacheFolder, String.format("tmp-%d.txt",
+ final File file = new File(this.cacheFolder, String.format(Locale.ENGLISH, "tmp-%d.txt",
(int) (Math.random() * 1e8)));
if (!file.exists())
{
Log.d(TAG, "Writing filters to " + file);
this.writeFile(file);
return file;
}
}
@@ -85,17 +86,17 @@ final class Subscriptions
final ArrayList<SubscriptionInfo> subs = new ArrayList<>();
for (final Subscription sub : this.subscriptions.values())
{
subs.add(SubscriptionInfo.create(engine, sub));
}
return subs;
}
- void getSubscriptions(final List<Subscription> list)
+ void loadSubscriptions(final List<Subscription> list)
{
list.addAll(this.subscriptions.values());
}
public boolean hasSubscription(final String id)
{
return this.subscriptions.containsKey(id);
}

Powered by Google App Engine
This is Rietveld