You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Arnaud Bienvenu <ar...@generasound.com> on 2001/08/06 17:24:51 UTC

esql get-colums NullPointerException

When you use <esql:get-columns> and one of your column has a NULL value,
you find yourself with a disgracefull NullPointerException. Here is a patch
for Cocoon2 to have an empty tag instead :

Index: esql.xsl
===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/esql.xsl,v
retrieving revision 1.15
diff -u -r1.15 esql.xsl
--- esql.xsl	2001/07/30 09:20:20	1.15
+++ esql.xsl	2001/08/06 15:14:11
@@ -1079,8 +1079,10 @@
       <xsl:value-of select="$resultset"/>.getString(<xsl:value-of select="$column-spec"/>)
     </xsl:when>
     <xsl:otherwise>
-      new String (<xsl:value-of select="$resultset"/>.getBytes
+      <xsl:value-of select="$resultset"/>.getBytes(<xsl:value-of select="$column-spec"/>)
+      != null ? new String (<xsl:value-of select="$resultset"/>.getBytes
         (<xsl:value-of select="$column-spec"/>), <xsl:value-of select="$encoding"/>)
+      : ""
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>

This solution is inspired from the patch posted by Matthew Cordes on
2001-02-22 about the same problem but applying to Cocoon1.

Comments are very welcome.

Arnaud Bienvenu
http://www.generasound.com/

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: esql get-colums NullPointerException

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 06.Aug.2001 -- 05:24 PM, Arnaud Bienvenu wrote:
> When you use <esql:get-columns> and one of your column has a NULL value,
> you find yourself with a disgracefull NullPointerException. Here is a patch
> for Cocoon2 to have an empty tag instead :

Applied. Please check.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>