rdonkin 2003/07/01 12:10:45 Modified: betwixt/src/java/org/apache/commons/betwixt ElementDescriptor.java betwixt/src/java/org/apache/commons/betwixt/io BeanRuleSet.java Log: Improved tracing whilst searching for bug. Revision Changes Path 1.10 +6 -6 jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/ElementDescriptor.java Index: ElementDescriptor.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/ElementDescriptor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ElementDescriptor.java 16 May 2003 13:32:00 -0000 1.9 +++ ElementDescriptor.java 1 Jul 2003 19:10:45 -0000 1.10 @@ -482,6 +482,6 @@ return "ElementDescriptor[qname=" + getQualifiedName() + ",pname=" + getPropertyName() + ",class=" + getPropertyType() + ",singular=" + getSingularPropertyType() - + ",updater=" + getUpdater() + "]"; + + ",updater=" + getUpdater() + ",wrap=" + isWrapCollectionsInElement() + "]"; } } 1.6 +40 -6 jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/BeanRuleSet.java Index: BeanRuleSet.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/io/BeanRuleSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- BeanRuleSet.java 11 Apr 2003 21:27:42 -0000 1.5 +++ BeanRuleSet.java 1 Jul 2003 19:10:45 -0000 1.6 @@ -180,6 +180,9 @@ * @param digester the <code>Digester</code> to which the rules for the bean will be added */ public void addRuleInstances(Digester digester) { + if (log.isTraceEnabled()) { + log.trace("Adding rules to:" + digester); + } ReadContext readContext = new ReadContext( digester ); } @@ -273,12 +276,18 @@ } int removeSlash = prefix.endsWith("/")?1:0; path = "*/" + prefix.substring(index, prefix.length()-removeSlash); - }else{ + if (log.isTraceEnabled()) { + log.trace("Added wrapped rule for " + childDescriptor); + } + } else { // we have a element/element type of thing.. ElementDescriptor[] desc = currentDescriptor.getElementDescriptors(); if (desc.length == 1) { path = "*/"+desc[0].getQualifiedName(); } + if (log.isTraceEnabled()) { + log.trace("Added not wrapped rule for " + childDescriptor); + } } addRule( path, childDescriptor, context ); continue; @@ -304,10 +313,18 @@ if ( grandChildQName != null && grandChildQName.length() > 0 ) { if (childDescriptor.isWrapCollectionsInElement()) { path += '/' + grandChildQName; + if (log.isTraceEnabled()) { + log.trace("Descriptor wraps elements in collection, path:" + path); + } } else { path = prefix + (prefix.endsWith("/")?"":"/") + grandChildQName; + if (log.isTraceEnabled()) { + log.trace( + "Descriptor does not wrap elements in collection, path:" + + path); + } } } } @@ -353,8 +370,14 @@ ElementDescriptor getElementDescriptor( ElementDescriptor propertyDescriptor ) { Class beanClass = propertyDescriptor.getSingularPropertyType(); if ( beanClass != null && !Map.class.isAssignableFrom( beanClass ) ) { + if (log.isTraceEnabled()) { + log.trace("Filling descriptor for: " + beanClass); + } try { XMLBeanInfo xmlInfo = introspector.introspect( beanClass ); + if (log.isTraceEnabled()) { + log.trace("Is wrapped? " + xmlInfo.getElementDescriptor().isWrapCollectionsInElement()); + } return xmlInfo.getElementDescriptor(); } catch (Exception e) { @@ -431,6 +454,9 @@ if ( ! rulesByPath.containsKey( path ) ) { if ( log.isDebugEnabled() ) { log.debug( "Added rule for path: " + path + " rule: " + rule ); + if (log.isTraceEnabled()) { + log.trace( rulesByPath ); + } } rulesByPath.put( path, rule ); return true; @@ -620,6 +646,11 @@ } } + if (log.isTraceEnabled()) { + log.trace("Created bean " + instance); + log.trace("Path prefix: " + pathPrefix); + } + // add bean for ID matching if ( matchIDs ) { // XXX need to support custom ID attribute names @@ -645,6 +676,9 @@ Object instance = context.getBean(); Object top = digester.pop(); + if (log.isTraceEnabled()) { + log.trace("Popped " + top); + } if (digester.getCount() == 0) { context.setBean(null); }else{
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]