Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 40598 invoked from network); 2 Feb 2004 18:18:25 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Feb 2004 18:18:25 -0000 Received: (qmail 59476 invoked by uid 500); 2 Feb 2004 18:17:55 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 59405 invoked by uid 500); 2 Feb 2004 18:17:54 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 59350 invoked by uid 500); 2 Feb 2004 18:17:53 -0000 Received: (qmail 59328 invoked from network); 2 Feb 2004 18:17:53 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 2 Feb 2004 18:17:53 -0000 Received: (qmail 40248 invoked by uid 1135); 2 Feb 2004 18:18:01 -0000 Date: 2 Feb 2004 18:18:01 -0000 Message-ID: <20040202181801.40247.qmail@minotaur.apache.org> From: remm@apache.org To: jakarta-tomcat-jasper-cvs@apache.org Subject: cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java 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 remm 2004/02/02 10:18:01 Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java Log: - Revert useBean optimization done by Kin-Man, as it seems to violate the spec wording (which basically says that an error should occur at runtime if the class is not a JavaBean). - Bug 26507. Revision Changes Path 1.217 +31 -35 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.216 retrieving revision 1.217 diff -u -r1.216 -r1.217 --- Generator.java 31 Jan 2004 01:56:28 -0000 1.216 +++ Generator.java 2 Feb 2004 18:18:00 -0000 1.217 @@ -1261,41 +1261,37 @@ className = attributeValue(beanName, false, String.class); } - out.printil("try {"); - out.pushIndent(); - out.printin(name); - out.print(" = ("); - out.print(type); - out.print(") java.beans.Beans.instantiate("); - out.print("this.getClass().getClassLoader(), "); - out.print(className); - out.println(");"); - out.popIndent(); - /* - * Note: Beans.instantiate throws ClassNotFoundException - * if the bean class is abstract. - */ - out.printil("} catch (ClassNotFoundException exc) {"); - out.pushIndent(); - out.printil( - "throw new InstantiationException(exc.getMessage());"); - out.popIndent(); - out.printil("} catch (Exception exc) {"); - out.pushIndent(); - out.printin("throw new ServletException("); - out.print("\"Cannot create bean of class \" + "); - out.print(className); - out.println(", exc);"); - out.popIndent(); - out.printil("}"); // close of try } else { // Implies klass is not null - // Generate codes to instantiate the bean class - out.printin(name); - out.print(" = new "); - out.print(klass); - out.println("();"); + className = quote(klass); } + out.printil("try {"); + out.pushIndent(); + out.printin(name); + out.print(" = ("); + out.print(type); + out.print(") java.beans.Beans.instantiate("); + out.print("this.getClass().getClassLoader(), "); + out.print(className); + out.println(");"); + out.popIndent(); + /* + * Note: Beans.instantiate throws ClassNotFoundException + * if the bean class is abstract. + */ + out.printil("} catch (ClassNotFoundException exc) {"); + out.pushIndent(); + out.printil( + "throw new InstantiationException(exc.getMessage());"); + out.popIndent(); + out.printil("} catch (Exception exc) {"); + out.pushIndent(); + out.printin("throw new ServletException("); + out.print("\"Cannot create bean of class \" + "); + out.print(className); + out.println(", exc);"); + out.popIndent(); + out.printil("}"); // close of try /* * Set attribute for bean in the specified scope */ --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org