forked from Archives/Athou_commafeed
remove more warnings
This commit is contained in:
@@ -2,6 +2,7 @@ package com.commafeed.backend.feed.parser;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import lombok.experimental.UtilityClass;
|
import lombok.experimental.UtilityClass;
|
||||||
@@ -9,8 +10,7 @@ import lombok.experimental.UtilityClass;
|
|||||||
@UtilityClass
|
@UtilityClass
|
||||||
class HtmlEntities {
|
class HtmlEntities {
|
||||||
public static final Map<String, String> HTML_TO_NUMERIC_MAP;
|
public static final Map<String, String> HTML_TO_NUMERIC_MAP;
|
||||||
public static final String[] HTML_ENTITIES;
|
public static final List<String> HTML_ENTITIES;
|
||||||
public static final String[] NUMERIC_ENTITIES;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
@@ -266,7 +266,6 @@ class HtmlEntities {
|
|||||||
map.put("‌", "‌");
|
map.put("‌", "‌");
|
||||||
|
|
||||||
HTML_TO_NUMERIC_MAP = Collections.unmodifiableMap(map);
|
HTML_TO_NUMERIC_MAP = Collections.unmodifiableMap(map);
|
||||||
HTML_ENTITIES = map.keySet().toArray(new String[0]);
|
HTML_ENTITIES = List.copyOf(map.keySet());
|
||||||
NUMERIC_ENTITIES = map.values().toArray(new String[0]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,19 +23,13 @@ public class FeedService {
|
|||||||
|
|
||||||
private final FeedDAO feedDAO;
|
private final FeedDAO feedDAO;
|
||||||
private final List<AbstractFaviconFetcher> faviconFetchers;
|
private final List<AbstractFaviconFetcher> faviconFetchers;
|
||||||
|
|
||||||
private final Favicon defaultFavicon;
|
private final Favicon defaultFavicon;
|
||||||
|
|
||||||
public FeedService(FeedDAO feedDAO, @All List<AbstractFaviconFetcher> faviconFetchers) {
|
public FeedService(FeedDAO feedDAO, @All List<AbstractFaviconFetcher> faviconFetchers) throws IOException {
|
||||||
this.feedDAO = feedDAO;
|
this.feedDAO = feedDAO;
|
||||||
this.faviconFetchers = faviconFetchers;
|
this.faviconFetchers = faviconFetchers;
|
||||||
|
this.defaultFavicon = new Favicon(
|
||||||
try {
|
Resources.toByteArray(Objects.requireNonNull(getClass().getResource("/images/default_favicon.gif"))), "image/gif");
|
||||||
defaultFavicon = new Favicon(
|
|
||||||
Resources.toByteArray(Objects.requireNonNull(getClass().getResource("/images/default_favicon.gif"))), "image/gif");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("could not load default favicon", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Feed findOrCreate(String url) {
|
public synchronized Feed findOrCreate(String url) {
|
||||||
|
|||||||
@@ -113,10 +113,8 @@ class OPMLExporterTest {
|
|||||||
|
|
||||||
private boolean containsCategory(List<Outline> outlines, String category) {
|
private boolean containsCategory(List<Outline> outlines, String category) {
|
||||||
for (Outline o : outlines) {
|
for (Outline o : outlines) {
|
||||||
if (!"rss".equals(o.getType())) {
|
if (!"rss".equals(o.getType()) && category.equals(o.getTitle())) {
|
||||||
if (category.equals(o.getTitle())) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,10 +123,8 @@ class OPMLExporterTest {
|
|||||||
|
|
||||||
private boolean containsFeed(List<Outline> outlines, String title, String url) {
|
private boolean containsFeed(List<Outline> outlines, String title, String url) {
|
||||||
for (Outline o : outlines) {
|
for (Outline o : outlines) {
|
||||||
if ("rss".equals(o.getType())) {
|
if ("rss".equals(o.getType()) && title.equals(o.getTitle()) && o.getAttributeValue("xmlUrl").equals(url)) {
|
||||||
if (title.equals(o.getTitle()) && o.getAttributeValue("xmlUrl").equals(url)) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user