X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fcore%2FNodeManager.java;h=b9404c738bc417c8364277f589031b0d105512be;hb=7a6a3c1c08be242d176b141f261e25b16fee84aa;hp=f772dc2592bf440791db738fb054a22423d92251;hpb=10afee01807213bbe00732a6617ba8ce77367c28;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/core/NodeManager.java b/src/net/pterodactylus/jsite/core/NodeManager.java index f772dc2..b9404c7 100644 --- a/src/net/pterodactylus/jsite/core/NodeManager.java +++ b/src/net/pterodactylus/jsite/core/NodeManager.java @@ -429,17 +429,20 @@ 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 */ - public String[] generateKeyPair() throws IOException { - if (!nodes.isEmpty()) { - Node node = nodes.get(0); - HighLevelClient highLevelClient = nodeClients.get(node); - try { - KeyGenerationResult keyGenerationResult = highLevelClient.generateKey().getResult(); - return new String[] { keyGenerationResult.getInsertURI(), keyGenerationResult.getRequestURI() }; - } catch (InterruptedException e) { - /* ignore. */ - } + public String[] generateKeyPair() throws IOException, NoNodeException { + if (nodes.isEmpty()) { + throw new NoNodeException("no node configured"); + } + Node node = nodes.get(0); + HighLevelClient highLevelClient = nodeClients.get(node); + try { + KeyGenerationResult keyGenerationResult = highLevelClient.generateKey().getResult(); + return new String[] { keyGenerationResult.getInsertURI(), keyGenerationResult.getRequestURI() }; + } catch (InterruptedException e) { + /* ignore. */ } return null; }