From: David ‘Bombe’ Roden Date: Sun, 13 Nov 2011 11:31:45 +0000 (+0100) Subject: Send a copy of the default own identities to the event listeners. X-Git-Tag: 0.7.3^2~9^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=284d89c3bfd97ebbd21ad8b39093ee318c125ae3;p=Sone.git Send a copy of the default own identities to the event listeners. This will prevent event listeners from changing the underlying objects that are used to detect changes. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java index f9af361..065aa47 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java +++ b/src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManager.java @@ -297,7 +297,7 @@ public class IdentityManager extends AbstractService { for (OwnIdentity oldOwnIdentity : currentOwnIdentities.values()) { OwnIdentity newOwnIdentity = newOwnIdentities.get(oldOwnIdentity.getId()); if ((newOwnIdentity == null) || ((context != null) && oldOwnIdentity.hasContext(context) && !newOwnIdentity.hasContext(context))) { - identityListenerManager.fireOwnIdentityRemoved(oldOwnIdentity); + identityListenerManager.fireOwnIdentityRemoved(new DefaultOwnIdentity(webOfTrustConnector, oldOwnIdentity)); } } @@ -305,7 +305,7 @@ public class IdentityManager extends AbstractService { for (OwnIdentity currentOwnIdentity : newOwnIdentities.values()) { OwnIdentity oldOwnIdentity = currentOwnIdentities.get(currentOwnIdentity.getId()); if (((oldOwnIdentity == null) && ((context == null) || currentOwnIdentity.hasContext(context))) || ((oldOwnIdentity != null) && (context != null) && (!oldOwnIdentity.hasContext(context) && currentOwnIdentity.hasContext(context)))) { - identityListenerManager.fireOwnIdentityAdded(currentOwnIdentity); + identityListenerManager.fireOwnIdentityAdded(new DefaultOwnIdentity(webOfTrustConnector, currentOwnIdentity)); } }