Only free buckets after the insert.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / SoneDownloader.java
index 56ae917..53eef16 100644 (file)
@@ -35,6 +35,7 @@ import net.pterodactylus.sone.data.PostReply;
 import net.pterodactylus.sone.data.Profile;
 import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.data.Sone.SoneStatus;
+import net.pterodactylus.sone.data.SoneImpl;
 import net.pterodactylus.sone.database.PostBuilder;
 import net.pterodactylus.sone.database.PostReplyBuilder;
 import net.pterodactylus.util.io.Closer;
@@ -239,7 +240,7 @@ public class SoneDownloader extends AbstractService {
                        return null;
                }
 
-               Sone sone = new Sone(originalSone.getId(), originalSone.isLocal()).setIdentity(originalSone.getIdentity());
+               Sone sone = new SoneImpl(originalSone.getId(), originalSone.isLocal()).setIdentity(originalSone.getIdentity());
 
                SimpleXML soneXml;
                try {
@@ -307,16 +308,8 @@ public class SoneDownloader extends AbstractService {
                        }
                }
 
-               String soneInsertUri = soneXml.getValue("insert-uri", null);
-               if ((soneInsertUri != null) && (sone.getInsertUri() == null)) {
-                       try {
-                               sone.setInsertUri(new FreenetURI(soneInsertUri));
-                               sone.setLatestEdition(Math.max(sone.getRequestUri().getEdition(), sone.getInsertUri().getEdition()));
-                       } catch (MalformedURLException mue1) {
-                               /* TODO - mark Sone as bad. */
-                               logger.log(Level.WARNING, String.format("Downloaded Sone %s has invalid insert URI: %s", sone, soneInsertUri), mue1);
-                               return null;
-                       }
+               if (originalSone.getInsertUri() != null) {
+                       sone.setInsertUri(originalSone.getInsertUri());
                }
 
                SimpleXML profileXml = soneXml.getNode("profile");