From: David ‘Bombe’ Roden Date: Fri, 5 Nov 2010 14:02:25 +0000 (+0100) Subject: Don’t modify a Sone when the sone inserter was stopped before the insert finished. X-Git-Tag: 0.2-RC1~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=275d2834f2222ffa370cbdf0d38813dda62a3d72;p=Sone.git Don’t modify a Sone when the sone inserter was stopped before the insert finished. --- diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 35910eb..5b281f6 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -143,6 +143,11 @@ public class SoneInserter extends AbstractService { try { core.setSoneStatus(sone, SoneStatus.inserting); FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri().setKeyType("USK").setSuggestedEdition(0), insertInformation.generateManifestEntries(), "index.html"); + /* at this point we might already be stopped. */ + if (shouldStop()) { + /* if so, bail out, don’t change anything. */ + break; + } sone.setLatestEdition(finalUri.getEdition()); success = true; logger.log(Level.INFO, "Inserted Sone “%s” at %s.", new Object[] { sone.getName(), finalUri });