[Webwork-user] Two small problems
Brought to you by:
baldree,
rickardoberg
From: Tom Q. <qu...@su...> - 2002-05-22 06:59:46
|
Hallo, we found two small bugs in webwork (and more important, two fixes): - in class NodeWalker all attributes of the XML are delete: contentHandler.startElement("", attributeName, "", EMPTY_ATTRS); In my opinion the right way to do this is: contentHandler.startElement("", attributeName, "", saxAttributes); - In class ValueStack the program rely on a final null-value in the segments array: // always have the next segment ready to go segment = segments[segmentIdx++]; // if we don't need to search through the stack then return the value // this is very unlikely to happen, but we have account for it anyway if (segment == null) return value; But the final null-value is not allways there. In Query the array is only extended when there is no more space for a new value: private void add(QuerySegment qs) { if (segmentsIdx == segments.length) { QuerySegment[] resize = new QuerySegment[segments.length + 5]; System.arraycopy(segments, 0, resize, 0, segments.length); segments = resize; } segments[segmentsIdx++] = qs; } The easiest solution is to extend the array in advance: if (segmentsIdx == segments.length - 1) { ... It would be very helpful if someone could commit those changes to the CVS. Regards, Tom |