Hi,

I am having a strange problem with marshaling data sent from the server that
is hard to trace and to reproduce - unfortunately, I am unable to provide a
playground example that would demonstrate it. But I'll try to be as detailed
as possible. 

In the qcl contrib, I have a JsonRpc data store that loads and marshals json
data retrieved from a RPC service (qcl.data.store.JsonRpc):

https://qooxdoo-contrib.svn.sourceforge.net/svnroot/qooxdoo-contrib/trunk/qooxdoo-contrib/qcl/trunk/source/class/qcl/data/store/JsonRpc.js

Lines 453seqq marshal the data:

              try
              {
                /*
                 * create the class
                 */
                this.getMarshaler().toClass( data, true);

                if( this.getModel() )
                {
                  //this.getModel().dispose();
                  //debugger;
                }
                
                /*
                 * set the initial data
                 */
                var model = this.getMarshaler().toModel(data);
                this.setModel( model );
              }
              catch(e)
              {
                this.warn("Error during marshaling of data: ");
                this.info(qx.dev.StackTrace.getStackTrace().join("\n")); 
                this.error(e);
                return;
              }

This works flawlessly when the data structure is the same. However, if the
json data changes and thus a different model is set in the line 
"this.setModel( model );", an assertion error is thrown:

http://qooxdoo.678.n2.nabble.com/file/n5328742/AssertionErrorInFirebug.png 

The information that firebug displays on the location of the exception is
nonsense, seems like when events and callbacks are involved, FireBug gets
confused about the stack trace. But equally, when I try to get the source of
the exception using "qx.dev.StackTrace.getStackTraceFromError(e)", the
output is "(Empty String)", so I have to use
"qx.dev.StackTrace.getStackTrace()", getting:

022827 qcl.data.store.JsonRpc[1756]:
qcl.data.store.JsonRpc.js?nocache=0.35452263788220684:477
qx.lang.Function.js?nocache=0.03206942383783917:287
qx.io.remote.Rpc.js?nocache=0.3714516615916562:486
qx.io.remote.Rpc.js?nocache=0.3714516615916562:625
qx.event.dispatch.Direct.js?nocache=0.32366629537529046:123
qx.Interface.js?nocache=0.13387044516077973:450
qx.event.Manager.js?nocache=0.5590593837975364:847
qx.event.Registration.js?nocache=0.5653852661350789:276
qx.core.Object.js?nocache=0.21255860484354405:441
qx.io.remote.Request.js?nocache=0.7988190072399243:544
qx.io.remote.Request.js?nocache=0.7988190072399243:609
qx.io.remote.RequestQueue.js?nocache=0.32520969258130394:342
qx.event.dispatch.Direct.js?nocache=0.32366629537529046:123
qx.Interface.js?nocache=0.13387044516077973:450
qx.event.Manager.js?nocache=0.5590593837975364:847
qx.event.Registration.js?nocache=0.5653852661350789:276
qx.core.Object.js?nocache=0.21255860484354405:441
qx.io.remote.Exchange.js?nocache=0.24461512668865504:997
qx.core.Property.js?nocache=0.6210237577429126:719
qx.io.remote.Exchange.js?nocache=0.24461512668865504:787
qx.event.dispatch.Direct.js?nocache=0.32366629537529046:123
qx.Interface.js?nocache=0.13387044516077973:450
qx.event.Manager.js?nocache=0.5590593837975364:847
qx.event.Registration.js?nocache=0.5653852661350789:307
qx.core.Object.js?nocache=0.21255860484354405:461
qx.io.remote.transport.XmlHttp.js?nocache=0.1431686665219969:905
qx.core.Property.js?nocache=0.6210237577429126:719
qx.io.remote.transport.XmlHttp.js?nocache=0.1431686665219969:448
qx.event.GlobalError.js?nocache=0.2771662485115506:112
qx.lang.Function.js?nocache=0.03206942383783917:287

Is there some intrinsic problem with assertions and error reporting? Or does
this have to do with the exception being thrown inside an event callback,
namely, the xmlhttp event when the data has returned from the server?

So I was forced to step-debug to find out what was happening. As it turned
out, there seems to be a problem with removing event listeners, probably on
the old model which is replaced by the new one, at least it seems. The first
place where the error was visible was in
SingleValueBinding.__chainListener():

http://qooxdoo.678.n2.nabble.com/file/n5328742/SingleValueBinding.__chainListener.png
 

As you can see in the screenshot, context.listenerIds[j] is undefined
because it has only 2 items and the variable "j" is 2. This will then later
lead to an assertion error, as you can see in the following screenshots:

http://qooxdoo.678.n2.nabble.com/file/n5328742/Object.removeListenerById.png 
http://qooxdoo.678.n2.nabble.com/file/n5328742/Manager.removeListenerById.png 

So my question is: is this a bug in the framework or due to a wrong usage of
the marshaler? If the latter, shouldn't there be a check in place that traps
the error much earlier, avoiding a assertion error that is incomprehensible
to the end-user?

Thanks for looking into this. I am happy to open a bug report for this.

Christian
-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Problem-with-marshaling-possible-bug-tp5328742p5328742.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to