Nullpointer Exception with empty reason in RestXQ response

Monday, 28 April 2014 · 2 messages · last reply 29 Apr 2014
ML
Marco Lettere28 Apr 2014 15:11 #
Hi all, when, in 7.8.x, I override the rest response in an RestXQ as in:
declare
%rest:path('testhead1')
%rest:HEAD
function test:myfunct1() {
   let $out := () (: also with let $out := "" :)
   <rest:response>
         <http:response  status="404" reason="{$out}" />
    </rest:response>
};
I get a null pointer exception from a calling http-client code (in the GUI the usual message "Improper use or potential Bug ...").
http:send-request(<http:requestmethod="head"
href="http://localhost:8984/testhead1"/>)
If I omit the reason attribute alltogether it correctly defaults to the HTTP Phrase "Not Found". Couldn't it be useful to handle the two cases in the same way? Regards, Marco.
CG
Christian Grün29 Apr 2014 19:11 #
Hi Marco, This has been fixed in the latest snapshot [1] (and in the 7.8.3 GitHub branch). Thanks, Christian [1] http://files.basex.org/releases/latest/
Quoted text · Marco Lettere · 25 lines
On Mon, Apr 28, 2014 at 3:11 PM, Marco Lettere <marco.lettere at dedalus.eu> wrote: > Hi all, > when, in 7.8.x, I override the rest response in an RestXQ as in: > > declare > %rest:path('testhead1') > %rest:HEAD > function test:myfunct1() { > let $out := () (: also with let $out := "" :) > <rest:response> > <http:response status="404" reason="{$out}" /> > </rest:response> > }; > > I get a null pointer exception from a calling http-client code (in the GUI > the usual message "Improper use or potential Bug ..."). > > http:send-request(<http:request method="head" > href="http://localhost:8984/testhead1" />) > > If I omit the reason attribute alltogether it correctly defaults to the HTTP > Phrase "Not Found". > Couldn't it be useful to handle the two cases in the same way? > Regards, > Marco.

⚡Generated with XQuery