Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 37926 invoked from network); 29 Mar 2004 15:42:28 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 29 Mar 2004 15:42:28 -0000 Received: (qmail 84200 invoked by uid 500); 29 Mar 2004 15:42:19 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 84158 invoked by uid 500); 29 Mar 2004 15:42:19 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 84140 invoked from network); 29 Mar 2004 15:42:19 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 29 Mar 2004 15:42:19 -0000 Received: (qmail 5988 invoked by uid 50); 29 Mar 2004 15:42:58 -0000 Date: 29 Mar 2004 15:42:58 -0000 Message-ID: <20040329154258.5987.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: dev@cocoon.apache.org Cc: Subject: DO NOT REPLY [Bug 28017] New: - xsp: generating a XSP computed attribute does not work for ROOT element X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . 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=28017 xsp: generating a XSP computed attribute does not work for ROOT element Summary: xsp: generating a XSP computed attribute does not work for ROOT element Product: Cocoon 2 Version: 2.1.4 Platform: PC OS/Version: Windows XP Status: NEW Severity: Normal Priority: Other Component: core AssignedTo: dev@cocoon.apache.org ReportedBy: wouter.deruyck@cec.eu.int I have experienced some problems generating xml with some computed attributes in the root element. If I try to execute this: String dummy = "aaa"; String s = (String)(request.getParameter("test")); s Execution result is an error because if you look at generated code, the request String object is generated as a class attibute and can't be initialize because the request object is null. : Internal Server Error Message: Language Exception Description: org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Error while instantiating org\apache\cocoon\www\dummy_xsp: java.lang.NullPointerException Sender: org.apache.cocoon.servlet.CocoonServlet Source: Cocoon Servlet Request URI dummy/bb cause java.lang.NullPointerException request-uri /cocoon/dummy/bb full exception chain stacktrace Original Exception: org.apache.cocoon.components.language.LanguageException: Error while instantiating org\apache\cocoon\www\dummy_xsp: java.lang.NullPointerException Second try: Then I thought about moving the logic code after the root tag, and hoped my logic being moved in the generate method: String dummy = "aaa"; String s = (String)(request.getParameter("test")); s This failed with a compilig error: Internal Server Error Message: Language Exception Description: org.apache.cocoon.ProcessingException: Language Exception: org.apache.cocoon.components.language.LanguageException: Error compiling dummy_xsp: ERROR 1 (org\apache\cocoon\www\dummy_xsp.java): ... "", "key", "key", "CDATA", // start error (lines 298-298) "s cannot be resolved" String.valueOf(s) + " " // end error ); this.contentHandler.startElement( ... Line 298, column 0: s cannot be resolved Sender: org.apache.cocoon.servlet.CocoonServlet Source: Cocoon Servlet Request URI dummy/bb cause org.apache.cocoon.components.language.LanguageException: Error compiling dummy_xsp: ERROR 1 (org\apache\cocoon\www\dummy_xsp.java): ... "", "key", "key", "CDATA", // start error (lines 298-298) "s cannot be resolved" String.valueOf(s) + " " // end error ); this.contentHandler.startElement( ... Line 298, column 0: s cannot be resolved This is because the generation of the attibute xspAttr.addAttribute( "", "key", "key", "CDATA", String.valueOf(s) + " " ); is done after the declaration of the s variable!!! If I move the code a little bit forward in the attribute tag I also experienced that problem. The only "turnaround" I found is putting an "artificial" root element like here under and remove it afterword but it causes other troubles in my following treatments: