From bfd25c988506da30bceec92b79e7fa9990726038 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 7 Mar 2019 12:44:01 +0100 Subject: [PATCH] fixed compile error Java 8 --- .../service/remote/webservice/api/RestService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestService.java index 69416bd9..79e6ce94 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestService.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/webservice/api/RestService.java @@ -75,19 +75,23 @@ public class RestService { return restCall.newBuilder(); } - public Action activation(final Action action) { + public Action activation(final Action action) { if (action.definition.restCallType == null) { throw new IllegalArgumentException("ActionDefinition needs to define a restCallType to use this action"); } - final RestCall.RestCallBuilder builder = this.getBuilder(action.definition.restCallType); - return builder + @SuppressWarnings("unchecked") + final Class> restCallType = + (Class>) action.definition.restCallType; + + this.getBuilder(restCallType) .withURIVariable( API.PARAM_MODEL_ID, action.pageContext().getAttribute(AttributeKeys.ENTITY_ID)) .call() - .map(report -> action) - .getOrThrow(); + .onErrorDo(t -> action.pageContext().notifyError(t)); + + return action; } }