Store fingerprint in insert information.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Jun 2014 04:34:28 +0000 (06:34 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 11 Jun 2014 04:34:28 +0000 (06:34 +0200)
src/main/java/net/pterodactylus/sone/core/SoneInserter.java

index 1445613..d8564ba 100644 (file)
@@ -268,10 +268,10 @@ public class SoneInserter extends AbstractService {
                                         */
                                        if (success) {
                                                synchronized (sone) {
-                                                       if (lastInsertedFingerprint.equals(sone.getFingerprint())) {
+                                                       if (insertInformation.getFingerprint().equals(sone.getFingerprint())) {
                                                                logger.log(Level.FINE, String.format("Sone “%s” was not modified further, resetting counter…", sone));
                                                                lastModificationTime = absent();
-                                                               lastInsertFingerprint = lastInsertedFingerprint;
+                                                               lastInsertFingerprint = insertInformation.getFingerprint();
                                                                core.touchConfiguration();
                                                                modified = false;
                                                        }
@@ -293,6 +293,8 @@ public class SoneInserter extends AbstractService {
         */
        private class InsertInformation {
 
+               private final String fingerprint;
+
                /** All properties of the Sone, copied for thread safety. */
                private final Map<String, Object> soneProperties = new HashMap<String, Object>();
 
@@ -303,6 +305,7 @@ public class SoneInserter extends AbstractService {
                 *            The sone to insert
                 */
                public InsertInformation(Sone sone) {
+                       this.fingerprint = sone.getFingerprint();
                        soneProperties.put("id", sone.getId());
                        soneProperties.put("name", sone.getName());
                        soneProperties.put("time", sone.getTime());
@@ -320,6 +323,10 @@ public class SoneInserter extends AbstractService {
                // ACCESSORS
                //
 
+               private String getFingerprint() {
+                       return fingerprint;
+               }
+
                /**
                 * Returns the insert URI of the Sone.
                 *