-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0, 1.4.0_01
-
02
-
x86
-
linux, windows_nt, windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2052990 | 1.4.1 | Mark Reinhold | P2 | Closed | Fixed | hopper |
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0
4.00.1381
IE 5.5.50.4807.2300
A DESCRIPTION OF THE PROBLEM :
Copying a large blob on text into a JTextArea causes the
JVM to enter an infinite loop.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile & run the following code snippet
2. Copy 70k of text to the system clipboard
3. Paste the text into the window via Ctrl-V
EXPECTED VERSUS ACTUAL BEHAVIOR :
This works fine in 1.3.1, but loops in 1.4.0
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
public class PasteTest
{
public static void main(String[] argv)
{
JFrame frame = new JFrame("Paste Test");
frame.setContentPane(new JTextArea());
frame.setSize(800,600);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
-----------------------
This problem is reproducible without swing usage.
Steps to reproduce.
1. Copy 70k text to the system clipboard
2. compile & run following code
-- PasteTest.java --
import java.awt.*;
import java.awt.datatransfer.*;
import java.io.*;
public class PasteTest
{
public static void main(String[] argv)
{
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable transferable = clipboard.getContents(null);
DataFlavor[] flavors = transferable.getTransferDataFlavors();
int i;
for (i = 0; i < flavors.length; i++) {
System.out.println(flavors[i]);
if (flavors[i].getMimeType().startsWith("text/plain")) {
break;
}
}
if (i < flavors.length) { //let's do some text/plain reading
Reader r = null;
try {
r = flavors[i].getReaderForText(transferable);
while(r.read() > 0) {
;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
###@###.### 2002-03-23
- backported by
-
JDK-2052990 InputStreamReader loops forever when decoding more than 8192 bytes in UTF-16
- Closed
- duplicates
-
JDK-4701794 Endless loop at java.io.FileInputStream.available(Native Method)
- Closed
-
JDK-4628013 InputStreamReader hangs on UTF-16 encoded files >8kB
- Closed