You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Irv Salisbury <ir...@gmail.com> on 2005/06/24 02:27:17 UTC

2nd time through form call

We have a flowscript method that shows a form.  After the form is
submitted, we call a sendPage that will essentially show a new
instance of that same form.  With the released rhino version in cocoon
2.1.7, this works fine.  However, for the weblogic workaround of using
the 1.6 released version of rhino we are getting a null pointer
exception.

Here is our method

function addForm( module, screen, tab, originalRequestString ){
  var formDefUrl = "cocoon:/" + getRootUrl() +
"internal/addFormDefinition/" + getTabPath( module, screen, tab );
  cocoon.log.info( "Form def url is: " + formDefUrl );
  var form = new Form( formDefUrl );
  var formBindUrl = "cocoon:/" + getRootUrl() +
"internal/addFormBinding/" + getTabPath( module, screen, tab );
  cocoon.log.info( "Form bind url is: " + formBindUrl );
  form.createBinding( formBindUrl );
	var pipelineUtil = cocoon.createObject( PipelineUtil );
  cocoon.log.info( "About to show add form " );

  //this is needed for grid/repeater stuff
  var screenObject = cocoon.request.getAttribute( "screenObject" );
  /*
  form.restoreHook = 
    function(theForm) { 
      cocoon.log.debug( "Cocoon request is " + cocoon.request );
      cocoon.log.debug( "Screen object is " + screenObject );
      cocoon.request.setAttribute( "screenObject", screenObject ); 
    };
    */
  form.showForm( (getRootUrl() + "style/addForm/" + getTabPath(
module, screen, tab )) );

  // TODO: Need to kill continuations from client side call if tab is changed
  // This is only called if action is performed on the form (submit)
  var dataObject =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  form.save( dataObject );
  if( cocoon.log.isDebugEnabled() ){
    var stringRep = XMLUtils.serializeNode( dataObject );
    cocoon.log.debug ("Data object from add is " + stringRep );
  }
  cocoon.request.setAttribute( "dataObject", dataObject );
  var dataAddUrl = getRootUrl() + "internal/dataAdd/" + getTabPath(
module, screen, tab );
  var xmlSaxHandler =
XmlBeans.getContextTypeLoader().newXmlSaxHandler(
SessionDataDocument.SessionData.LastOperation.type, null );
  cocoon.log.debug( "Sax handler is" + xmlSaxHandler );
  cocoon.log.debug( "Data add url is " + dataAddUrl );

	pipelineUtil.processToSAX( dataAddUrl + "?" + originalRequestString,
null, xmlSaxHandler.getContentHandler() );
  var addResults = xmlSaxHandler.getObject();
  if( cocoon.log.isDebugEnabled() ){
    cocoon.log.debug ("Add results are " + addResults );
  }

    setLastOperation( addResults );
    var id = "";
    if( (addResults != null) && (addResults.isSetSuccess()) ){
      var valueArray = addResults.getValueArray();
      if( valueArray.length < 1 ){
      }
      else {
        id = valueArray[0].getStringValue();
      }
    }
    else {
      var errorMessage = null;
      if( addResults == null ){
        errorMessage = "No add results";
      }
      else {
        errorMessage = addResults.getFailure().getMessage();
      }
    }
    cocoon.sendPage( getRootUrl() + "screen/" + getTabPath( module,
screen, tab ) + "?" + originalRequestString );
}

The last call to sendPage will essentially bring us back to the same
showForm.  After the second showForm call we get a null pointer
exception trying to access the form object.  So, something is very
different between mozilla 1.6R and the rhino with cocoon 2.1.7

So, is there something I can do differently?  Is there something I
should be doing to cleanup continuations or something?

Irv

Re: 2nd time through form call

Posted by Irv Salisbury <ir...@gmail.com>.
Here is the stacktrace, in case it helps:

org.mozilla.javascript.WrappedException: Wrapped
java.lang.NullPointerException
(resource://org/apache/cocoon/forms/flow/javascript/Form.js#136)
	at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1776)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:191)
	at org.mozilla.javascript.ScriptableObject.getByGetter(ScriptableObject.java:1617)
	at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:177)
	at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1263)
	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1332)
	at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1321)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2744)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
	at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
	at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
	at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145)
	at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
	at org.mozilla.javascript.Context.call(Context.java:497)
	at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1496)
	at org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:1466)
	at org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.handleContinuation(FOM_JavaScriptInterpreter.java:843)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:123)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:117)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:608)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1123)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at com.dotech.cocoon.servlet.filter.CurrentDateFilter.doFilter(CurrentDateFilter.java:76)
	at com.dotech.servlet.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:86)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at com.dotech.cocoon.servlet.filter.LoginFilter.doFilter(LoginFilter.java:78)
	at com.dotech.servlet.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:86)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at com.dotech.servlet.filter.FakeRemoteUserFilter.doFilter(FakeRemoteUserFilter.java:70)
	at com.dotech.servlet.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:86)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at com.dotech.servlet.filter.ResponseTimeFilter.doFilter(ResponseTimeFilter.java:43)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
	at org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon.jsGet_request(FOM_Cocoon.java:574)
	at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174)
	... 68 more

