remm        2004/02/03 00:27:43

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
  Log:
  - Revert patch.
  
  Revision  Changes    Path
  1.218     +32 -28    
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.217
  retrieving revision 1.218
  diff -u -r1.217 -r1.218
  --- Generator.java    2 Feb 2004 18:18:00 -0000       1.217
  +++ Generator.java    3 Feb 2004 08:27:43 -0000       1.218
  @@ -1261,37 +1261,41 @@
                           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
  -                    className = quote(klass);
  +                    // Generate codes to instantiate the bean class
  +                    out.printin(name);
  +                    out.print(" = new ");
  +                    out.print(klass);
  +                    out.println("();");
                   }
  -                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]

Reply via email to