From 3f2225f7c39c7d2f0a7b320fbb5e93815c0d9661 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 15 Sep 2011 16:35:17 +0200 Subject: [PATCH] Store own identity ID instead of own identity. This prevents an old identity object from being cached forever in the resolver. --- src/main/java/net/pterodactylus/wotns/main/Resolver.java | 10 +++++----- src/main/java/net/pterodactylus/wotns/main/WoTNSPlugin.java | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/pterodactylus/wotns/main/Resolver.java b/src/main/java/net/pterodactylus/wotns/main/Resolver.java index 4dacad9..f623e3d 100644 --- a/src/main/java/net/pterodactylus/wotns/main/Resolver.java +++ b/src/main/java/net/pterodactylus/wotns/main/Resolver.java @@ -40,14 +40,14 @@ public class Resolver { private final IdentityManager identityManager; - private OwnIdentity ownIdentity; + private String ownIdentityId; public Resolver(IdentityManager identityManager) { this.identityManager = identityManager; } - public void setOwnIdentity(OwnIdentity ownIdentity) { - this.ownIdentity = ownIdentity; + public void setOwnIdentityId(String ownIdentityId) { + this.ownIdentityId = ownIdentityId; } // @@ -83,7 +83,7 @@ public class Resolver { } @SuppressWarnings("hiding") final OwnIdentity ownIdentity; - if (this.ownIdentity == null) { + if (this.ownIdentityId == null) { Set ownIdentities = identityManager.getAllOwnIdentities(); if (!ownIdentities.isEmpty()) { ownIdentity = ownIdentities.iterator().next(); @@ -91,7 +91,7 @@ public class Resolver { ownIdentity = null; } } else { - ownIdentity = this.ownIdentity; + ownIdentity = identityManager.getOwnIdentity(ownIdentityId); } if (ownIdentity == null) { return null; diff --git a/src/main/java/net/pterodactylus/wotns/main/WoTNSPlugin.java b/src/main/java/net/pterodactylus/wotns/main/WoTNSPlugin.java index f3ec6d4..e4cad46 100644 --- a/src/main/java/net/pterodactylus/wotns/main/WoTNSPlugin.java +++ b/src/main/java/net/pterodactylus/wotns/main/WoTNSPlugin.java @@ -21,7 +21,6 @@ import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.version.Version; import net.pterodactylus.wotns.freenet.plugin.PluginConnector; import net.pterodactylus.wotns.freenet.wot.IdentityManager; -import net.pterodactylus.wotns.freenet.wot.OwnIdentity; import net.pterodactylus.wotns.freenet.wot.WebOfTrustConnector; import net.pterodactylus.wotns.ui.web.WebInterface; import freenet.client.HighLevelSimpleClient; @@ -99,8 +98,7 @@ public class WoTNSPlugin implements FredPlugin, FredPluginL10n, FredPluginBaseL1 identityManager.start(); resolver = new Resolver(identityManager); - OwnIdentity bombeIdentity = identityManager.getOwnIdentity("e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U"); - resolver.setOwnIdentity(bombeIdentity); + resolver.setOwnIdentityId("e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U"); webInterface = new WebInterface(this); -- 2.7.4