RFR (JAXP) 8029955 : AIOB in XMLEntityScanner.scanLiteral upon parsing literals with > 100 LF chars
Ulf Zibis
Ulf.Zibis at CoSoCo.de
Tue Dec 17 19:49:33 UTC 2013
Hi Joe,
I would use ’\t’ instead of 0x9, to stay consistent with ahead code:
1175 if (c == ’\t’) {
1176 storeWhiteSpace(fCurrentEntity.position-1);
Lines 1214..1221 could be simpler:
1214 if (whiteSpaceLen >= whiteSpaceLookup.length) {
1215 int [] tmp = new int[whiteSpaceLookup.length*2];
1216 System.arraycopy(whiteSpaceLookup, 0, tmp, 0, whiteSpaceLookup.length);
1217 whiteSpaceLookup = tmp;
1218 }
1219 whiteSpaceLookup[whiteSpaceLen++] = whiteSpacePos;
Or even shorter:
1214 if (whiteSpaceLen >= whiteSpaceLookup.length)
1215 whiteSpaceLookup = Arrays.copyOf(whiteSpaceLookup, whiteSpaceLookup.length*2);
1216 whiteSpaceLookup[whiteSpaceLen++] = whiteSpacePos;
(please insert spaces around if clause, else and after commas.)
-Ulf
On 16.12.2013 20:31, huizhe wang wrote:
> Hi,
>
> This is a quick fix for a whitespace buffer that was not adjusted properly in one of the two
> cases. The buffer, whiteSpaceLookup, is filled in two cases and adjusted properly the 2nd time.
> The code is moved into a method storeWhiteSpace so that it's shared for the 1st case as well.
>
> Note at line 1175, there is no need to save character 0x20 since all whitespace characters will
> later be replaced with character 0x20.
>
> webrevs:
> http://cr.openjdk.java.net/~joehw/jdk8/8029955/webrev/
>
> Thanks,
> Joe
>
More information about the core-libs-dev
mailing list