Don’t add anything if the Sone to add is already present and a local Sone.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Jul 2013 17:28:55 +0000 (19:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 4 Jul 2013 17:28:55 +0000 (19:28 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index 941a598..03d331d 100644 (file)
@@ -802,7 +802,11 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
                        return null;
                }
                synchronized (sones) {
-                       final Sone sone = getRemoteSone(identity.getId(), true).setIdentity(identity);
+                       final Sone sone = getRemoteSone(identity.getId(), true);
+                       if (sone.isLocal()) {
+                               return sone;
+                       }
+                       sone.setIdentity(identity);
                        boolean newSone = sone.getRequestUri() == null;
                        sone.setRequestUri(SoneUri.create(identity.getRequestUri()));
                        sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0));