7030632: Pasting HTML that was copied from MS Word results in IOException
Reviewed-by: uta, denis
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Tue Apr 19 18:52:49 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java Mon Apr 25 21:08:14 2011 +0400
@@ -830,7 +830,14 @@
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.");
}