You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthew Cordes <mc...@maine.edu> on 2001/02/22 17:16:11 UTC
esql get-colums nullpointerexception
Hello all. I'm getting a null pointer exception when using
<esql:get-columns/> on columns that contain null values. It seems to
me this is the offending bit of code:
for (int _esql_i=1; _esql_i <= _esql_query.resultset_metadata.getColumnCount(); _esql_i++) {
Node _esql_node = document.createElement(_esql_query.resultset_metadata.getColumnName(_esql_i));
/** get-string-encoded appears to return a null string,
which when added to the dom causes the exception */
_esql_node.appendChild(document.createTextNode(
<xsl:call-template name="get-string-encoded">
<xsl:with-param name="column-spec">_esql_i</xsl:with-param>
<xsl:with-param name="resultset">_esql_query.resultset</xsl:with-param>
</xsl:call-template>
));
xspCurrentNode.appendChild(_esql_node);
}
I propose something like this:
String nodeText = String.valueOf(
<xsl:call-template name="get-string-encoded"
<xsl:with-param name="column-spec">_esql_i</xsl:with-param>
<xsl:with-param name="resultset">_esql_query.resultset</xsl:with-param>
</xsl:call-template>
);
if ( nodeText != null )
{
_esql_node.appendChild( document.createTextNode( nodeText ));
xspCurrentNode.appendChild(_esql_node);
}
Anyone else have this problem?
-matt