You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Pavel Ausianik <Pa...@epam.com> on 2002/11/18 17:19:28 UTC

RE: cvs commit: xml-soap/java/src/org/apache/soap/util/xml NSStac k.java

Scott,

Sorry if there a bugs in NSStack, certainly I didn't wanted to add you more
work. Somehow I got feeling that popScope() called one time more than
pushScope(), now I see that I was wrong.

>        public void popScope() {
>   +        iterator = scope[top];
>            scope[top] = 0;
>            top--;
>   -        iterator = top >= 0 ? scope[top] : 0;
>        }

Pavel

Re: cvs commit: xml-soap/java/src/org/apache/soap/util/xml NSStack.java

Posted by Scott Nichol <sn...@scottnichol.com>.
> Sorry if there a bugs in NSStack, certainly I didn't wanted to add you
more
> work.

We all produce bugs: the more code, the more bugs!  But with unit tests,
we can find more bugs early.  That's why I wrote the unit tests for
NSStack.  I could not see any bugs from reading the code, but I knew
that the tests might reveal something I was not seeing, which they did.
In fact, while debugging the tests themselves, I found bugs I'd put in
the toString method I added.

> Somehow I got feeling that popScope() called one time more than
> pushScope(), now I see that I was wrong.

Actually, it was my assumption that they were called in the normal stack
pattern.  In fact, you will see that in something like Body#marshall,
the pushScope is actually done within AttributeHandler#populateNSStack,
a side effect of the call that must be balanced with the explicit
popScope call at the end of Body#marshall.  Yuck.

Scott Nichol


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: cvs commit: xml-soap/java/src/org/apache/soap/util/xml NSStack.java

Posted by Scott Nichol <sn...@scottnichol.com>.
> Sorry if there a bugs in NSStack, certainly I didn't wanted to add you
more
> work.

We all produce bugs: the more code, the more bugs!  But with unit tests,
we can find more bugs early.  That's why I wrote the unit tests for
NSStack.  I could not see any bugs from reading the code, but I knew
that the tests might reveal something I was not seeing, which they did.
In fact, while debugging the tests themselves, I found bugs I'd put in
the toString method I added.

> Somehow I got feeling that popScope() called one time more than
> pushScope(), now I see that I was wrong.

Actually, it was my assumption that they were called in the normal stack
pattern.  In fact, you will see that in something like Body#marshall,
the pushScope is actually done within AttributeHandler#populateNSStack,
a side effect of the call that must be balanced with the explicit
popScope call at the end of Body#marshall.  Yuck.

Scott Nichol