Hi Nicolas,
I hope you are the best addressee for this question. I am just solving [1], where:
(1) A NullPointerException is thrown in TemplateStatisticService.getExecutionCount(TemplateStatisticService.java:120)
(2) The NullPointerException is catched in RestResource.safeInvoke(MethodInvoker, Map<String, List<String>>) where Response.serverError() is returned, see [2]. This is probably incorrect,
Response.serverError().build()
or
Response.serverError().entity(e.getMessage()).build()
would probably be better.
(3) But anyway, this return value is not handled properly in RequestDispatcher.processResponse(...). There, the result is handled only based on the expected return type, in this case java.lang.Object, which boils down to the last else, see [3].
Hence, the main question is if this can be fixed in RequestDispatcher. Could perhaps the Resource type check [4] be applied also on o, like this:
else if (Response.class.isAssignableFrom(returnType) || o instanceof Response)
Or can you perhaps see other better possibilities to fix this?
Thanks,
Peter
[1] https://issues.jboss.org/browse/GTNPORTAL-3292
[2] https://github.com/gatein/gatein-portal/blob/master/component/management/src/main/java/org/exoplatform/management/data/RestResource.java#L223
[3] https://github.com/exoplatform/ws/blob/master/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestDispatcher.java#L763
[4] https://github.com/exoplatform/ws/blob/master/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/RequestDispatcher.java#L747