- 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, JSiteException {
+ 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 (HighLevelException hle1) {
+ throw new BackendException(hle1);
+ } catch (InterruptedException e) {
+ /* ignore. */