cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barber, Dan" <Barber....@pennmutual.com>
Subject xform repeat and java beans: null pointer exception
Date Fri, 21 Mar 2003 17:00:33 GMT
Hi,

There might be a simple solution to this problem, but I have not been able to find it.  Here
is the problem:

I have a Java Bean that returns an array of objects.  I try to display the list using the
xf:repeat in an xml file.  Here's the bean, xml and sitemap entries:

------------------------------------------------------
Cocoon version 2.1 latest CVS files
-------------------------------------------------------
Notes: I have all log levels set to DEBUG.  I haven't found any useful info listed in the
log file.

-------------
start.xml
--------------

<?xml version="1.0" ?>
<document xmlns:xf="http://xml.apache.org/cocoon/xmlform/2002">

<xf:form id="form-feedback" view="start" action="ruleset">
<xf:caption>Dummy</xf:caption>
 <xf:output ref="/dummys[2]"/>   <!-- this works fine -->

 <xf:repeat nodeset="/dummys">  <!-- this generates an exception.  Please see exception
below -->
    <xf:output ref="."/>
  </xf:repeat>

</xf:form>
</document>

----------
Bean
----------
public class RuleSetHelperBean
{
	public RuleSetHelperBean() 
	{
		dummys[0] = new String("blah1");
		dummys[1] = new String("blah2");
	}

	public String[] getDummys()
	{
		return dummys;
	}

	public String getDummys(int idx)
	{
		return dummys[idx];
	}

	protected String dummys[] = new String[2];
}

--------------------------------------------------------------
Sitemap entries (relevant to this problem)
--------------------------------------------------------------
....
      <map:action name="RuleSetAction" src="com.test.RuleSetAction"  logger="xmlform.sitemap.action.ruleset"/>
.....
      <map:match pattern="ruleset*">
        <map:act type="RuleSetAction">

          <!-- XMLForm parameters for the AbstractXMLFormAction -->
          <map:parameter name="xmlform-validator-schema-ns" value="http://www.ascc.net/xml/schematron"/>
          <map:parameter name="xmlform-validator-schema" value="schematron/ruleset-xmlform-sch-report.xml"/>
          <map:parameter name="xmlform-id" value="form-feedback"/>
          <map:parameter name="xmlform-scope" value="session"/>
          <map:parameter name="xmlform-model" value="com.test.RuleSetHelperBean"/>

-----------------------------
Browser exception
-----------------------------
An error occurredorg.apache.cocoon.ProcessingExceptionFailed to execute pipeline.org.apache.cocoon.ProcessingException:
Failed to execute pipeline.: java.lang.NullPointerExceptionOriginal exception : java.lang.NullPointerException
at org.apache.xalan.transformer.TransformerIdentityImpl.flushStartDoc(TransformerIdentityImpl.java:888)
at org.apache.xalan.transformer.TransformerIdentityImpl.startPrefixMapping(TransformerIdentityImpl.java:931)
at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode(DOMStreamer.java:442)
at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.stream(DOMStreamer.java:259)
at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:173) at org.apache.cocoon.xml.XMLUtils.serializeNode(XMLUtils.java:230)
at org.apache.cocoon.xml.XMLUtils.serializeNodeToXML(XMLUtils.java:181) at org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(AbstractSAXTransformer.java:496)
at org.apache.cocoon.transformation.XMLFormTransformer.endTransformingElement(XMLFormTransformer.java:965)
at org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(AbstractSAXTransformer.java:355)
at org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:124) at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:579)
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:897)
at 

Thanks!
Dan Barber



Mime
View raw message