mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-17 10:21:52 +02:00
Treat null as NOT FOUND for application and applicationId
Change-Id: Ieaf65770b0057c85cef47e1904efbc93709ff06b
This commit is contained in:
parent
7dc59d65fb
commit
cbf49898a2
@ -35,12 +35,17 @@ import javax.ws.rs.core.Response;
|
||||
import java.io.InputStream;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.onlab.util.Tools.nullIsNotFound;
|
||||
|
||||
/**
|
||||
* Manage inventory of applications.
|
||||
*/
|
||||
@Path("applications")
|
||||
public class ApplicationsWebResource extends AbstractWebResource {
|
||||
|
||||
private static final String APP_ID_NOT_FOUND = "Application ID is not found";
|
||||
private static final String APP_NOT_FOUND = "Application is not found";
|
||||
|
||||
/**
|
||||
* Get all installed applications.
|
||||
* Returns array of all installed applications.
|
||||
@ -210,11 +215,12 @@ public class ApplicationsWebResource extends AbstractWebResource {
|
||||
}
|
||||
|
||||
private Response response(ApplicationAdminService service, ApplicationId appId) {
|
||||
Application app = service.getApplication(appId);
|
||||
Application app = nullIsNotFound(service.getApplication(appId), APP_NOT_FOUND);
|
||||
return ok(codec(Application.class).encode(app, this)).build();
|
||||
}
|
||||
|
||||
private Response response(ApplicationId appId) {
|
||||
return ok(codec(ApplicationId.class).encode(appId, this)).build();
|
||||
ApplicationId checkedAppId = nullIsNotFound(appId, APP_ID_NOT_FOUND);
|
||||
return ok(codec(ApplicationId.class).encode(checkedAppId, this)).build();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user