From 4d49ba7b5f6ebed20a91678ebdcda1388d470dc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Mar 2014 06:46:02 +0100 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20process=20a=20download=20if=20th?= =?utf8?q?e=20downloader=20was=20aborted.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/SoneDownloader.java | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.7.4