Re: [Webwork-user] Two small problems
Brought to you by:
baldree,
rickardoberg
From: Matt B. <ma...@sm...> - 2002-05-24 02:21:47
|
done. thx. ----- Original Message ----- From: "Tom Quellenberg" <qu...@su...> To: <web...@li...> Sent: Wednesday, May 22, 2002 1:59 AM Subject: [Webwork-user] Two small problems > 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 > > |