7030632: Pasting HTML that was copied from MS Word results in IOException
authordav
Mon, 25 Apr 2011 21:08:14 +0400
changeset 9473 2b8b1dd73192
parent 9472 9f1950d3b025
child 9474 74b4224cdbda
7030632: Pasting HTML that was copied from MS Word results in IOException Reviewed-by: uta, denis
jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java
--- 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.");
         }