summaryrefslogtreecommitdiffstats
path: root/node-repository/src
diff options
context:
space:
mode:
authorMartin Polden <martin.polden@gmail.com>2017-01-02 08:53:04 +0100
committerMartin Polden <martin.polden@gmail.com>2017-01-02 09:22:38 +0100
commit7a20129143a8ad9a9f947fd16540d87b5029bbdd (patch)
tree471cfe6d9338b1f7e988742ff275be143c4886de /node-repository/src
parent034eebf56835313b7fdf544e51a50d4b61667583 (diff)
Fix overlapping exception names
Diffstat (limited to 'node-repository/src')
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NoSuchNodeException.java (renamed from node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NotFoundException.java)6
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java8
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java3
3 files changed, 8 insertions, 9 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NotFoundException.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NoSuchNodeException.java
index 0e76c0760e2..355116586d9 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NotFoundException.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NoSuchNodeException.java
@@ -6,10 +6,8 @@ package com.yahoo.vespa.hosted.provision;
*
* @author musum
*/
-public class NotFoundException extends RuntimeException {
+public class NoSuchNodeException extends RuntimeException {
- public NotFoundException(String message) { super(message); }
-
- public NotFoundException(String message, Throwable cause) { super(message, cause); }
+ public NoSuchNodeException(String message) { super(message); }
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java
index a162653d99f..8eac3c1c467 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/NodeRepository.java
@@ -297,7 +297,7 @@ public class NodeRepository extends AbstractComponent {
* Fails this node and returns it in its new state.
*
* @return the node in its new state
- * @throws NotFoundException if the node is not found
+ * @throws NoSuchNodeException if the node is not found
*/
public Node fail(String hostname) {
return move(hostname, Node.State.failed);
@@ -307,7 +307,7 @@ public class NodeRepository extends AbstractComponent {
* Parks this node and returns it in its new state.
*
* @return the node in its new state
- * @throws NotFoundException if the node is not found
+ * @throws NoSuchNodeException if the node is not found
*/
public Node park(String hostname) {
return move(hostname, Node.State.parked);
@@ -317,7 +317,7 @@ public class NodeRepository extends AbstractComponent {
* Moves a previously failed or parked node back to the active state.
*
* @return the node in its new state
- * @throws NotFoundException if the node is not found
+ * @throws NoSuchNodeException if the node is not found
*/
public Node reactivate(String hostname) {
return move(hostname, Node.State.active);
@@ -326,7 +326,7 @@ public class NodeRepository extends AbstractComponent {
public Node move(String hostname, Node.State toState) {
Optional<Node> node = getNode(hostname);
if ( ! node.isPresent())
- throw new NotFoundException("Could not move " + hostname + " to " + toState + ": Node not found");
+ throw new NoSuchNodeException("Could not move " + hostname + " to " + toState + ": Node not found");
try (Mutex lock = lock(node.get())) {
return zkClient.writeTo(toState, node.get());
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
index 1cbde11d7c2..eb4b4fbff44 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodesApiHandler.java
@@ -12,6 +12,7 @@ import com.yahoo.slime.ArrayTraverser;
import com.yahoo.slime.Inspector;
import com.yahoo.slime.Slime;
import com.yahoo.vespa.config.SlimeUtils;
+import com.yahoo.vespa.hosted.provision.NoSuchNodeException;
import com.yahoo.vespa.hosted.provision.Node;
import com.yahoo.vespa.hosted.provision.NodeRepository;
import com.yahoo.vespa.hosted.provision.node.NodeFlavors;
@@ -66,7 +67,7 @@ public class NodesApiHandler extends LoggingRequestHandler {
case PATCH: return handlePATCH(request);
default: return ErrorResponse.methodNotAllowed("Method '" + request.getMethod() + "' is not supported");
}
- } catch (NotFoundException | com.yahoo.vespa.hosted.provision.NotFoundException e) {
+ } catch (NotFoundException | NoSuchNodeException e) {
return ErrorResponse.notFoundError(Exceptions.toMessageString(e));
} catch (IllegalArgumentException e) {
return ErrorResponse.badRequest(Exceptions.toMessageString(e));