lannybroo opened a new issue, #7126:
URL: https://github.com/apache/netbeans/issues/7126
### Apache NetBeans version
Apache NetBeans 21
### What happened
What happens is that I copy some text from some of my Java source code in
the NetBeans editor using `⌘ C` (I'm on macOS Sonoma 14.3.1) then click
somewhere else in the NetBeans editor and try to paste that code via `⌘ V`.
This first paste attempt fails every time. Nothing is pasted and the state of
the editor window stays the same. If I watch carefully I see that the `Edit`
menu does flash during this first paste as it does when running any keyboard
command that is also in the menu in NetBeans. If I then try pasting a second
time via `⌘ V`, the paste succeeds. I can then paste over an over again and
each subsequent paste succeeds until I copy something new.
What I expect to happen is for paste to always work.
The problem also occurs in the same way if you use the `Edit > Copy` then
`Edit > Paste` menu commands instead of keyboard shortcuts.
The problem *does not occur* if you copy text from a different application
(not NetBeans) and then paste into Netbeans. In this situation, the first paste
into NetBeans succeeds.
I do not think this is related to existing open copy/paste issues such as
#3962 or #5948.
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
1. Copy some text in a NetBeans editor window
2. Paste the text .. this first time won't work
3. Paste the text again ... this time and later will work
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
macOS Sonoma 14.3.1 on aarch64 (ARM M1 Mac)
### JDK
11.0.17; OpenJDK 64-Bit Server VM 11.0.17+8-LTS (Zulu)
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
This happens every time when copying from within NetBeans, as described
above.
I'd be happy to help test/debug any fix ideas but I am too unfamiliar with
this code base to work up a PR at this time.
I also grabbed a snip of an exception I see in `View > IDE Log` after the
2nd paste (that succeeds). Interesting I didn't see this exception after the
1st (failing) paste:
```
INFO [org.netbeans.modules.bugtracking.BugtrackingManager]: Loading stored
repositories took 67 millis.
INFO [org.netbeans.ui.metrics.bugtracking]: USG_ISSUE_TRACKING_REPOSITORY
INFO [org.netbeans.NbClipboard]: System clipboard not available.
java.lang.SecurityException: All swing access to clipboard should be
redirected to ExClipboard
at
org.netbeans.TopSecurityManager.checkWhetherAccessedFromSwingTransfer(TopSecurityManager.java:747)
at
org.netbeans.TopSecurityManager.checkPermission(TopSecurityManager.java:480)
at
java.desktop/sun.lwawt.LWToolkit.getSystemClipboard(LWToolkit.java:421)
at
java.desktop/sun.lwawt.macosx.CClipboard.notifyChanged(CClipboard.java:152)
at
java.desktop/sun.lwawt.macosx.CClipboard.checkPasteboardAndNotify(CClipboard.java:133)
at
java.desktop/sun.lwawt.macosx.CClipboard.getContents(CClipboard.java:61)
[catch] at org.netbeans.NbClipboard.getContents(NbClipboard.java:209)
at
java.desktop/javax.swing.TransferHandler$TransferAction.actionPerformedImpl(TransferHandler.java:1752)
at
java.desktop/javax.swing.TransferHandler$TransferAction$1.run(TransferHandler.java:1712)
at
java.desktop/javax.swing.TransferHandler$TransferAction$1.run(TransferHandler.java:1710)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at
java.desktop/javax.swing.TransferHandler$TransferAction$2.run(TransferHandler.java:1727)
at
java.desktop/javax.swing.TransferHandler$TransferAction$2.run(TransferHandler.java:1725)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at
java.desktop/javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:1724)
at
java.desktop/javax.swing.text.JTextComponent.invokeAction(JTextComponent.java:1523)
at
java.desktop/javax.swing.text.JTextComponent.paste(JTextComponent.java:1501)
at org.netbeans.editor.BaseKit$PasteAction$1.run(BaseKit.java:2450)
at
org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:333)
at
org.netbeans.editor.BaseKit$PasteAction.actionPerformed(BaseKit.java:2439)
at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:324)
at
java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
at
java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2900)
at
java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2948)
at
java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2862)
at java.desktop/java.awt.Component.processEvent(Component.java:6412)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at
java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:870)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1139)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1009)
at
java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:835)
at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4892)
at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
at
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
```
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists