summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/RestApiException.java10
-rw-r--r--container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java2
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandler.java8
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java8
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/InstanceRequestHandler.java2
5 files changed, 15 insertions, 15 deletions
diff --git a/container-core/src/main/java/com/yahoo/restapi/RestApiException.java b/container-core/src/main/java/com/yahoo/restapi/RestApiException.java
index da853f91402..d9da320499f 100644
--- a/container-core/src/main/java/com/yahoo/restapi/RestApiException.java
+++ b/container-core/src/main/java/com/yahoo/restapi/RestApiException.java
@@ -40,11 +40,11 @@ public class RestApiException extends RuntimeException {
public int statusCode() { return statusCode; }
public HttpResponse response() { return response; }
- public static class NotFoundException extends RestApiException {
- public NotFoundException() { this(null, null); }
- public NotFoundException(Throwable cause) { this(cause.getMessage(), cause); }
- public NotFoundException(String message) { this(message, null); }
- public NotFoundException(String message, Throwable cause) { super(ErrorResponse::notFoundError, message, cause); }
+ public static class NotFound extends RestApiException {
+ public NotFound() { this(null, null); }
+ public NotFound(Throwable cause) { this(cause.getMessage(), cause); }
+ public NotFound(String message) { this(message, null); }
+ public NotFound(String message, Throwable cause) { super(ErrorResponse::notFoundError, message, cause); }
}
public static class MethodNotAllowed extends RestApiException {
diff --git a/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java b/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
index 084aa01ec40..8ba94f9aca9 100644
--- a/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
+++ b/container-core/src/main/java/com/yahoo/restapi/RestApiImpl.java
@@ -144,7 +144,7 @@ class RestApiImpl implements RestApi {
private static Route createDefaultRoute() {
RouteBuilder routeBuilder = new RouteBuilderImpl("{*}")
.defaultHandler(context -> {
- throw new RestApiException.NotFoundException();
+ throw new RestApiException.NotFound();
});
return ((RouteBuilderImpl)routeBuilder).build();
}
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandler.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandler.java
index 4fecbefaffd..c706aed1143 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandler.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionRequestHandler.java
@@ -77,11 +77,11 @@ public class ApplicationSuspensionRequestHandler extends RestApiRequestHandler<A
try {
status = orchestrator.getApplicationInstanceStatus(appId);
} catch (ApplicationIdNotFoundException e) {
- throw new RestApiException.NotFoundException("Application " + applicationIdString + " could not be found", e);
+ throw new RestApiException.NotFound("Application " + applicationIdString + " could not be found", e);
}
if (status.equals(ApplicationInstanceStatus.NO_REMARKS)) {
- throw new RestApiException.NotFoundException("Application " + applicationIdString + " is not suspended");
+ throw new RestApiException.NotFound("Application " + applicationIdString + " is not suspended");
}
return new EmptyResponse(Status.NO_CONTENT);
}
@@ -107,7 +107,7 @@ public class ApplicationSuspensionRequestHandler extends RestApiRequestHandler<A
orchestrator.suspend(applicationId);
} catch (ApplicationIdNotFoundException e) {
log.log(Level.INFO, "ApplicationId " + applicationIdString + " not found.", e);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
} catch (ApplicationStateChangeDeniedException e) {
log.log(Level.INFO, "Suspend for " + applicationIdString + " failed.", e);
throw new RestApiException.Conflict();
@@ -136,7 +136,7 @@ public class ApplicationSuspensionRequestHandler extends RestApiRequestHandler<A
orchestrator.resume(applicationId);
} catch (ApplicationIdNotFoundException e) {
log.log(Level.INFO, "ApplicationId " + applicationIdString + " not found.", e);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
} catch (ApplicationStateChangeDeniedException e) {
log.log(Level.INFO, "Suspend for " + applicationIdString + " failed.", e);
throw new RestApiException.Conflict();
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
index 4dcd76cbb10..7b28925205f 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/HostRequestHandler.java
@@ -94,7 +94,7 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
throw restApiExceptionFromTimeout("getHost", hostName, e);
} catch (HostNameNotFoundException e) {
log.log(Level.FINE, "Host not found: " + hostName);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
}
}
@@ -117,7 +117,7 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
orchestrator.setNodeStatus(hostName, state);
} catch (HostNameNotFoundException e) {
log.log(Level.FINE, "Host not found: " + hostName);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
log.log(Level.FINE, "Failed to patch " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("patch", hostName, e);
@@ -151,7 +151,7 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
orchestrator.suspend(hostName);
} catch (HostNameNotFoundException e) {
log.log(Level.FINE, "Host not found: " + hostName);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
log.log(Level.FINE, "Failed to suspend " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("suspend", hostName, e);
@@ -174,7 +174,7 @@ public class HostRequestHandler extends RestApiRequestHandler<HostRequestHandler
orchestrator.resume(hostName);
} catch (HostNameNotFoundException e) {
log.log(Level.FINE, "Host not found: " + hostName);
- throw new RestApiException.NotFoundException(e);
+ throw new RestApiException.NotFound(e);
} catch (UncheckedTimeoutException e) {
log.log(Level.FINE, "Failed to resume " + hostName + ": " + e.getMessage());
throw restApiExceptionFromTimeout("resume", hostName, e);
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/InstanceRequestHandler.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/InstanceRequestHandler.java
index 8642a51b804..567013e7453 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/InstanceRequestHandler.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/resources/InstanceRequestHandler.java
@@ -99,7 +99,7 @@ public class InstanceRequestHandler extends RestApiRequestHandler<InstanceReques
ApplicationInstance applicationInstance
= serviceMonitor.getApplication(instanceId)
- .orElseThrow(RestApiException.NotFoundException::new);
+ .orElseThrow(RestApiException.NotFound::new);
HostInfos hostInfos = statusService.getHostInfosByApplicationResolver().apply(applicationInstance.reference());
TreeMap<HostName, WireHostInfo> hostStatusMap =