Store LatestEdition property only after saving the Sone to disk.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Sep 2011 20:17:18 +0000 (22:17 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Sep 2011 20:17:18 +0000 (22:17 +0200)
This will at least prevent WoT from blocking the correct writing of the
configuration.

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

index 1bea477..1c9d668 100644 (file)
@@ -2028,8 +2028,6 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
 
                logger.log(Level.INFO, "Saving Sone: %s", sone);
                try {
-                       ((OwnIdentity) sone.getIdentity()).setProperty("Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
-
                        /* save Sone into configuration. */
                        String sonePrefix = "Sone/" + sone.getId();
                        configuration.getLongValue(sonePrefix + "/Time").setValue(sone.getTime());
@@ -2135,6 +2133,9 @@ public class Core extends AbstractService implements IdentityListener, UpdateLis
                        configuration.getBooleanValue(sonePrefix + "/Options/EnableSoneInsertNotifications").setValue(sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").getReal());
 
                        configuration.save();
+
+                       ((OwnIdentity) sone.getIdentity()).setProperty("Sone.LatestEdition", String.valueOf(sone.getLatestEdition()));
+
                        logger.log(Level.INFO, "Sone %s saved.", sone);
                } catch (ConfigurationException ce1) {
                        logger.log(Level.WARNING, "Could not save Sone: " + sone, ce1);