Fixed SpotBugs violations, so that at least the most severe checks pass
This commit is contained in:
parent
3946f986d7
commit
71184ee5d4
|
@ -94,8 +94,5 @@ workflows:
|
||||||
name: SpotBugs
|
name: SpotBugs
|
||||||
build-steps:
|
build-steps:
|
||||||
- run:
|
- run:
|
||||||
name: SpotBugs (Modules with Play flavour)
|
name: SpotBugs
|
||||||
command: ./gradlew spotbugsPlayDebug | grep "\[SpotBugs\]"
|
command: ./gradlew spotbugsPlayDebug spotbugsDebug 2>&1 | grep -i "spotbugs"
|
||||||
- run:
|
|
||||||
name: SpotBugs (Modules without Play flavour)
|
|
||||||
command: ./gradlew spotbugsDebug | grep "\[SpotBugs\]"
|
|
||||||
|
|
|
@ -188,7 +188,9 @@ public class MainActivity extends CastEnabledActivity {
|
||||||
|
|
||||||
public void setupToolbarToggle(@NonNull Toolbar toolbar, boolean displayUpArrow) {
|
public void setupToolbarToggle(@NonNull Toolbar toolbar, boolean displayUpArrow) {
|
||||||
if (drawerLayout != null) { // Tablet layout does not have a drawer
|
if (drawerLayout != null) { // Tablet layout does not have a drawer
|
||||||
drawerLayout.removeDrawerListener(drawerToggle);
|
if (drawerToggle != null) {
|
||||||
|
drawerLayout.removeDrawerListener(drawerToggle);
|
||||||
|
}
|
||||||
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
|
drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar,
|
||||||
R.string.drawer_open, R.string.drawer_close);
|
R.string.drawer_open, R.string.drawer_close);
|
||||||
drawerLayout.addDrawerListener(drawerToggle);
|
drawerLayout.addDrawerListener(drawerToggle);
|
||||||
|
|
|
@ -58,9 +58,8 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder>
|
||||||
*/
|
*/
|
||||||
public static final String SUBSCRIPTION_LIST_TAG = "SubscriptionList";
|
public static final String SUBSCRIPTION_LIST_TAG = "SubscriptionList";
|
||||||
|
|
||||||
private static List<String> fragmentTags;
|
private final List<String> fragmentTags = new ArrayList<>();
|
||||||
private static String[] titles;
|
private final String[] titles;
|
||||||
|
|
||||||
private final ItemAccess itemAccess;
|
private final ItemAccess itemAccess;
|
||||||
private final WeakReference<Activity> activity;
|
private final WeakReference<Activity> activity;
|
||||||
public boolean showSubscriptionList = true;
|
public boolean showSubscriptionList = true;
|
||||||
|
@ -98,7 +97,8 @@ public class NavListAdapter extends RecyclerView.Adapter<NavListAdapter.Holder>
|
||||||
showSubscriptionList = false;
|
showSubscriptionList = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fragmentTags = newTags;
|
fragmentTags.clear();
|
||||||
|
fragmentTags.addAll(newTags);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class ProxyDialog {
|
||||||
|
|
||||||
private boolean checkPort() {
|
private boolean checkPort() {
|
||||||
int port = getPort();
|
int port = getPort();
|
||||||
if(port < 0 && port > 65535) {
|
if (port < 0 || port > 65535) {
|
||||||
etPort.setError(context.getString(R.string.proxy_port_invalid_error));
|
etPort.setError(context.getString(R.string.proxy_port_invalid_error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class PodcastSearcherRegistry {
|
||||||
private PodcastSearcherRegistry() {
|
private PodcastSearcherRegistry() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SearcherInfo> getSearchProviders() {
|
public static synchronized List<SearcherInfo> getSearchProviders() {
|
||||||
if (searchProviders == null) {
|
if (searchProviders == null) {
|
||||||
searchProviders = new ArrayList<>();
|
searchProviders = new ArrayList<>();
|
||||||
searchProviders.add(new SearcherInfo(new CombinedSearcher(), 1.0f));
|
searchProviders.add(new SearcherInfo(new CombinedSearcher(), 1.0f));
|
||||||
|
|
|
@ -7,7 +7,6 @@ import de.danoeh.antennapod.BuildConfig;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -40,7 +39,7 @@ public class CrashReportWriter implements Thread.UncaughtExceptionHandler {
|
||||||
File path = getFile();
|
File path = getFile();
|
||||||
PrintWriter out = null;
|
PrintWriter out = null;
|
||||||
try {
|
try {
|
||||||
out = new PrintWriter(new FileWriter(path));
|
out = new PrintWriter(path, "UTF-8");
|
||||||
out.println("## Crash info");
|
out.println("## Crash info");
|
||||||
out.println("Time: " + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault()).format(new Date()));
|
out.println("Time: " + new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault()).format(new Date()));
|
||||||
out.println("AntennaPod version: " + BuildConfig.VERSION_NAME);
|
out.println("AntennaPod version: " + BuildConfig.VERSION_NAME);
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class AllEpisodesFragment extends EpisodesListFragment {
|
||||||
private static final String PREF_NAME = "PrefAllEpisodesFragment";
|
private static final String PREF_NAME = "PrefAllEpisodesFragment";
|
||||||
private static final String PREF_FILTER = "filter";
|
private static final String PREF_FILTER = "filter";
|
||||||
|
|
||||||
private static FeedItemFilter feedItemFilter = new FeedItemFilter("");
|
private FeedItemFilter feedItemFilter = new FeedItemFilter("");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package de.danoeh.antennapod.fragment.gpodnet;
|
package de.danoeh.antennapod.fragment.gpodnet;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.sync.gpoddernet.GpodnetService;
|
import de.danoeh.antennapod.core.sync.gpoddernet.GpodnetService;
|
||||||
import de.danoeh.antennapod.core.sync.gpoddernet.GpodnetServiceException;
|
import de.danoeh.antennapod.core.sync.gpoddernet.GpodnetServiceException;
|
||||||
import de.danoeh.antennapod.core.sync.gpoddernet.model.GpodnetPodcast;
|
import de.danoeh.antennapod.core.sync.gpoddernet.model.GpodnetPodcast;
|
||||||
import de.danoeh.antennapod.core.sync.gpoddernet.model.GpodnetTag;
|
import de.danoeh.antennapod.core.sync.gpoddernet.model.GpodnetTag;
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
|
|
||||||
import de.danoeh.antennapod.activity.MainActivity;
|
import de.danoeh.antennapod.activity.MainActivity;
|
||||||
|
|
||||||
|
@ -24,8 +24,7 @@ public class TagFragment extends PodcastListFragment {
|
||||||
|
|
||||||
private GpodnetTag tag;
|
private GpodnetTag tag;
|
||||||
|
|
||||||
public static TagFragment newInstance(GpodnetTag tag) {
|
public static TagFragment newInstance(@NonNull GpodnetTag tag) {
|
||||||
Validate.notNull(tag);
|
|
||||||
TagFragment fragment = new TagFragment();
|
TagFragment fragment = new TagFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable("tag", tag);
|
args.putParcelable("tag", tag);
|
||||||
|
@ -38,7 +37,9 @@ public class TagFragment extends PodcastListFragment {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
Validate.isTrue(args != null && args.getParcelable("tag") != null, "args invalid");
|
if (args == null || args.getParcelable("tag") == null) {
|
||||||
|
throw new IllegalArgumentException("Arguments not given");
|
||||||
|
}
|
||||||
tag = args.getParcelable("tag");
|
tag = args.getParcelable("tag");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class DevelopersFragment extends ListFragment {
|
||||||
developersLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
developersLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
||||||
ArrayList<SimpleIconListAdapter.ListItem> developers = new ArrayList<>();
|
ArrayList<SimpleIconListAdapter.ListItem> developers = new ArrayList<>();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||||
getContext().getAssets().open("developers.csv")));
|
getContext().getAssets().open("developers.csv"), "UTF-8"));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
String[] info = line.split(";");
|
String[] info = line.split(";");
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class LicensesFragment extends ListFragment {
|
||||||
private void showLicenseText(String licenseTextFile) {
|
private void showLicenseText(String licenseTextFile) {
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||||
getContext().getAssets().open(licenseTextFile)));
|
getContext().getAssets().open(licenseTextFile), "UTF-8"));
|
||||||
StringBuilder licenseText = new StringBuilder();
|
StringBuilder licenseText = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class SpecialThanksFragment extends ListFragment {
|
||||||
translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
||||||
ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
|
ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||||
getContext().getAssets().open("special_thanks.csv")));
|
getContext().getAssets().open("special_thanks.csv"), "UTF-8"));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
String[] info = line.split(";");
|
String[] info = line.split(";");
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class TranslatorsFragment extends ListFragment {
|
||||||
translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
||||||
ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
|
ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||||
getContext().getAssets().open("translators.csv")));
|
getContext().getAssets().open("translators.csv"), "UTF-8"));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
String[] info = line.split(";");
|
String[] info = line.split(";");
|
||||||
|
|
|
@ -1,13 +1,39 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<FindBugsFilter>
|
<FindBugsFilter>
|
||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="v WEAK_MESSAGE_DIGEST_MD5"/>
|
<Bug pattern="DM_DEFAULT_ENCODING"/>
|
||||||
|
<Class name="de.danoeh.antennapod.core.util.vorbiscommentreader.VorbisCommentReader"/>
|
||||||
</Match>
|
</Match>
|
||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="v LI_LAZY_INIT_UPDATE_STATIC"/>
|
<Bug pattern="MS_MUTABLE_ARRAY"/>
|
||||||
|
<Class name="de.danoeh.antennapod.fragment.NavDrawerFragment"/>
|
||||||
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="MS_SHOULD_BE_FINAL"/>
|
||||||
|
<Class name="de.danoeh.antennapod.core.ClientConfig"/>
|
||||||
</Match>
|
</Match>
|
||||||
<Match>
|
<Match>
|
||||||
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
|
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS"/>
|
||||||
<Class name="de.danoeh.antennapod.menuhandler.MenuItemUtils"/>
|
<Class name="de.danoeh.antennapod.menuhandler.MenuItemUtils"/>
|
||||||
</Match>
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="NP_NONNULL_PARAM_VIOLATION"/>
|
||||||
|
<Class name="de.danoeh.antennapod.activity.MainActivity"/>
|
||||||
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
|
||||||
|
<Class name="de.danoeh.antennapod.activity.MainActivity"/>
|
||||||
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="NP_NULL_ON_SOME_PATH"/>
|
||||||
|
<Class name="de.danoeh.antennapod.core.feed.FeedMedia"/>
|
||||||
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"/>
|
||||||
|
<Class name="de.danoeh.antennapod.dialog.PlaybackControlsDialog"/>
|
||||||
|
</Match>
|
||||||
|
<Match>
|
||||||
|
<Bug pattern="NP_NULL_PARAM_DEREF"/>
|
||||||
|
<Class name="de.danoeh.antennapod.core.feed.FeedMedia"/>
|
||||||
|
</Match>
|
||||||
</FindBugsFilter>
|
</FindBugsFilter>
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class FeedItem extends FeedComponent implements Serializable {
|
||||||
private Date pubDate;
|
private Date pubDate;
|
||||||
private FeedMedia media;
|
private FeedMedia media;
|
||||||
|
|
||||||
private Feed feed;
|
private transient Feed feed;
|
||||||
private long feedId;
|
private long feedId;
|
||||||
|
|
||||||
private int state;
|
private int state;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.danoeh.antennapod.core.glide;
|
package de.danoeh.antennapod.core.glide;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import com.bumptech.glide.Priority;
|
import com.bumptech.glide.Priority;
|
||||||
import com.bumptech.glide.load.DataSource;
|
import com.bumptech.glide.load.DataSource;
|
||||||
import com.bumptech.glide.load.Options;
|
import com.bumptech.glide.load.Options;
|
||||||
|
@ -36,7 +35,6 @@ public final class ChapterImageModelLoader implements ModelLoader<EmbeddedChapte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
@Override
|
||||||
public LoadData<ByteBuffer> buildLoadData(@NonNull EmbeddedChapterImage model,
|
public LoadData<ByteBuffer> buildLoadData(@NonNull EmbeddedChapterImage model,
|
||||||
int width,
|
int width,
|
||||||
|
@ -65,9 +63,9 @@ public final class ChapterImageModelLoader implements ModelLoader<EmbeddedChapte
|
||||||
if (image.getMedia().localFileAvailable()) {
|
if (image.getMedia().localFileAvailable()) {
|
||||||
File localFile = new File(image.getMedia().getLocalMediaUrl());
|
File localFile = new File(image.getMedia().getLocalMediaUrl());
|
||||||
stream = new BufferedInputStream(new FileInputStream(localFile));
|
stream = new BufferedInputStream(new FileInputStream(localFile));
|
||||||
stream.skip(image.getPosition());
|
IOUtils.skip(stream, image.getPosition());
|
||||||
byte[] imageContent = new byte[image.getLength()];
|
byte[] imageContent = new byte[image.getLength()];
|
||||||
stream.read(imageContent, 0, image.getLength());
|
IOUtils.read(stream, imageContent, 0, image.getLength());
|
||||||
callback.onDataReady(ByteBuffer.wrap(imageContent));
|
callback.onDataReady(ByteBuffer.wrap(imageContent));
|
||||||
} else {
|
} else {
|
||||||
Request.Builder httpReq = new Request.Builder();
|
Request.Builder httpReq = new Request.Builder();
|
||||||
|
@ -88,10 +86,13 @@ public final class ChapterImageModelLoader implements ModelLoader<EmbeddedChapte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void cleanup() {
|
@Override
|
||||||
|
public void cleanup() {
|
||||||
// nothing to clean up
|
// nothing to clean up
|
||||||
}
|
}
|
||||||
@Override public void cancel() {
|
|
||||||
|
@Override
|
||||||
|
public void cancel() {
|
||||||
// cannot cancel
|
// cannot cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.util.Log;
|
||||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
public class FastBlurTransformation extends BitmapTransformation {
|
public class FastBlurTransformation extends BitmapTransformation {
|
||||||
|
@ -43,7 +44,7 @@ public class FastBlurTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||||
messageDigest.update(TAG.getBytes());
|
messageDigest.update(TAG.getBytes(Charset.defaultCharset()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bitmap fastBlur(Bitmap bitmap, int radius) {
|
private static Bitmap fastBlur(Bitmap bitmap, int radius) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class AntennapodHttpClient {
|
||||||
SocketAddress address = InetSocketAddress.createUnresolved(config.host, port);
|
SocketAddress address = InetSocketAddress.createUnresolved(config.host, port);
|
||||||
Proxy proxy = new Proxy(config.type, address);
|
Proxy proxy = new Proxy(config.type, address);
|
||||||
builder.proxy(proxy);
|
builder.proxy(proxy);
|
||||||
if (!TextUtils.isEmpty(config.username)) {
|
if (!TextUtils.isEmpty(config.username) && config.password != null) {
|
||||||
String credentials = Credentials.basic(config.username, config.password);
|
String credentials = Credentials.basic(config.username, config.password);
|
||||||
builder.interceptors().add(chain -> {
|
builder.interceptors().add(chain -> {
|
||||||
Request request = chain.request().newBuilder()
|
Request request = chain.request().newBuilder()
|
||||||
|
|
|
@ -667,11 +667,11 @@ public class GpodnetService implements ISyncService {
|
||||||
while ((count = in.read(buffer)) > 0) {
|
while ((count = in.read(buffer)) > 0) {
|
||||||
outputStream.write(buffer, 0, count);
|
outputStream.write(buffer, 0, count);
|
||||||
}
|
}
|
||||||
|
return outputStream.toString("UTF-8");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new GpodnetServiceException(e);
|
throw new GpodnetServiceException(e);
|
||||||
}
|
}
|
||||||
return outputStream.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkStatusCode(@NonNull Response response) throws GpodnetServiceException {
|
private void checkStatusCode(@NonNull Response response) throws GpodnetServiceException {
|
||||||
|
|
|
@ -34,8 +34,7 @@ import java.util.regex.Pattern;
|
||||||
public class HtmlToPlainText {
|
public class HtmlToPlainText {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this method to strip off HTML encoding from given text
|
* Use this method to strip off HTML encoding from given text.
|
||||||
* <p>
|
|
||||||
* Replaces bullet points with *, ignores colors/bold/...
|
* Replaces bullet points with *, ignores colors/bold/...
|
||||||
*
|
*
|
||||||
* @param str String with any encoding
|
* @param str String with any encoding
|
||||||
|
@ -60,10 +59,8 @@ public class HtmlToPlainText {
|
||||||
* @return <b>True</b> if text contains any HTML tags<br /><b>False</b> is no HTML tag is found
|
* @return <b>True</b> if text contains any HTML tags<br /><b>False</b> is no HTML tag is found
|
||||||
*/
|
*/
|
||||||
private static boolean isHtml(String str) {
|
private static boolean isHtml(String str) {
|
||||||
final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>";
|
final String htmlTagPattern = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>";
|
||||||
Pattern htmlValidator = TextUtils.isEmpty(HTML_TAG_PATTERN) ? null : Pattern.compile(HTML_TAG_PATTERN);
|
return Pattern.compile(htmlTagPattern).matcher(str).find();
|
||||||
|
|
||||||
return htmlValidator.matcher(str).find();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue