diff --git a/build.gradle b/build.gradle index 984deacb8..d0c09a7ab 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,7 @@ apply from: "${project.rootDir}/gradle/eclipse.gradle" sourceCompatibility = 1.8 targetCompatibility = 1.8 group = 'de.mediathekview' -version = '3.1.14' +version = '3.1.15' def jarName = 'MServer.jar' def mainClass = 'mServer.Main' diff --git a/src/main/java/mServer/crawler/sender/newsearch/NoDownloadInformationException.java b/src/main/java/mServer/crawler/sender/newsearch/NoDownloadInformationException.java new file mode 100644 index 000000000..0257a7899 --- /dev/null +++ b/src/main/java/mServer/crawler/sender/newsearch/NoDownloadInformationException.java @@ -0,0 +1,9 @@ +package mServer.crawler.sender.newsearch; + +public class NoDownloadInformationException extends Exception +{ + public NoDownloadInformationException() + { + super("A film without any download information was found."); + } +} diff --git a/src/main/java/mServer/crawler/sender/newsearch/ZDFEntryDTODeserializer.java b/src/main/java/mServer/crawler/sender/newsearch/ZDFEntryDTODeserializer.java index d0ec3a778..249bb00a3 100644 --- a/src/main/java/mServer/crawler/sender/newsearch/ZDFEntryDTODeserializer.java +++ b/src/main/java/mServer/crawler/sender/newsearch/ZDFEntryDTODeserializer.java @@ -63,15 +63,20 @@ public ZDFEntryDTO deserialize(final JsonElement aJsonElement, final Type aTypeO return dto; } - private ZDFEntryDTO buildZDFEntryDTO(JsonObject aTargetObject, final JsonObject aMainVideoContentObject) + private ZDFEntryDTO buildZDFEntryDTO(JsonObject aTargetObject, final JsonObject aMainVideoContentObject) throws NoDownloadInformationException { JsonObject elementTargetObject = aMainVideoContentObject.getAsJsonObject(JSON_OBJ_ELEMENT_TARGET); final JsonElement entryGeneralInformationUrlElement = aTargetObject.get(JSON_ELEMENT_GENERAL_INFORMATION_URL); - final JsonElement entryDownloadInformationUrlElement = elementTargetObject.get(JSON_ELEMENT_DOWNLOAD_INFORMATION_URL); + if(elementTargetObject.has(JSON_ELEMENT_DOWNLOAD_INFORMATION_URL)) + { + final JsonElement entryDownloadInformationUrlElement = elementTargetObject.get(JSON_ELEMENT_DOWNLOAD_INFORMATION_URL); - String downloadUrl = entryDownloadInformationUrlElement.getAsString() - .replace(PLACEHOLDER_PLAYER_ID, PLAYER_ID); + String downloadUrl = entryDownloadInformationUrlElement.getAsString() + .replace(PLACEHOLDER_PLAYER_ID, PLAYER_ID); - return new ZDFEntryDTO(entryGeneralInformationUrlElement.getAsString(), downloadUrl); + return new ZDFEntryDTO(entryGeneralInformationUrlElement.getAsString(), downloadUrl); + }else { + throw new NoDownloadInformationException(); + } } } diff --git a/src/main/java/mServer/crawler/sender/newsearch/ZDFSearchTask.java b/src/main/java/mServer/crawler/sender/newsearch/ZDFSearchTask.java index 8bfb0b85b..286b85643 100644 --- a/src/main/java/mServer/crawler/sender/newsearch/ZDFSearchTask.java +++ b/src/main/java/mServer/crawler/sender/newsearch/ZDFSearchTask.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.RecursiveTask; import java.util.stream.Collectors; @@ -40,7 +41,7 @@ protected Collection compute() if(!Config.getStop()) { try { - Collection subTasks = new ArrayList<>(); + Collection subTasks = ConcurrentHashMap.newKeySet(); JsonObject baseObject; do {