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.
Summary: | Copy/paste doesn't work | ||
---|---|---|---|
Product: | platform | Reporter: | Jiri Skrivanek <jskrivanek> |
Component: | -- Other -- | Assignee: | Jaroslav Tulach <jtulach> |
Status: | CLOSED FIXED | ||
Severity: | blocker | CC: | mmetelka, ttran |
Priority: | P2 | Keywords: | RANDOM |
Version: | 4.x | ||
Hardware: | Sun | ||
OS: | Solaris | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
Jiri Skrivanek
2004-03-05 09:17:22 UTC
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. |