commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester ElementRule.java
Date Mon, 01 Jul 2002 18:52:21 GMT
rdonkin     2002/07/01 11:52:21

  Modified:    betwixt/src/java/org/apache/commons/betwixt/digester
                        ElementRule.java
  Log:
  Added trace logging code
  
  Revision  Changes    Path
  1.2       +25 -4     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java
  
  Index: ElementRule.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/digester/ElementRule.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementRule.java	10 Jun 2002 17:53:34 -0000	1.1
  +++ ElementRule.java	1 Jul 2002 18:52:21 -0000	1.2
  @@ -113,12 +113,18 @@
           String propertyName = attributes.getValue( "property" );
           descriptor.setPropertyName( propertyName );
           
  -        descriptor.setPropertyType( 
  -            getPropertyType( attributes.getValue( "type" ), 
  -                beanClass, propertyName ) 
  -        );
  +        String propertyType = attributes.getValue( "type" );
  +        
  +        if (log.isTraceEnabled()) {
  +            log.trace(
  +                    "(BEGIN) name=" + name + " uri=" + uri 
  +                    + " property=" + propertyName + " type=" + propertyType);
  +        }
           
           // set the property type using reflection
  +        descriptor.setPropertyType( 
  +            getPropertyType( propertyType, beanClass, propertyName ) 
  +        );
           
           
           if ( propertyName != null && propertyName.length() > 0 ) {
  @@ -168,17 +174,27 @@
               try {
                   Class answer = classLoader.loadClass(propertyClassName);
                   if (answer != null) {
  +                    if (log.isTraceEnabled()) {
  +                        log.trace("Used specified type " + answer);
  +                    }
                       return answer;
                   }
               }
               catch (Exception e) {
  +                log.warn("Cannot load specified type", e);
               }
           }
  +        
           PropertyDescriptor descriptor = 
               getPropertyDescriptor( beanClass, propertyName );        
           if ( descriptor != null ) { 
               return descriptor.getPropertyType();
           }
  +        
  +        if (log.isTraceEnabled()) {
  +            log.trace("Cannot find property type.");
  +            log.trace("  className=" + propertyClassName + " base=" + beanClass + " name="
+ propertyName);
  +        }
           return null;            
       }
       
  @@ -205,6 +221,9 @@
       protected PropertyDescriptor getPropertyDescriptor( Class beanClass, 
                                                           String propertyName ) {
           if ( beanClass != null && propertyName != null ) {
  +            if (log.isTraceEnabled()) {
  +                log.trace("Searching for property " + propertyName + " on " + beanClass);
  +            }
               try {
                   BeanInfo beanInfo = Introspector.getBeanInfo( beanClass );
                   PropertyDescriptor[] descriptors = 
  @@ -213,10 +232,12 @@
                       for ( int i = 0, size = descriptors.length; i < size; i++ ) {
                           PropertyDescriptor descriptor = descriptors[i];
                           if ( propertyName.equals( descriptor.getName() ) ) {
  +                            log.trace("Found matching method.");
                               return descriptor;
                           }
                       }
                   }
  +                log.trace("No match found.");
                   return null;
               }
               catch (Exception e) {
  
  
  

--
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