commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl BeanTagScript.java
Date Tue, 28 May 2002 23:38:57 GMT
jstrachan    02/05/28 16:38:57

  Modified:    jelly/src/java/org/apache/commons/jelly/impl
                        BeanTagScript.java
  Log:
  Removed some over zealous checking code that was rejecting the setting of bean properties
that are primitive types.
  Also now throw a much more descriptive error if problems occur, describing the tag, its
method name and the value type being used.
  
  Revision  Changes    Path
  1.8       +20 -11    jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java
  
  Index: BeanTagScript.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BeanTagScript.java	25 May 2002 18:27:22 -0000	1.7
  +++ BeanTagScript.java	28 May 2002 23:38:57 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java,v
1.7 2002/05/25 18:27:22 jstrachan Exp $
  - * $Revision: 1.7 $
  - * $Date: 2002/05/25 18:27:22 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/BeanTagScript.java,v
1.8 2002/05/28 23:38:57 jstrachan Exp $
  + * $Revision: 1.8 $
  + * $Date: 2002/05/28 23:38:57 $
    *
    * ====================================================================
    *
  @@ -57,7 +57,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    *
  - * $Id: BeanTagScript.java,v 1.7 2002/05/25 18:27:22 jstrachan Exp $
  + * $Id: BeanTagScript.java,v 1.8 2002/05/28 23:38:57 jstrachan Exp $
    */
   
   package org.apache.commons.jelly.impl;
  @@ -91,7 +91,7 @@
   /** <p><code>TagScript</code> evaluates a custom tag.</p>
     *
     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
  -  * @version $Revision: 1.7 $
  +  * @version $Revision: 1.8 $
     */
   
   public class BeanTagScript extends TagScript {
  @@ -207,14 +207,23 @@
               // convert value to correct type
               if (value != null) {
                   value = convertType(value, type);
  -
  -                Class theClass = value.getClass();
  -                if ( ! type.isAssignableFrom( theClass ) ) {
  -                    log.warn( "Cannot call method: " + method.getName() + " as I cannot
convert: " + value + " of type: " + theClass.getName() + " into type: " + type.getName() );
  -                }
               }            
               Object[] arguments = { value };
  -            method.invoke(tag, arguments);
  +            try {
  +                method.invoke(tag, arguments);
  +            }
  +            catch (Exception e) {
  +                String valueTypeName = (value != null ) ? value.getClass().getName() :
"null";
  +                log.warn( 
  +                    "Cannot call method: " + method.getName() + " as I cannot convert:
" 
  +                    + value + " of type: " + valueTypeName + " into type: " + type.getName()

  +                );
  +                throw new JellyException( 
  +                    "Cannot call method: " + method.getName() + " on tag of type: " 
  +                    + tag.getClass().getName() + " with value: " + value + " of type: "

  +                    + valueTypeName + ". Exception: " + e, e 
  +                );
  +            }
           }
           tag.doTag(output);
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message