OK I have made a modification in the src/blocks/session-fw/java/org/apache/cocoon/components/languages/markup/xsp /java/session-fw.xml I give you a patch, if someone wants to include it in the CVS. It's working fine for me. Laurent trillaud
> -----Message d'origine----- > De : Laurent Trillaud [mailto:[EMAIL PROTECTED] > Envoyé : mardi 16 décembre 2003 14:21 > À : [EMAIL PROTECTED] > Objet : RE: [xsp-session-fw] NPE when use getxml with empty tag > > 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 > > > -----Message d'origine----- > > De : Antonio Gallardo [mailto:[EMAIL PROTECTED] > > Envoyé : mardi 16 décembre 2003 14:06 > > À : [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED]
Index: session-fw.xsl =================================================================== RCS file: /home/cvspublic/cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/components/language/markup/xsp/java/session-fw.xsl,v retrieving revision 1.2 diff -u -r1.2 session-fw.xsl --- session-fw.xsl 11 Oct 2003 00:02:55 -0000 1.2 +++ session-fw.xsl 16 Dec 2003 16:07:55 -0000 @@ -73,8 +73,12 @@ <xsp:include>org.apache.avalon.framework.component.ComponentManager</xsp:include> <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPSessionFwHelper</xsp:include> <xsp:include>org.w3c.dom.DocumentFragment</xsp:include> + <xsp:include>org.w3c.dom.Node</xsp:include> </xsp:structure> + <xsp:logic> + Node node = null; + </xsp:logic> <xsl:variable name="create"> <xsl:choose> <xsl:when test="@create-session='yes' or @create-session='true'">true</xsl:when> @@ -104,9 +108,12 @@ </xsl:variable> <xsl:choose> <xsl:when test="$as='string'"> - <xsp:expr>((DocumentFragment)(XSPSessionFwHelper.getXML(this.manager, + <xsp:logic> + node = ((DocumentFragment)(XSPSessionFwHelper.getXML(this.manager, String.valueOf(<xsl:copy-of select="$context"/>), - String.valueOf(<xsl:copy-of select="$path"/>)))).getFirstChild().getNodeValue()</xsp:expr> + String.valueOf(<xsl:copy-of select="$path"/>)))).getFirstChild(); + </xsp:logic> + <xsp:expr>node != null ? node.getNodeValue() : ""</xsp:expr> </xsl:when> <xsl:when test="$as='xml'"> <xsp-session-fw:xml>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]