I was doing a search and I came across this thread:
http://n2.nabble.com/ServerResource-conditional-mode-td2577651.html
My problem is that during development, RuntimeExceptions will sometimes get
thrown. The behavior I am experiencing using annotations is that the
exception is quietly caught and a 500 is given. I want to hook in my logger
to display this exception as it was thrown to the method invoker, so the
stack trace appears in my IDEA console.
Stoph wrote:
>
> Hello all! I am here to report an issue I am having and see if the problem
> lies with myself or with Restlet.
>
> I have a class FooResource which extends ServerResource.
>
> I originally had a method to handle the representation like this:
>
> <pre>
> @Get
> public Representation represent(Variant variant) {
> return bar.represent();
> }</pre>
>
> My issue: if "bar" is null, the NullPointerException was not showing up on
> my IntelliJ console.
>
> This was fixed by changing it to:
>
> <pre>
> @Override
> public Representation get() {
> return bar.represent();
> }</pre>
>
> Can anyone elaborate why I only see the exception in this last instance?
> My guess is that it's because java reflection is throwing a
> InvocationTargetException so Restlet handles this first case differently
> than the second case.
>
--
View this message in context:
http://n2.nabble.com/Exception-handling-issue---overriding-get%28%29-vs-using-%40Get-tp3435034p3435848.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2383154