On 6/23/05, Irv Salisbury <ir...@gmail.com> wrote:
> We have a flowscript method that shows a form.  After the form is
> submitted, we call a sendPage that will essentially show a new
> instance of that same form.  With the released rhino version in cocoon
> 2.1.7, this works fine.  However, for the weblogic workaround of using
> the 1.6 released version of rhino we are getting a null pointer
> exception.
> 
> Here is our method
> 
> function addForm( module, screen, tab, originalRequestString ){
>   var formDefUrl = "cocoon:/" + getRootUrl() +
> "internal/addFormDefinition/" + getTabPath( module, screen, tab );
>   cocoon.log.info( "Form def url is: " + formDefUrl );
>   var form = new Form( formDefUrl );
>   var formBindUrl = "cocoon:/" + getRootUrl() +
> "internal/addFormBinding/" + getTabPath( module, screen, tab );
>   cocoon.log.info( "Form bind url is: " + formBindUrl );
>   form.createBinding( formBindUrl );
>         var pipelineUtil = cocoon.createObject( PipelineUtil );
>   cocoon.log.info( "About to show add form " );
> 
>   //this is needed for grid/repeater stuff
>   var screenObject = cocoon.request.getAttribute( "screenObject" );
>   /*
>   form.restoreHook =
>     function(theForm) {
>       cocoon.log.debug( "Cocoon request is " + cocoon.request );
>       cocoon.log.debug( "Screen object is " + screenObject );
>       cocoon.request.setAttribute( "screenObject", screenObject );
>     };
>     */
>   form.showForm( (getRootUrl() + "style/addForm/" + getTabPath(
> module, screen, tab )) );
> 
>   // TODO: Need to kill continuations from client side call if tab is changed
>   // This is only called if action is performed on the form (submit)
>   var dataObject =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>   form.save( dataObject );
>   if( cocoon.log.isDebugEnabled() ){
>     var stringRep = XMLUtils.serializeNode( dataObject );
>     cocoon.log.debug ("Data object from add is " + stringRep );
>   }
>   cocoon.request.setAttribute( "dataObject", dataObject );
>   var dataAddUrl = getRootUrl() + "internal/dataAdd/" + getTabPath(
> module, screen, tab );
>   var xmlSaxHandler =
> XmlBeans.getContextTypeLoader().newXmlSaxHandler(
> SessionDataDocument.SessionData.LastOperation.type, null );
>   cocoon.log.debug( "Sax handler is" + xmlSaxHandler );
>   cocoon.log.debug( "Data add url is " + dataAddUrl );
> 
>         pipelineUtil.processToSAX( dataAddUrl + "?" + originalRequestString,
> null, xmlSaxHandler.getContentHandler() );
>   var addResults = xmlSaxHandler.getObject();
>   if( cocoon.log.isDebugEnabled() ){
>     cocoon.log.debug ("Add results are " + addResults );
>   }
> 
>     setLastOperation( addResults );
>     var id = "";
>     if( (addResults != null) && (addResults.isSetSuccess()) ){
>       var valueArray = addResults.getValueArray();
>       if( valueArray.length < 1 ){
>       }
>       else {
>         id = valueArray[0].getStringValue();
>       }
>     }
>     else {
>       var errorMessage = null;
>       if( addResults == null ){
>         errorMessage = "No add results";
>       }
>       else {
>         errorMessage = addResults.getFailure().getMessage();
>       }
>     }
>     cocoon.sendPage( getRootUrl() + "screen/" + getTabPath( module,
> screen, tab ) + "?" + originalRequestString );
> }
> 
> The last call to sendPage will essentially bring us back to the same
> showForm.  After the second showForm call we get a null pointer
> exception trying to access the form object.  So, something is very
> different between mozilla 1.6R and the rhino with cocoon 2.1.7
> 
> So, is there something I can do differently?  Is there something I
> should be doing to cleanup continuations or something?
> 
> Irv
>