That sounds correct, please fill in a JIRA issue in the WS project. I'll
fix it asap
On Tue, Dec 17, 2013 at 5:02 PM, Peter Palaga <ppalaga(a)redhat.com> wrote:
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
--
Nicolas Filotto
Project Leader JCR
eXo Platform SAS
nfilotto(a)exoplatform.com