cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arnaud Bienvenu <arnaud.bienv...@generasound.com>
Subject esql get-colums NullPointerException
Date Mon, 06 Aug 2001 15:24:51 GMT
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message