Copy insert URI of original Sone when parsing a new Sone.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 11 Oct 2013 06:22:03 +0000 (08:22 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 11 Oct 2013 06:22:03 +0000 (08:22 +0200)
This, once again, fixes the Rescue Mode.

src/main/java/net/pterodactylus/sone/core/SoneDownloader.java

index cffc8d9..53eef16 100644 (file)
@@ -308,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");