commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Larson <>
Subject Possible bug in Betwixt: Cannot pop options off empty stack
Date Tue, 24 Jan 2006 17:53:40 GMT
If this is the wrong means of reporting this, I apologize.

I believe I have uncovered a bug in betwixt / digester.  I'm not sure  
of the severity of the problem.  It currently manifests itself with  
an INFO message to the logs that looks like:

24-11:23:45  INFO BeanReader - Cannot pop options off empty stack

I spent the morning tracking down this message.  My XML input file  
looks like this:

<?xml version='1.0' encoding="UTF-8" ?>
<testdata foo="gleep">
         <unitOrg unitOrgId="law" name="Law" />
         <unitOrg unitOrgId="fire" name="Fire" />
         <unitOrg unitOrgId="ems" name="EMS" />
         <unitOrg unitOrgId="rescue" name="Rescue" />

Digging through the code, I find this method in

	public String popElement() {
         // since the descriptor stack is populated by pushElement,
         // need to ensure that it's correct popped by popElement
         if (!descriptorStack.isEmpty()) {

         if (!updaterStack.isEmpty()) {


		Object top = null;
		if (!elementMappingStack.isEmpty()) {
			top = elementMappingStack.pop();
			if (top != null) {
				if (!(top instanceof String)) {
					log.debug("Popping more because top is of type: " + top.getClass 
					return popElement();
					log.debug("Popping done: " + top);

		return (String) top;

(I added some debug trying to figure out what was going on.)  As you  
can see, a call to popElement() can recurse under some situations.   
So then I looked for the places that pushOptions() is called.  The  
only call I found was in pushElement(), which made sense.  But then I  
looked at elementMappingStack, and found that he is pushed to in  
other places.  Specifically, this method is called in:


MarkClassMap() also pushes to descriptorStack and updaterStack, but  
does not have a pushOptions().

I added this call to the bottom of markClassMap():


This causes the error message to go away.  But I don't know if it's  
the right fix.

So... I'm not sure what to do with all this info at this point.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message