You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Laurent Trillaud <lt...@jouve.fr> on 2003/12/16 13:54:32 UTC

[xsp-session-fw] NPE when use getxml with empty tag

Hi
>From the portal engine, for example, when I use <xsp-session-fw:getxml
as="string" context="authentication" path="/authentication/data/title"/> I
got an NPE if this tag is empty.
If I put something on it in the sunrise-user.xml from the portal sample,
it's working fine.
Any idea?
Laurent Trillaud


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: [xsp-session-fw] NPE when use getxml with empty tag

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
I already posted a patch, it is in the CVS.

Best Regards,

Antonio Gallardo



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: [xsp-session-fw] NPE when use getxml with empty tag

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Laurent Trillaud dijo:
> Yes, I know but in this case, I need a string.
> In fact the logicsheet is not safe enough because the java generated is
> ((DocumentFragment) blahblah).getFirstChild().getNodeValue();
> Laurent

I have the following problem with the solution you suggested. I use the
getxml inside a <xsp:expr>:

<xsp:expr>Integer.parseInt(<xsp-session-fw:getxml context="authentication"
path="/authentication/data/loc_id" as="string"/>)</xsp:expr>

This is translated to:

(Integer.parseInt(
        	node = ((DocumentFragment)(XSPSessionFwHelper.getXML(this.manager,
                String.valueOf("authentication"),
                String.valueOf("/authentication/data/loc_id")))).getFirstChild();
        	node != null ? node.getNodeValue() : ""))

In this sample this is a bad compiled code, because we cannot use inside a
function Integer.parseInt 2 instructions:

(DocumentFragment)(XSPSessionFwHelper.getXML(this.manager,
                String.valueOf("authentication"),
                String.valueOf("/authentication/data/loc_id")))).getFirstChild();

and

node != null ? node.getNodeValue() : ""

What we can do?

Best Regards,

Antonio Gallardo

>
>> -----Message d'origine-----
>> De : Antonio Gallardo [mailto:agallardo@agsoftware.dnsalias.com]
>> Envoyé : mardi 16 décembre 2003 14:06
>> À : users@cocoon.apache.org
>> Objet : Re: [xsp-session-fw] NPE when use getxml with empty tag
>>
>> Laurent Trillaud dijo:
>> > Hi
>> >>From the portal engine, for example, when I use <xsp-session-fw:getxml
>> > as="string" context="authentication"
>> path="/authentication/data/title"/>
>> I
>> > got an NPE if this tag is empty.
>> > If I put something on it in the sunrise-user.xml from the portal
>> sample,
>> > it's working fine.
>> > Any idea?
>>
>> Try:
>>
>> as="object"
>>
>> More info @ http://wiki.cocoondev.org/Wiki.jsp?page=XspSessionFw
>>
>> Best Regards,
>>
>> Antonio Gallardo
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [xsp-session-fw] NPE when use getxml with empty tag

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Laurent Trillaud dijo:
> Hi
>>>From the portal engine, for example, when I use <xsp-session-fw:getxml
> as="string" context="authentication" path="/authentication/data/title"/> I
> got an NPE if this tag is empty.
> If I put something on it in the sunrise-user.xml from the portal sample,
> it's working fine.
> Any idea?

Try:

as="object"

More info @ http://wiki.cocoondev.org/Wiki.jsp?page=XspSessionFw

Best Regards,

Antonio Gallardo


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org