7030632: Pasting HTML that was copied from MS Word results in IOException

Reviewed-by: uta, denis
This commit is contained in:
Andrei Dmitriev 2011-04-25 21:08:14 +04:00
parent d097a2cab1
commit b91701fce6

View File

@ -830,7 +830,14 @@ class HTMLCodec extends InputStream {
if( -1 == iStartOffset ){
throw new IOException(FAILURE_MSG + "invalid HTML format.");
}
iReadCount = bufferedStream.skip(iStartOffset);
int curOffset = 0;
while (curOffset < iStartOffset){
curOffset += bufferedStream.skip(iStartOffset - curOffset);
}
iReadCount = curOffset;
if( iStartOffset != iReadCount ){
throw new IOException(FAILURE_MSG + "Byte stream ends in description.");
}