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

huizhe wang huizhe.wang at oracle.com
Wed Dec 18 05:18:30 UTC 2013


>> http://cr.openjdk.java.net/~joehw/jdk8/8029955/webrev/
>>
>> Joe
>
> Fine.
>
> But: ERROR: Line 1216 should be removed !!!

Done, thanks.

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

JAXP currently maintains a code level 1.5 (Apache Xerces at 1.4). While 
we're getting close to the end of JAXP standalone, we may consider 
newer/advanced features in JDK9.  But we'll get to that discussion some 
time later.

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

Good catch! I'll remember to apply this cleanup in a separate or related 
patch, for JDK9. For the current issue, I want to keep my promise to RT 
that this is going to be a short and low-risk patch. We have a very 
small window for JDK8.

Thanks,
Joe

>
> 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