remove more warnings

This commit is contained in:
Athou
2025-07-18 23:07:40 +02:00
parent 2eb7c7237e
commit 0f2de651ff
3 changed files with 10 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ package com.commafeed.backend.feed.parser;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import lombok.experimental.UtilityClass;
@@ -9,8 +10,7 @@ import lombok.experimental.UtilityClass;
@UtilityClass
class HtmlEntities {
public static final Map<String, String> HTML_TO_NUMERIC_MAP;
public static final String[] HTML_ENTITIES;
public static final String[] NUMERIC_ENTITIES;
public static final List<String> HTML_ENTITIES;
static {
Map<String, String> map = new LinkedHashMap<>();
@@ -266,7 +266,6 @@ class HtmlEntities {
map.put("&zwnj;", "&#8204;");
HTML_TO_NUMERIC_MAP = Collections.unmodifiableMap(map);
HTML_ENTITIES = map.keySet().toArray(new String[0]);
NUMERIC_ENTITIES = map.values().toArray(new String[0]);
HTML_ENTITIES = List.copyOf(map.keySet());
}
}

View File

@@ -23,19 +23,13 @@ public class FeedService {
private final FeedDAO feedDAO;
private final List<AbstractFaviconFetcher> faviconFetchers;
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.faviconFetchers = faviconFetchers;
try {
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);
}
this.defaultFavicon = new Favicon(
Resources.toByteArray(Objects.requireNonNull(getClass().getResource("/images/default_favicon.gif"))), "image/gif");
}
public synchronized Feed findOrCreate(String url) {

View File

@@ -113,10 +113,8 @@ class OPMLExporterTest {
private boolean containsCategory(List<Outline> outlines, String category) {
for (Outline o : outlines) {
if (!"rss".equals(o.getType())) {
if (category.equals(o.getTitle())) {
return true;
}
if (!"rss".equals(o.getType()) && category.equals(o.getTitle())) {
return true;
}
}
@@ -125,10 +123,8 @@ class OPMLExporterTest {
private boolean containsFeed(List<Outline> outlines, String title, String url) {
for (Outline o : outlines) {
if ("rss".equals(o.getType())) {
if (title.equals(o.getTitle()) && o.getAttributeValue("xmlUrl").equals(url)) {
return true;
}
if ("rss".equals(o.getType()) && title.equals(o.getTitle()) && o.getAttributeValue("xmlUrl").equals(url)) {
return true;
}
}