Hi Kin-Man,

I'm just about to look into this. I'll try to have an answer for you by tonight.

- Mark


Kin-Man Chung wrote:
-1.

Remy, please reread JSP 2.0 spec, p 1-101,1-102.  Bullet .2 of the Semantics
section was added to allow for this kind of optimization.  Bullet .5 and .6
will be executed ONLY IF the container choose not to issue translation errors.

-Kin-man


Date: Mon, 02 Feb 2004 18:18:01 +0000
From: [EMAIL PROTECTED]
Subject: cvs commit:

jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java


To: [EMAIL PROTECTED]

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.jav a

Index: Generator.java
===================================================================
RCS file:

/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Gen erator.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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to