Avoid exceptions with Optional objects with no value.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@160621 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6db70871b8
commit
f4e1170f78
|
@ -38,11 +38,11 @@ public class RMContext {
|
|||
ResponseFromResourceRegistry returned = CreateRequest.fromHolder(holder).forceURL("").submit();
|
||||
if (returned.wasSuccessful()) {
|
||||
response = Response.status(Status.CREATED)
|
||||
.entity(returned.getMessage().orElse("Context successfully created."))
|
||||
.entity(returned.getMessage().map(m -> m).orElse("Context successfully created."))
|
||||
.type(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8).build();
|
||||
} else {
|
||||
response = Response.status(Status.BAD_REQUEST)
|
||||
.entity(returned.getMessage().orElse("Failed to create the context.")).build();
|
||||
.entity(returned.getMessage().map(m -> m).orElse("Failed to create the context.")).build();
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue