X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneInserter.java;h=0abebc3a1556e8710f69c145cfbd8a525239af4c;hb=aa94dcb712392b69cb431d1637e4948688d15791;hp=2133b56d7ae65226a605ece86a8978c446f25873;hpb=94a58c591d942918b1f7f25c04be04102cd5156d;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 2133b56..0abebc3 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -1,5 +1,5 @@ /* - * FreenetSone - SoneInserter.java - Copyright © 2010 David Roden + * Sone - SoneInserter.java - Copyright © 2010 David Roden * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -160,7 +160,7 @@ public class SoneInserter extends AbstractService { protected void serviceRun() { long lastModificationTime = 0; String lastFingerprint = ""; - while (!shouldStop()) { + while (!shouldStop()) { try { /* check every seconds. */ sleep(1000); @@ -204,7 +204,7 @@ public class SoneInserter extends AbstractService { core.setSoneStatus(sone, SoneStatus.inserting); long insertTime = System.currentTimeMillis(); insertInformation.setTime(insertTime); - FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri().setKeyType("USK").setSuggestedEdition(0), insertInformation.generateManifestEntries(), "index.html"); + FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri(), insertInformation.generateManifestEntries(), "index.html"); /* at this point we might already be stopped. */ if (shouldStop()) { /* if so, bail out, don’t change anything. */ @@ -229,14 +229,15 @@ public class SoneInserter extends AbstractService { synchronized (sone) { if (lastInsertFingerprint.equals(sone.getFingerprint())) { logger.log(Level.FINE, "Sone “%s” was not modified further, resetting counter…", new Object[] { sone }); - core.saveSone(sone); lastModificationTime = 0; modified = false; } } } } - } + } catch (Throwable t1) { + logger.log(Level.SEVERE, "SoneInserter threw an Exception!", t1); + }} } /** @@ -345,6 +346,7 @@ public class SoneInserter extends AbstractService { TemplateContext templateContext = templateContextFactory.createTemplateContext(); templateContext.set("currentSone", soneProperties); + templateContext.set("currentEdition", core.getUpdateChecker().getLatestEdition()); templateContext.set("version", SonePlugin.VERSION); StringWriter writer = new StringWriter(); StringBucket bucket = null;