From: David ‘Bombe’ Roden Date: Thu, 4 Jul 2013 17:28:55 +0000 (+0200) Subject: Don’t add anything if the Sone to add is already present and a local Sone. X-Git-Tag: 0.8.6^2~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d63981bde15140dd827939596ec60c0b6ac528f6;p=Sone.git Don’t add anything if the Sone to add is already present and a local Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 941a598..03d331d 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -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));