X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNodeManager.java;h=d81416bc9457d891a8a88d3a02067d34728f7d51;hb=5e5d4cb3b2789b4d3ba801e297da27f09003f306;hp=b9404c738bc417c8364277f589031b0d105512be;hpb=7a6a3c1c08be242d176b141f261e25b16fee84aa;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/NodeManager.java b/src/net/pterodactylus/jsite/core/NodeManager.java index b9404c7..d81416b 100644 --- a/src/net/pterodactylus/jsite/core/NodeManager.java +++ b/src/net/pterodactylus/jsite/core/NodeManager.java @@ -40,6 +40,7 @@ import java.util.logging.Logger; import net.pterodactylus.fcp.highlevel.HighLevelClient; import net.pterodactylus.fcp.highlevel.HighLevelClientListener; +import net.pterodactylus.fcp.highlevel.HighLevelException; import net.pterodactylus.fcp.highlevel.KeyGenerationResult; import net.pterodactylus.util.io.Closer; import net.pterodactylus.util.logging.Logging; @@ -48,7 +49,6 @@ import net.pterodactylus.util.logging.Logging; * TODO * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ public class NodeManager implements Iterable, PropertyChangeListener, HighLevelClientListener { @@ -346,6 +346,7 @@ public class NodeManager implements Iterable, PropertyChangeListener, High if (nodeClients.containsKey(node)) { disconnect(node); } + nodes.remove(node); node.removePropertyChangeListener(this); fireNodeRemoved(node); } @@ -429,10 +430,10 @@ public class NodeManager implements Iterable, PropertyChangeListener, High * public key at index 1 * @throws IOException * if an I/O error occurs communicating with the node - * @throws NoNodeException - * if no node is configured + * @throws JSiteException + * if there is a problem with the node */ - public String[] generateKeyPair() throws IOException, NoNodeException { + public String[] generateKeyPair() throws IOException, JSiteException { if (nodes.isEmpty()) { throw new NoNodeException("no node configured"); } @@ -441,6 +442,8 @@ public class NodeManager implements Iterable, PropertyChangeListener, High try { KeyGenerationResult keyGenerationResult = highLevelClient.generateKey().getResult(); return new String[] { keyGenerationResult.getInsertURI(), keyGenerationResult.getRequestURI() }; + } catch (HighLevelException hle1) { + throw new BackendException(hle1); } catch (InterruptedException e) { /* ignore. */ }