-
Bug
-
Resolution: Fixed
-
P3
-
7
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b131)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
Microsoft Windows 7 64-bit
also reproduced on:
Microsoft Windows [Version 6.0.6002]
Microsoft Windows Vista 32-bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
Reproducing requires MS Word 2010 or 2007 (other versions not tested)
A DESCRIPTION OF THE PROBLEM :
Pasting HTML that was copied to the clipboard from MS Word results in an Exception: "java.io.IOException: Unable to parse HTML description: Byte stream ends in description." at sun.awt.windows.HTMLCodec.parseDescription(WDataTransferer.java:835) ...
This is a regression, as it works correctly in Java 6 and Java 1.4.2
REGRESSION. Last worked in version 6u24
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start MS Word, create a new document, type some text, copy the text to the clipboard, run the test case (source posted below)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
transferable.getTransferData should return an Object for all DataFlavors returned by transferable.getTransferDataFlavors
ACTUAL -
getTransferData throws an IOException (see "Error Message(s)" below) when the mime-type is "text/html"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.IOException: Unable to parse HTML description: Byte stream ends in description.
at sun.awt.windows.HTMLCodec.parseDescription(WDataTransferer.java:835)
at sun.awt.windows.HTMLCodec.read(WDataTransferer.java:846)
at java.io.InputStream.read(InputStream.java:171)
at java.io.InputStream.read(InputStream.java:102)
at sun.awt.datatransfer.DataTransferer.inputStreamToByteArray(DataTransferer.java:2433)
at sun.awt.datatransfer.DataTransferer.translateBytesOrStreamToString(DataTransferer.java:1070)
at sun.awt.datatransfer.DataTransferer.translateBytesOrStream(DataTransferer.java:1646)
at sun.awt.windows.WDataTransferer.translateBytesOrStream(WDataTransferer.java:256)
at sun.awt.datatransfer.DataTransferer.translateBytes(DataTransferer.java:1559)
at sun.awt.datatransfer.ClipboardTransferable$DataFactory.getTransferData(ClipboardTransferable.java:70)
at sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:169)
at Paste.main(Paste.java:13)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
public class Paste {
public static void main(String[] args) {
System.out.println(System.getProperty("java.vendor") + " " + System.getProperty("java.vm.name")
+ " " + System.getProperty("java.version") + " " + System.getProperty("java.home") + "\n");
Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
DataFlavor transferDataFlavors[] = transferable.getTransferDataFlavors();
for(DataFlavor dataFlavor : transferDataFlavors) {
System.out.println(dataFlavor);
try {
Object data = transferable.getTransferData(dataFlavor);
System.out.println(data != null);
} catch(Exception e) {
e.printStackTrace(System.out);
}
System.out.println();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none, except for staying with Java 6
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b131)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
Microsoft Windows 7 64-bit
also reproduced on:
Microsoft Windows [Version 6.0.6002]
Microsoft Windows Vista 32-bit
EXTRA RELEVANT SYSTEM CONFIGURATION :
Reproducing requires MS Word 2010 or 2007 (other versions not tested)
A DESCRIPTION OF THE PROBLEM :
Pasting HTML that was copied to the clipboard from MS Word results in an Exception: "java.io.IOException: Unable to parse HTML description: Byte stream ends in description." at sun.awt.windows.HTMLCodec.parseDescription(WDataTransferer.java:835) ...
This is a regression, as it works correctly in Java 6 and Java 1.4.2
REGRESSION. Last worked in version 6u24
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start MS Word, create a new document, type some text, copy the text to the clipboard, run the test case (source posted below)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
transferable.getTransferData should return an Object for all DataFlavors returned by transferable.getTransferDataFlavors
ACTUAL -
getTransferData throws an IOException (see "Error Message(s)" below) when the mime-type is "text/html"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.IOException: Unable to parse HTML description: Byte stream ends in description.
at sun.awt.windows.HTMLCodec.parseDescription(WDataTransferer.java:835)
at sun.awt.windows.HTMLCodec.read(WDataTransferer.java:846)
at java.io.InputStream.read(InputStream.java:171)
at java.io.InputStream.read(InputStream.java:102)
at sun.awt.datatransfer.DataTransferer.inputStreamToByteArray(DataTransferer.java:2433)
at sun.awt.datatransfer.DataTransferer.translateBytesOrStreamToString(DataTransferer.java:1070)
at sun.awt.datatransfer.DataTransferer.translateBytesOrStream(DataTransferer.java:1646)
at sun.awt.windows.WDataTransferer.translateBytesOrStream(WDataTransferer.java:256)
at sun.awt.datatransfer.DataTransferer.translateBytes(DataTransferer.java:1559)
at sun.awt.datatransfer.ClipboardTransferable$DataFactory.getTransferData(ClipboardTransferable.java:70)
at sun.awt.datatransfer.ClipboardTransferable.getTransferData(ClipboardTransferable.java:169)
at Paste.main(Paste.java:13)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
public class Paste {
public static void main(String[] args) {
System.out.println(System.getProperty("java.vendor") + " " + System.getProperty("java.vm.name")
+ " " + System.getProperty("java.version") + " " + System.getProperty("java.home") + "\n");
Transferable transferable = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
DataFlavor transferDataFlavors[] = transferable.getTransferDataFlavors();
for(DataFlavor dataFlavor : transferDataFlavors) {
System.out.println(dataFlavor);
try {
Object data = transferable.getTransferData(dataFlavor);
System.out.println(data != null);
} catch(Exception e) {
e.printStackTrace(System.out);
}
System.out.println();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
none, except for staying with Java 6
- relates to
-
JDK-7051181 IOException when dragging certain items from a JFileChooser into Windows Explorer
-
- Closed
-