Update method :: updateRepoSettings to create NotebookRepoSettingsRequest with Empty static object instead of null

This commit is contained in:
Anthony Corbacho 2016-10-23 14:03:40 +09:00
parent a4d9749294
commit f7c7bf235d

View file

@ -90,7 +90,7 @@ public class NotebookRepoRestApi {
return new JsonResponse<>(Status.NOT_FOUND, "", Collections.emptyMap()).build();
}
AuthenticationInfo subject = new AuthenticationInfo(SecurityUtils.getPrincipal());
NotebookRepoSettingsRequest newSettings = null;
NotebookRepoSettingsRequest newSettings = NotebookRepoSettingsRequest.EMPTY;
try {
newSettings = gson.fromJson(payload, NotebookRepoSettingsRequest.class);
} catch (JsonSyntaxException e) {
@ -99,7 +99,7 @@ public class NotebookRepoRestApi {
ImmutableMap.of("error", "Invalid payload structure")).build();
}
if (newSettings == null) {
if (NotebookRepoSettingsRequest.isEmpty(newSettings)) {
LOG.error("Invalid property");
return new JsonResponse<>(Status.NOT_ACCEPTABLE, "",
ImmutableMap.of("error", "Invalid payload")).build();