You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2004/03/20 22:39:52 UTC

DO NOT REPLY [Bug 27818] New: - Cannot execute method named as "delete" from javascript in flow

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27818>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27818

Cannot execute method named as "delete" from javascript in flow

           Summary: Cannot execute method named as "delete" from javascript
                    in flow
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Blocker
          Priority: Other
         Component: Flowscript
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: create@insert.com.pl


Error message is:

org.apache.avalon.framework.CascadingRuntimeException: missing name after . 
operator

problematic code:

session.delete(bean);

Cocoon tries to interprete delete as standard delete function from JavaScript 
instead of method of object session.
Solution for this problem is to use java reflection and it's also not so simple 
because "class" is also reserved word and Packages.java.lang.Object.class 
returns the same exception.

Correct invocation of above code is:

var paramDefs = new Array(1);
paramDefs[0] = new Packages.java.lang.Class.forName("java.lang.Object");
var method = session.getClass().getMethod("delete", paramDefs);		
var paramValues = new Array(1);
paramValues[0] = bean;
method.invoke(session, paramValues);