Try a nightly build.. This has been fixes a couple of weeks ago..
(nightly builds are at : 
http://cvs.apache.org/builds/jakarta-commons/nightly/commons-betwixt/).
If the problem is still in the nightly build, could you file an issue in 
bugzilla about it ?

Mvgr,
Martin

Joseph Larson wrote:
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">
    <unitOrgs>
        <unitOrg unitOrgId="law" name="Law" />
        <unitOrg unitOrgId="fire" name="Fire" />
        <unitOrg unitOrgId="ems" name="EMS" />
        <unitOrg unitOrgId="rescue" name="Rescue" />
    </unitOrgs>
</testdata>


Digging through the code, I find this method in ReadContext.java:

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

        if (!updaterStack.isEmpty()) {
            updaterStack.pop();
        }

        popOptions();

        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 ().getName());
                    return popElement();
                }
                else
                {
                    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:

pushElement()
markClassMap()

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

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

        pushOptions(getOptions());

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.

-Joe





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to