Search in sources :

Example 1 with ApplicationIdNotFoundException

use of com.yahoo.vespa.orchestrator.ApplicationIdNotFoundException in project vespa by vespa-engine.

the class ApplicationSuspensionResource method getApplication.

@Override
public void getApplication(String applicationIdString) {
    ApplicationId appId = toApplicationId(applicationIdString);
    ApplicationInstanceStatus status;
    try {
        status = orchestrator.getApplicationInstanceStatus(appId);
    } catch (ApplicationIdNotFoundException e) {
        throw new NotFoundException("Application " + applicationIdString + " could not be found");
    }
    if (status.equals(ApplicationInstanceStatus.NO_REMARKS)) {
        throw new NotFoundException("Application " + applicationIdString + " is not suspended");
    }
// Return void as we have nothing to return except 204 No
// Content. Unfortunately, Jersey outputs a warning for this case:
// 
// The following warnings have been detected: HINT: A HTTP GET
// method, public void com.yahoo.vespa.orchestrator.resources.
// ApplicationSuspensionResource.getApplication(java.lang.String),
// returns a void type. It can be intentional and perfectly fine,
// but it is a little uncommon that GET method returns always "204
// No Content"
// 
// We have whitelisted the warning for our systemtests.
// 
// bakksjo has a pending jersey PR fix that avoids making the hint
// become a warning:
// https://github.com/jersey/jersey/pull/212
// 
// TODO: Remove whitelisting and this comment once jersey has been
// fixed.
}
Also used : ApplicationIdNotFoundException(com.yahoo.vespa.orchestrator.ApplicationIdNotFoundException) ApplicationInstanceStatus(com.yahoo.vespa.orchestrator.status.ApplicationInstanceStatus) NotFoundException(javax.ws.rs.NotFoundException) ApplicationIdNotFoundException(com.yahoo.vespa.orchestrator.ApplicationIdNotFoundException) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)1 ApplicationIdNotFoundException (com.yahoo.vespa.orchestrator.ApplicationIdNotFoundException)1 ApplicationInstanceStatus (com.yahoo.vespa.orchestrator.status.ApplicationInstanceStatus)1 NotFoundException (javax.ws.rs.NotFoundException)1