You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Brett Keating <br...@2roam.com> on 2000/01/26 00:44:53 UTC

bug in BaseMarkupSerializer

Hello.

I've discovered a bug in org.apache.xml.serialize.BaseMarkupSerializer. It
resides within:

ElementState enterElementState( String, boolean )

The problem involves the resizing of the array "_elementStates." I found
that with XML documents that have a depth of greater than about 5 or 6 I was
getting a NullPointerException at the line "state.tagName = tagName" (right
after the "if" statement). I also noticed that the array "_elementStates" is
initialized to be of size 5.

To work around the problem, I increased the initial size of "_elementStates"
to be 50, and recompiled. After I did this, I had no problems whatsoever.
Thus, I firmly believe that the logic involved in the array resizing is
faulty, since if no resizing is necessary I get no errors, but if it becomes
necessary I do get errors.

Thanks,
Brett Keating


Re: bug in BaseMarkupSerializer

Posted by Assaf Arkin <ar...@exoffice.com>.
Very strange. I've double and triple checked the logic and I couldn't
find a reason for it. On my machine it works without complaining and can
properly resize two times in a row.

arkin


Brett Keating wrote:
> 
> Hello.
> 
> I've discovered a bug in org.apache.xml.serialize.BaseMarkupSerializer. It
> resides within:
> 
> ElementState enterElementState( String, boolean )
> 
> The problem involves the resizing of the array "_elementStates." I found
> that with XML documents that have a depth of greater than about 5 or 6 I was
> getting a NullPointerException at the line "state.tagName = tagName" (right
> after the "if" statement). I also noticed that the array "_elementStates" is
> initialized to be of size 5.
> 
> To work around the problem, I increased the initial size of "_elementStates"
> to be 50, and recompiled. After I did this, I had no problems whatsoever.
> Thus, I firmly believe that the logic involved in the array resizing is
> faulty, since if no resizing is necessary I get no errors, but if it becomes
> necessary I do get errors.
> 
> Thanks,
> Brett Keating

-- 
----------------------------------------------------------------------
Assaf Arkin                                           www.exoffice.com
CTO, Exoffice Technologies, Inc.                        www.exolab.org



Re: bug in BaseMarkupSerializer

Posted by Assaf Arkin <ar...@exoffice.com>.
Very strange. I've double and triple checked the logic and I couldn't
find a reason for it. On my machine it works without complaining and can
properly resize two times in a row.

arkin


Brett Keating wrote:
> 
> Hello.
> 
> I've discovered a bug in org.apache.xml.serialize.BaseMarkupSerializer. It
> resides within:
> 
> ElementState enterElementState( String, boolean )
> 
> The problem involves the resizing of the array "_elementStates." I found
> that with XML documents that have a depth of greater than about 5 or 6 I was
> getting a NullPointerException at the line "state.tagName = tagName" (right
> after the "if" statement). I also noticed that the array "_elementStates" is
> initialized to be of size 5.
> 
> To work around the problem, I increased the initial size of "_elementStates"
> to be 50, and recompiled. After I did this, I had no problems whatsoever.
> Thus, I firmly believe that the logic involved in the array resizing is
> faulty, since if no resizing is necessary I get no errors, but if it becomes
> necessary I do get errors.
> 
> Thanks,
> Brett Keating

-- 
----------------------------------------------------------------------
Assaf Arkin                                           www.exoffice.com
CTO, Exoffice Technologies, Inc.                        www.exolab.org