DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25951>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25951 implicit variable declaration causes double setup/invalidate of FOM_Cocoon Summary: implicit variable declaration causes double setup/invalidate of FOM_Cocoon Product: Cocoon 2 Version: 2.1.2 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Flowscript AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] While making my own flowscripts using JXForms + flowscript I found that implicit variable declaration (without var) in nested validation function will cause very weird mixup of two FOM_Cocoon instances and it causes double calling setup() and later invalidate() on same FOM_Coccon instance. This causes NullPointerException in Cocoon 2.1.2 (FOM_Coccon.invalidate) and is worked around (or rather masked) in revision 1.15 of FOM_Cocoon.java. However it does not solve the problem. Howto reproduce --------------- Edit feedbackWizard.js in samples/jxforms - add implicit variable 'carshMe' there: form.sendView("wizard/deployment.xml", function(form) { var bean = form.getModel(); crashMe = new java.util.Date(); // XXX: note missing var cocoon.log.info("dddd: "+crashMe); cocoon.log.info("I can also do validation in JavaScript"); if (bean.publish) { form.addViolation("/publish", "Sorry, I won't let you publish"); } }); After calling this validation function and making further actions (back and submit etc) - this will cause NullPointerExeption in Cocoon 2.1.2, because two instances of FOM_Coccon (one for Function Call and later for Continuation) are mixed now - both FOM_JavaScriptInterpreter.callFunction and handleContinuation will now call cocoon.setup() and cocoon.invalidate() 2 times on same instance! Workaround ---------- is simple. Never forget to declare variables using var, i.e.: replace crashMe = new java.util.Date(); // XXX: note missing var with var crashMe = new java.util.Date(); (note - restart jetty after that change to clear session state, otherwise the problem will persist). -------------------- Unfortunately I do not know what is the real difference between implicit declaration and explicit var declaration, but it seems to have strange effects...
