From: David ‘Bombe’ Roden Date: Wed, 5 Mar 2014 05:46:02 +0000 (+0100) Subject: Don’t process a download if the downloader was aborted. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4d49ba7b5f6ebed20a91678ebdcda1388d470dc0;p=Sone.git Don’t process a download if the downloader was aborted. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index eb263ed..a406f1b 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -17,6 +17,7 @@ package net.pterodactylus.sone.core; +import static java.util.logging.Level.FINER; import static net.pterodactylus.sone.data.Sone.TO_FREENET_URI; import java.io.InputStream; @@ -148,6 +149,10 @@ public class SoneDownloader extends AbstractService { /* TODO - mark Sone as bad. */ return null; } + if (shouldStop()) { + logger.log(FINER, "Sone was stopped, won’t process download."); + return null; + } logger.log(Level.FINEST, String.format("Got %d bytes back.", fetchResults.getFetchResult().size())); Sone parsedSone = parseSone(sone, fetchResults.getFetchResult(), fetchResults.getFreenetUri()); if (parsedSone != null) {