RFR (JAXP) 8029955 : AIOB in XMLEntityScanner.scanLiteral upon parsing literals with > 100 LF chars

Ulf Zibis Ulf.Zibis at CoSoCo.de
Wed Dec 18 01:46:31 UTC 2013


On 18.12.2013 00:45, huizhe wang wrote:
> Thanks for the comments. I incorporated the suggested changes.
>
> In terms of code format, for small source files, I would just hit the source->format button. For 
> big files like this one, it'd unfortunately create too much distraction from real changes.
>
> http://cr.openjdk.java.net/~joehw/jdk8/8029955/webrev/
>
> Joe

Fine.

But: ERROR: Line 1216 should be removed !!!

Why didn't you like this very short version? :

>>> Or even shorter:
>>> 1214         if (whiteSpaceLen >= whiteSpaceLookup.length)
>>> 1215             whiteSpaceLookup = Arrays.copyOf(whiteSpaceLookup, whiteSpaceLookup.length*2);
>>> 1216         whiteSpaceLookup[whiteSpaceLen++] = whiteSpacePos;

Another shortage:

1095             do {
1098                 newlines++;
1099                 fCurrentEntity.lineNumber++;
1100                 fCurrentEntity.columnNumber = 1;
1101                 if (++fCurrentEntity.position == fCurrentEntity.count) {
1102                     invokeListeners(newlines);
1103                     offset = 0;
1104                     fCurrentEntity.position = newlines;
1105                     if (load(newlines, false)) {
1106                         break;
1107                     }
1108                 }
1097                 if (c == '\r') {
1109                     if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
1110                         fCurrentEntity.position++;
1111                         offset++;
1112                     }
1113                     /*** NEWLINE NORMALIZATION ***/
1114                     else {
1115                         newlines++;
1116                     }
1118                 } else {
1130                     /*** NEWLINE NORMALIZATION ***
1131                      * if (fCurrentEntity.ch[fCurrentEntity.position] == '\r') {
1133                      *     fCurrentEntity.position++;
1134                      *     offset++;
1135                      * }***/
1137                 }
1096                 c = fCurrentEntity.ch[fCurrentEntity.position];
1141             } while (fCurrentEntity.position < fCurrentEntity.count - 1 && (c == '\n' || c == 
'\r'));
1142
1143             for (int i = offset; i < fCurrentEntity.position; i++) {
1144                 fCurrentEntity.ch[i] = '\n';
1145                 storeWhiteSpace(i);
1146             }


-Ulf




More information about the core-libs-dev mailing list