Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/develop-pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v1
with:
java-version: 21
java-version: 25
java-package: jdk+fx
- name: Cache local Maven repository
uses: actions/cache@v4
Expand Down Expand Up @@ -49,4 +49,4 @@ jobs:
target/*.jar
target/*.tar.*
target/*.zip
target/classes/THIRD-PARTY.txt
target/classes/THIRD-PARTY.txt
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v1
with:
java-version: 21
java-version: 25
java-package: jdk+fx
- name: Cache local Maven repository
uses: actions/cache@v4
Expand Down
11 changes: 7 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@
</scm>

<properties>
<argLine></argLine>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>4.0.1-SNAPSHOT</revision>
<maven.compiler.release>21</maven.compiler.release>
<maven.compiler.release>25</maven.compiler.release>

<assertj.version>3.27.7</assertj.version>
<byte-buddy.version>1.18.11</byte-buddy.version>
Expand All @@ -77,13 +78,13 @@
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version>
<maven-dependency-plugin.version>3.11.0</maven-dependency-plugin.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>
<maven-install-plugin.version>3.0.1</maven-install-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
<mockito.version>5.23.0</mockito.version>
<okhttp3.version>4.12.0</okhttp3.version>
<wiremock.version>3.13.2</wiremock.version>
Expand Down Expand Up @@ -339,6 +340,7 @@
<id>copy-dependencies</id>
<goals>
<goal>copy-dependencies</goal>
<goal>properties</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
Expand Down Expand Up @@ -406,10 +408,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>-javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar</argLine>
<parallel>classes</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
<perCoreThreadCount>true</perCoreThreadCount>
<!--suppress MavenModelInspection -->
<argLine>-javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar</argLine>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package de.mediathekview.mserver.base.config;

import com.yacl4j.core.ConfigurationBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;

/** A manager to load configurations. */
public abstract class ConfigManager<T extends ConfigDTO> {
private T config;
//private static final Logger LOG = LogManager.getLogger(ConfigManager.class);

protected abstract String getConfigFileName();

Expand Down Expand Up @@ -53,7 +49,7 @@ public String getResourcePath(String resourceName) {
ClassLoader classLoader = getClass().getClassLoader();
URL resourceUrl = classLoader.getResource(resourceName);
if (resourceUrl != null) {
Path resourcePath = Paths.get(resourceUrl.toURI());
Path resourcePath = Path.of(resourceUrl.toURI());
return resourcePath.toString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
int readCounter = 0;
Filmlist list = new Filmlist();
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT data FROM filme " + where + " ORDER BY data ->> 'sender', data ->> 'thema', data ->> 'titel' " + limit);
PreparedStatement ps = con.prepareStatement("SELECT data FROM filme " + where + " ORDER BY data ->> 'sender', data ->> 'thema', data ->> 'titel' " + limit)
) {
ps.setFetchSize(50000);
try (ResultSet rs = ps.executeQuery()) {
Expand Down Expand Up @@ -270,7 +270,7 @@
/**
* Speichert alle Filme einer Filmlist parallel in der DB.
*/
public void saveAll(Filmlist filmlist) throws Exception {

Check warning on line 273 in src/main/java/de/mediathekview/mserver/base/utils/FilmDBService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove or merge the dangling Javadoc comment(s).

See more on https://sonarcloud.io/project/issues?id=mediathekview_MServer&issues=AZ_JffFS3-8lVFx5GHNk&open=AZ_JffFS3-8lVFx5GHNk&pullRequest=1165
if(!PostgreSQLDataSourceProvider.isEnabled()) {
return;
}
Expand Down
25 changes: 12 additions & 13 deletions src/main/java/de/mediathekview/mserver/crawler/CrawlerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.util.*;
import java.util.Map.Entry;
Expand Down Expand Up @@ -110,11 +109,11 @@ public void copyFilmlist() {
for (final Entry<FilmlistFormats, String> copyEntry :
copySettings.getCopyTargetFilePaths().entrySet()) {
copyFilmlist(
copyEntry.getKey(), new FileCopyTarget(Paths.get(copyEntry.getValue())), false);
copyEntry.getKey(), new FileCopyTarget(Path.of(copyEntry.getValue())), false);
}
for (final Entry<FilmlistFormats, String> copyEntry :
copySettings.getCopyTargetDiffFilePaths().entrySet()) {
copyFilmlist(copyEntry.getKey(), new FileCopyTarget(Paths.get(copyEntry.getValue())), true);
copyFilmlist(copyEntry.getKey(), new FileCopyTarget(Path.of(copyEntry.getValue())), true);
}
}
}
Expand All @@ -134,7 +133,7 @@ public void copyFilmlist(
}

if (formats.contains(aFilmlistFormat)) {
copyFilmlist(Paths.get(paths.get(aFilmlistFormat)), aFileCopyTarget);
copyFilmlist(Path.of(paths.get(aFilmlistFormat)), aFileCopyTarget);
} else {
printMessage(ServerMessages.FORMAT_NOT_IN_SAVE_FORMATS, aFilmlistFormat);
}
Expand Down Expand Up @@ -234,7 +233,7 @@ public void importFilmlist(final ImportFilmlistConfiguration importFilmlistConfi
* MServerConfigDTO#getFilmlistSavePaths()}.
*/
public void saveDifferenceFilmlist() {
config.getFilmlistDiffSavePaths().forEach((key, value) -> saveFilmlist(Paths.get(value), key, true));
config.getFilmlistDiffSavePaths().forEach((key, value) -> saveFilmlist(Path.of(value), key, true));
}

/**
Expand All @@ -246,7 +245,7 @@ public void saveFilmlist() {
if (checkConfigForFilmlistSave()) {
config
.getFilmlistSaveFormats()
.forEach(f -> saveFilmlist(Paths.get(config.getFilmlistSavePaths().get(f)), f));
.forEach(f -> saveFilmlist(Path.of(config.getFilmlistSavePaths().get(f)), f));
}
}

Expand Down Expand Up @@ -277,7 +276,7 @@ public void saveFilmlist(
if (parentDir != null) {
try {
Files.createDirectories(parentDir);
} catch (final IOException ioException) {
} catch (final IOException _) {
LOG.debug("Can't create the parent directories!");
printMessage(ServerMessages.FILMLIST_SAVE_PATH_INVALID, filmlistFilePath.toString());
return;
Expand Down Expand Up @@ -436,7 +435,7 @@ public void shutdown() {
}

private Path filterPath(final Path aSavePath) {
return Paths.get(aSavePath.toString().replaceFirst(HOME_PATTERN, USER_HOME_PATH));
return Path.of(aSavePath.toString().replaceFirst(HOME_PATTERN, USER_HOME_PATH));
}

private Set<AbstractCrawler> getCrawlerToRun() {
Expand All @@ -459,15 +458,15 @@ private Set<AbstractCrawler> getCrawlerToRun() {
return crawlerToRun;
}

private Optional<Filmlist> importFilmlistFromDB() throws IOException {
private Optional<Filmlist> importFilmlistFromDB() {
FilmDBService filmDBService = new FilmDBService(getExecutorService(), getConfigManager().getConfig().getDatabaseConfig().getBatchSize(), getConfigManager().getConfig().getDatabaseConfig().getRefreshIntervalInDays());
Optional<Filmlist> dbFilmlist = filmDBService.readFilmlistFromDB();
return dbFilmlist;
}

private Optional<Filmlist> importFilmlistFromFile(
final FilmlistFormats aFormat, final String aFilmlistLocation) throws IOException {
final Path filmlistPath = Paths.get(aFilmlistLocation);
final Path filmlistPath = Path.of(aFilmlistLocation);
if (checkFilmlistImportFile(filmlistPath)) {
filmlistManager.addAllMessageListener(messageListeners);
return filmlistManager.importList(aFormat, filmlistPath);
Expand All @@ -480,7 +479,7 @@ private Optional<Filmlist> importFilmListFromURl(
try {
filmlistManager.addAllMessageListener(messageListeners);
return filmlistManager.importList(aFormat, new URI(aFilmlistLocation).toURL());
} catch (final MalformedURLException | URISyntaxException malformedURLException) {
} catch (final MalformedURLException | URISyntaxException _) {
printMessage(ServerMessages.FILMLIST_IMPORT_URL_INVALID, aFilmlistLocation);
}
return Optional.empty();
Expand All @@ -489,7 +488,7 @@ private Optional<Filmlist> importFilmListFromURl(
public void writeHashFile() {
if (Boolean.TRUE.equals(config.getWriteFilmlistHashFileEnabled())) {
final Path hashFilePath =
filterPath(Paths.get(config.getFilmlistHashFilePath())).toAbsolutePath();
filterPath(Path.of(config.getFilmlistHashFilePath())).toAbsolutePath();
if (!Files.exists(hashFilePath.getParent())
|| !Files.isWritable(hashFilePath.getParent())
|| !filmlistManager.writeHashFile(filmlist, hashFilePath)) {
Expand All @@ -501,7 +500,7 @@ public void writeHashFile() {
public void writeIdFile() {
if (Boolean.TRUE.equals(config.getWriteFilmlistIdFileEnabled())) {
final Path idFilePath =
filterPath(Paths.get(config.getFilmlistIdFilePath())).toAbsolutePath();
filterPath(Path.of(config.getFilmlistIdFilePath())).toAbsolutePath();
if (!Files.exists(idFilePath.getParent())
|| !Files.isWritable(idFilePath.getParent())
|| !filmlistManager.writeIdFile(filmlist, idFilePath)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
package de.mediathekview.mserver.crawler.ard;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand All @@ -32,7 +25,7 @@
Map<Resolution, String> proposal = buildFilmUrlFromAdaptive(adaptive, allUrls.entrySet().stream().findFirst().get().getValue());

if(proposal.size() != allUrls.size() && !adaptive.contains("arte.")) {
System.out.println("asdf");
LOG.debug("asdf");
Map<Integer, String> x = buildFromUrl(adaptive, allUrls.entrySet().stream().findFirst().get().getValue());
StringBuffer sb = new StringBuffer();
sb.append("#").append(adaptive).append("#").append(printMap(proposal)).append("#vs#").append(printMap(allUrls));
Expand Down Expand Up @@ -133,7 +126,7 @@
int horizontal = Integer.parseInt(dims[0]);
int vertical = Integer.parseInt(dims[1]);
resolutions.add(new int[] { horizontal, vertical });
} catch (NumberFormatException e) {

Check warning on line 129 in src/main/java/de/mediathekview/mserver/crawler/ard/UrlOptimizer.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "e" with an unnamed pattern.

See more on https://sonarcloud.io/project/issues?id=mediathekview_MServer&issues=AZ_JffDX3-8lVFx5GHNh&open=AZ_JffDX3-8lVFx5GHNh&pullRequest=1165
resolutions.add(new int[] { 0, 0 });
}
}
Expand All @@ -148,7 +141,7 @@
// ----------------------------------------------------------------------------------------------------------------------------------------------------

public Map<Resolution, String> buildFilmUrlFromAdaptive(String adaptive, String aUrl) {
Map<Resolution, String> result = new HashMap<>();
Map<Resolution, String> result = new EnumMap<>(Resolution.class);
Map<Integer, String> rawStringUrlMap = buildFromUrl(adaptive, aUrl);
rawStringUrlMap.forEach( (resolutionVertical, url) -> {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package de.mediathekview.mserver.crawler.arte.tasks;

import java.io.Serial;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
Expand Down Expand Up @@ -30,7 +30,7 @@


public class ArteDtoVideo2FilmTask extends AbstractRecursiveConverterTask<Film, ArteVideoInfoDto> {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;
protected final transient Logger log = LogManager.getLogger(this.getClass());

private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX");
Expand Down Expand Up @@ -178,7 +178,7 @@
}
try {
return URI.create(aElement.getWebsite().get()).toURL();
} catch (MalformedURLException e) {

Check warning on line 181 in src/main/java/de/mediathekview/mserver/crawler/arte/tasks/ArteDtoVideo2FilmTask.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "e" with an unnamed pattern.

See more on https://sonarcloud.io/project/issues?id=mediathekview_MServer&issues=AZ_JffEd3-8lVFx5GHNj&open=AZ_JffEd3-8lVFx5GHNj&pullRequest=1165
log.error("Invalid url: {}", aElement.getWebsite().get());
}
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package de.mediathekview.mserver.crawler.arte.tasks;

import java.io.Serial;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.Optional;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.google.gson.JsonDeserializer;
import com.google.gson.reflect.TypeToken;

Expand All @@ -25,8 +22,7 @@

public class ArteVideoInfoTask
extends AbstractJsonRestTask<ArteVideoInfoDto, PagedElementListDTO<ArteVideoInfoDto>, TopicUrlDTO> {
private static final long serialVersionUID = 1L;
protected final transient Logger log = LogManager.getLogger(this.getClass());
@Serial private static final long serialVersionUID = 1L;
protected Optional<AbstractRecursiveConverterTask<ArteVideoInfoDto, TopicUrlDTO>> nextPageTask = Optional.empty();
protected int maxSubpages;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package de.mediathekview.mserver.crawler.arte.tasks;

import java.io.Serial;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.List;
import java.util.Queue;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.google.gson.JsonDeserializer;
import com.google.gson.reflect.TypeToken;

Expand All @@ -24,10 +21,8 @@

public class ArteVideoLinkTask
extends AbstractJsonRestTask<ArteVideoInfoDto, List<ArteVideoLinkDto>, ArteVideoInfoDto> {
private static final long serialVersionUID = 1L;
protected final transient Logger log = LogManager.getLogger(this.getClass());
@Serial private static final long serialVersionUID = 1L;


public ArteVideoLinkTask(AbstractCrawler crawler, Queue<ArteVideoInfoDto> videoInfo) {
super(crawler, videoInfo, ArteConstants.API_TOKEN);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.jsoup.nodes.Document;

import java.io.IOException;
import java.io.Serial;
import java.util.Queue;

/**
Expand All @@ -22,7 +23,7 @@
*/
public abstract class AbstractDocumentTask<T, D extends CrawlerUrlDTO>
extends AbstractUrlTask<T, D> {
private static final long serialVersionUID = -4124779055395250981L;
@Serial private static final long serialVersionUID = -4124779055395250981L;
private static final Logger LOG = LogManager.getLogger(AbstractDocumentTask.class);
private static final String LOAD_DOCUMENT_ERRORTEXTPATTERN =
"Something terrible happened while crawl the %s page \"%s\".";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import jakarta.ws.rs.client.Invocation.Builder;
import jakarta.ws.rs.client.WebTarget;
import jakarta.ws.rs.core.Response;
import java.io.Serial;
import java.lang.reflect.Type;
import java.net.URI;
import java.nio.charset.StandardCharsets;
Expand All @@ -24,7 +25,7 @@
extends AbstractRestTask<T, D> {
protected final transient Logger log = LogManager.getLogger(this.getClass());
protected static final String ENCODING_GZIP = "gzip";
private static final long serialVersionUID = -1090560363478964885L;
@Serial private static final long serialVersionUID = -1090560363478964885L;
protected final transient GsonBuilder gsonBuilder;

protected AbstractJsonRestTask(
Expand Down Expand Up @@ -101,7 +102,7 @@
try {
long seconds = Long.parseLong(retryAfter);
return Optional.of(seconds * 1000);
} catch (NumberFormatException e) {

Check warning on line 105 in src/main/java/de/mediathekview/mserver/crawler/basic/AbstractJsonRestTask.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "e" with an unnamed pattern.

See more on https://sonarcloud.io/project/issues?id=mediathekview_MServer&issues=AZ_JffDs3-8lVFx5GHNi&open=AZ_JffDs3-8lVFx5GHNi&pullRequest=1165
return Optional.empty();
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.mediathekview.mserver.crawler.basic;

import de.mediathekview.mserver.base.config.MServerBasicConfigDTO;
import java.io.Serial;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand All @@ -20,7 +21,7 @@
*/
public abstract class AbstractRecursiveConverterTask<T, D> extends RecursiveTask<Set<T>> {
private static final Logger LOG = LogManager.getLogger(AbstractRecursiveConverterTask.class);
private static final long serialVersionUID = 8416254950859957820L;
@Serial private static final long serialVersionUID = 8416254950859957820L;

private final transient Queue<D> elementsToProcess;

Expand Down
Loading
Loading