Thx for the PR, however it is not the correct fix. Please find more details here https://github.com/exoplatform/ws/pull/5#issuecomment-30830512.
How can I test my fix ?


On Tue, Dec 17, 2013 at 7:44 PM, Nicolas Filotto <nfilotto@exoplatform.com> wrote:
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@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@exoplatform.com



--
Nicolas Filotto
Project Leader JCR
eXo Platform SAS
nfilotto@exoplatform.com