You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@locus.apache.org on 2000/04/05 23:09:59 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/compiler BeanGenerator.java

mandar      00/04/05 14:09:59

  Modified:    src/share/org/apache/jasper/compiler BeanGenerator.java
  Log:
  Fix for bug #183
  
  Fixed the bug in the generated code that occurs when you specify
  beanName as a request-time expression in a useBean tag.
  
  Revision  Changes    Path
  1.5       +13 -7     jakarta-tomcat/src/share/org/apache/jasper/compiler/BeanGenerator.java
  
  Index: BeanGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BeanGenerator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BeanGenerator.java	1999/11/24 01:11:00	1.4
  +++ BeanGenerator.java	2000/04/05 21:09:58	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BeanGenerator.java,v 1.4 1999/11/24 01:11:00 mandar Exp $
  - * $Revision: 1.4 $
  - * $Date: 1999/11/24 01:11:00 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/BeanGenerator.java,v 1.5 2000/04/05 21:09:58 mandar Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/05 21:09:58 $
    * The Apache Software License, Version 1.1
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -77,6 +77,7 @@
   	Hashtable attrs;
   	BeanRepository beanInfo;
   	boolean genSession;
  +	boolean beanRT = false;
     
       public BeanGenerator (Mark start, Hashtable attrs, BeanRepository beanInfo,
   			  boolean genSession) {
  @@ -161,13 +162,13 @@
   	    String  clsname    = getAttribute ("class");
   	    String  type       = getAttribute ("type");
   	    String  beanName   = getAttribute ("beanName");
  -
   	    
   	    if (type == null) type = clsname;
   
   	    // See if beanName is a request-time expression.
   	    if (beanName != null && JspUtil.isExpression (beanName)) {
   		beanName = JspUtil.getExpr (beanName);
  +		beanRT = true;
   	    }
   	    
   	    if (scope == null || scope.equals ("page")) {
  @@ -340,9 +341,14 @@
   	if (beanName != null) clsname = beanName;
   	writer.println ("try {");
   	writer.pushIndent ();
  -	writer.println(varname+" = ("+ convert + 
  -		       ") Beans.instantiate(getClassLoader(), "+
  -		       writer.quoteString(clsname) +");");
  +	if (beanRT == false)
  +	    writer.println(varname+" = ("+ convert + 
  +			   ") Beans.instantiate(getClassLoader(), "+
  +			   writer.quoteString(clsname) +");");
  +	else
  +	    writer.println(varname+" = ("+ convert + 
  +			   ") Beans.instantiate(getClassLoader(), "+
  +			   clsname +");");
   	writer.popIndent ();
   	writer.println ("} catch (Exception exc) {");
   	writer.pushIndent ();