This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It is impossible to do copy/paste in IDE editor (simply it does nothing). It started to happen in build 20040304-1515, so I suspect it may be caused by this integration: * core/src/org/netbeans/core/NbClipboard.java: #40693: workaround for JDK bug #4818143 - hang when accessing system clipboard. Clipboard.setContents(..) also hangs when getContents() hangs. Both methods must be called asynchronously So it can be related to issue 40693. To reproduce: - run IDE with clean userdir - open a java file in editor (e.g. sampledir|examples|colorpicker|ColorPreview) - select a text - CTRL+C - click somewhere else to deselect text - CTRL+V - it is normally copied - now restart IDE (discard changes) - select a text in editor - CTRL+C - click somewhere else to deselect text - CTRL+V - nothing happens. If you paste a text to another application (terminal), it is pasted. Tested in build 20040304-2247, JDK1.4.2_01, Solaris9.
reproducible on Linux too. It seems yarda's hack is run too late. At that time an instance of PasteAction has been already created and cached by the editor. We need to install the security manager and the hack earlier during startup.
Running my hack late should not be the actual problem.
the bug is related to clipboard convertor. If the calls to convert() in NbClipboard are commented out everything works. The only convertor we have in NB is org.netbeans.modules.tasklist.core.TaskTransfer Not clear how this relates to the fix for issue 40693 but without the fix it works -> jtulach please
The problem is caused by following exception, however I am not sure why is this happening. CCing Mila, he might know more. sun.io.MalformedInputException: Missing byte-order mark at sun.io.ByteToCharUnicode.convert(ByteToCharUnicode.java:120) at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:247) at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:297) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182) at java.io.InputStreamReader.read(InputStreamReader.java:167) at org.netbeans.editor.LineSeparatorConversion$ToLineFeed.readBuffer(LineSeparatorConversion.java:227) at org.netbeans.editor.LineSeparatorConversion$ToLineFeed.nextConverted(LineSeparatorConversion.java:149) at org.netbeans.editor.Analyzer.read(Analyzer.java:499) at org.netbeans.editor.BaseDocument.read(BaseDocument.java:935) at org.netbeans.editor.BaseKit.read(BaseKit.java:432) at javax.swing.plaf.basic.BasicTextUI$TextTransferHandler.handleReaderImport(BasicTextUI.java:2143) at javax.swing.plaf.basic.BasicTextUI$TextTransferHandler.importData(BasicTextUI.java:2314) at javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:820) at javax.swing.text.JTextComponent.invokeAction(JTextComponent.java:1203) at javax.swing.text.JTextComponent.paste(JTextComponent.java:1181) at org.netbeans.editor.BaseKit$PasteAction.actionPerformed(BaseKit.java:1297) at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:169) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1530) at javax.swing.JComponent.processKeyBinding(JComponent.java:2438) at javax.swing.JComponent.processKeyBindings(JComponent.java:2473) at javax.swing.JComponent.processKeyEvent(JComponent.java:2401) at java.awt.Component.processEvent(Component.java:4909) at java.awt.Container.processEvent(Container.java:1569) at java.awt.Component.dispatchEventImpl(Component.java:3615) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:627) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:831) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:741) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:592) at java.awt.Component.dispatchEventImpl(Component.java:3506) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Window.dispatchEventImpl(Window.java:1606) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.EventQueue.dispatchEvent(EventQueue.java:456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
yarda, how did you produce the exception? I saw nothing like this
Have no idea what's wrong, just to recap what you likely already know: 1) paste action inspect data flavors and calls flavor.getReaderForText(transferable) to obtain the Reader which contains the actual data. 2) EditorKit.read() is called to read the data into the document from the reader. Editor must be sure that all line-separators get converted to '\n' i.e. that there will be no extra '\r' so it calls the LineSeparatorConversion$ToLineFeed which reads the characters from the given Reader until it hits the exception.
> sun.io.MalformedInputException: Missing byte-order mark > at sun.io.ByteToCharUnicode.convert(ByteToCharUnicode.java:120) > at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:247) just in case, byte-order mark is either "fffe" or "feff" at the very beginning of the stream, based on that we know it's little- or big-endian
I know why Yarda's hack causes this bug. Before the hack editor ignored NbClipboard completely, now it uses NbClipboard. The convertor from tasklist is now called when one pastes, before it was called only when one copied See also issue 30923
The issue is caused by presence of a convertor, but the actual bug is in ExTransferable, it randomly mixes order of the DataTransfers in itself and that is why sometimes the paste (deep in swing) gets InputStream, which seems to be a bit buggy instead of String which works ok.
Checking in core/bootstrap/src/org/netbeans/TopSecurityManager.java; /cvs/core/bootstrap/src/org/netbeans/TopSecurityManager.java,v <-- TopSecurityManager.java new revision: 1.8; previous revision: 1.7 done Processing log script arguments... More commits to come... Checking in core/src/org/netbeans/core/NbClipboard.java; /cvs/core/src/org/netbeans/core/NbClipboard.java,v <-- NbClipboard.java new revision: 1.16; previous revision: 1.15 done Processing log script arguments... More commits to come... RCS file: /cvs/core/test/unit/src/org/netbeans/core/NbClipboardIsUsedByAlreadyInitializedComponentsTest.java,v done Checking in core/test/unit/src/org/netbeans/core/NbClipboardIsUsedByAlreadyInitializedComponentsTest.java; /cvs/core/test/unit/src/org/netbeans/core/NbClipboardIsUsedByAlreadyInitializedComponentsTest.java,v <-- NbClipboardIsUsedByAlreadyInitializedComponentsTest.java initial revision: 1.1 done Checking in core/test/unit/src/org/netbeans/core/NbClipboardIsUsedBySwingComponentsTest.java; /cvs/core/test/unit/src/org/netbeans/core/NbClipboardIsUsedBySwingComponentsTest.java,v <-- NbClipboardIsUsedBySwingComponentsTest.java new revision: 1.3; previous revision: 1.2 done Processing log script arguments... More commits to come... Checking in openide/src/org/openide/util/datatransfer/ExTransferable.java; /cvs/openide/src/org/openide/util/datatransfer/ExTransferable.java,v <-- ExTransferable.java new revision: 1.20; previous revision: 1.19 done Processing log script arguments... More commits to come... RCS file: /cvs/openide/test/unit/src/org/openide/util/datatransfer/ExTransferableTest.java,v done Checking in openide/test/unit/src/org/openide/util/datatransfer/ExTransferableTest.java; /cvs/openide/test/unit/src/org/openide/util/datatransfer/ExTransferableTest.java,v <-- ExTransferableTest.java initial revision: 1.1
Yarda, can you please prepare a patch on top of the patch for issue 40693 so that we can apply both into release36. Thanks
Verified in trunk build 20040308-0913.