commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-commons/digester/src/java/org/apache/commons/digester Digester.java
Date Wed, 14 Nov 2001 18:42:16 GMT
craigmcc    01/11/14 10:42:16

  Modified:    digester/src/java/org/apache/commons/digester Digester.java
  Log:
  Add some debugging messages to help diagnose what Digester is eating for lunch
  :-).  (NOTE:  I didn't implement the functional change of storing
  Strings on "bodyTexts" instead of StringBuffers, because all users would pay
  the conversion penalties even when debugging was turned off.)
  
  Submitted by:  Robert Burrell Donkin <robertdonkin@mac.com>
  
  Revision  Changes    Path
  1.24      +26 -7     jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java
  
  Index: Digester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Digester.java	2001/10/16 23:46:34	1.23
  +++ Digester.java	2001/11/14 18:42:16	1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
1.23 2001/10/16 23:46:34 craigmcc Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/10/16 23:46:34 $
  + * $Header: /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/Digester.java,v
1.24 2001/11/14 18:42:16 craigmcc Exp $
  + * $Revision: 1.24 $
  + * $Date: 2001/11/14 18:42:16 $
    *
    * ====================================================================
    *
  @@ -108,7 +108,7 @@
    *
    * @author Craig McClanahan
    * @author Scott Sanders
  - * @version $Revision: 1.23 $ $Date: 2001/10/16 23:46:34 $
  + * @version $Revision: 1.24 $ $Date: 2001/11/14 18:42:16 $
    */
   
   public class Digester extends DefaultHandler {
  @@ -719,9 +719,12 @@
       public void endElement(String namespaceURI, String localName,
                              String qName) throws SAXException {
   
  -        if (debug >= 3)
  +        if (debug >= 3) {
               log("endElement(" + namespaceURI + "," + localName +
                   "," + qName + ")");
  +            log("  match='" + match + "'");
  +            log("  bodyText='" + bodyText + "'");
  +        }
   
   	// Fire "body" events for all relevant rules
   	List rules = getRules().match(namespaceURI, match);
  @@ -741,10 +744,15 @@
   		    throw createSAXException(t.getMessage());
                   }
   	    }
  -	}
  +	} else {
  +            if (debug >= 3)
  +                log("  No rules found matching '" + match + "'.");
  +        }
   
   	// Recover the body text from the surrounding element
   	bodyText = (StringBuffer) bodyTexts.pop();
  +        if (debug >= 4)
  +            log("  Popping body text '" + bodyText.toString() + "'");
   
   	// Fire "end" events for all relevant rules in reverse order
   	if (rules != null) {
  @@ -913,6 +921,8 @@
   
   	// Save the body text accumulated for our surrounding element
   	bodyTexts.push(bodyText);
  +        if (debug >= 4)
  +            log("  Pushing body text '" + bodyText.toString() + "'");
   	bodyText.setLength(0);
   
   	// Compute the current matching rule
  @@ -945,7 +955,10 @@
   		    throw createSAXException(t.getMessage());
   		}
   	    }
  -	}
  +	} else {
  +            if (debug >= 3)
  +                log("  No rules found matching '" + match + "'.");
  +        }
   
       }
   
  @@ -1576,6 +1589,8 @@
   	try {
   	    return (stack.peek());
   	} catch (EmptyStackException e) {
  +            if (debug >= 1)
  +                log("Empty stack (returning null)");
   	    return (null);
   	}
   
  @@ -1595,6 +1610,8 @@
   	try {
   	    return (stack.peek(n));
   	} catch (EmptyStackException e) {
  +            if (debug >= 1)
  +                log("Empty stack (returning null)");
   	    return (null);
   	}
   
  @@ -1610,6 +1627,8 @@
   	try {
   	    return (stack.pop());
   	} catch (EmptyStackException e) {
  +            if (debug >= 1)
  +                log("Empty stack (returning null)");
   	    return (null);
   	}
   
  
  
  

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