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.

Bug 246246

Summary: Copy/Paste retains old clipboard data
Product: editor Reporter: freshbiology
Component: Actions/Menu/ToolbarAssignee: Milutin Kristofic <mkristofic>
Status: NEW ---    
Severity: normal CC: alburnett, BobSpeck, Geoff_C, kkonnou, markiewb, N3T, ovrabec, toddjspin, vlad_konov, vv159170
Priority: P1 Keywords: 8.1_WAIVER_APPROVED
Version: 8.1   
Hardware: PC   
OS: Windows 10 x64   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=88161
Issue Type: DEFECT Exception Reporter:
Attachments: Log of switching to Netbeans and trying to paste data
Log of fixing issue temporarily by doing some copying in Netbeans
screencap and log files

Description freshbiology 2014-08-04 13:01:13 UTC
Cannot paste (Ctrl+V of from Edit or Popup Menu) code snippets from other applications to IDE java editor. It retains clipboard data of its own copy (Ctrl+C) command.
Comment 1 Jiri Prox 2014-08-11 15:07:53 UTC
Can you please provide more info?
Is there any exception in the messages.log?
Does it happen always of is it just random?
What type of data are you trying to copy? (from which application)

Thanks
Comment 2 freshbiology 2014-08-12 10:11:19 UTC
(In reply to Jiri Prox from comment #1)
> Can you please provide more info?
> Is there any exception in the messages.log?
> Does it happen always of is it just random?
> What type of data are you trying to copy? (from which application)
> 
> Thanks

Hi
I mainly use IDE for Java development. I was trying to paste java code snippet from Notepad++. It happened just once. There was no error or exception. The IDE was running smoothly but it won't accept windows clipboard data. The IDE did not become unstable. It retained the data of it's own copy (Ctrl+C) command within the IDE. Finally I had to restart the IDE and it started working normally. Since then I did not get this sort of problem.
When it happened, I searched the web for any possible reason. I found that a bug of somewhat similar kind was reported in a previous version of the IDE which was fixed. I considered it appropriate to report it, in case it might be a real bug.
Comment 3 vlad_konov 2014-08-12 13:51:45 UTC
The same problem for me, actually really frustrating! It stops working occasionally, in most cases it happens when you urgently need to copy and paste.
Only IDE restart helps.


Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 2
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b17
System: Windows 7 version 6.1 running on amd64; Cp1252; en_GB (nb)
Comment 4 vlad_konov 2014-09-11 12:15:26 UTC
Even worse for

Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Java: 1.7.0_67; Java HotSpot(TM) 64-Bit Server VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
System: Windows 8 version 6.2 running on amd64; Cp1252; en_GB (nb)

Have to restart IDE several times per day...
Comment 5 milanka 2014-11-07 14:52:47 UTC
This happened for me too, but I don't know how to reproduce. I had to do some random copy&pasting inside Netbeans before paste started to work again (i.e. no restart was needed).

This is not a new problem, but quite infrequent (for me).

Product Version: NetBeans IDE 8.0.1 (Build 201408251540)
Updates: Updates available to version NetBeans 8.0.1 Patch 1.1
Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 6 milanka 2014-11-07 15:06:00 UTC
... and I was trying to copy a URL from Opera's address bar to Netbeans' Java editor.
Comment 7 freshbiology 2015-04-01 15:51:40 UTC
Today again I was unable to paste windows clipboard data into Netbeans Java Editor. Restart did help but after a while the IDE refused to accept clipboard data from outside the IDE. It would retain its own Cut/Copy data. I had to restart the IDE a few times.
I am using Netbeans 8.0.2, JDK1.8.0_05, Windows 7 Ultimate x64, Core i5, 8GB RAM.
Comment 8 BobSpeck 2015-04-30 14:57:13 UTC
I have noticed that I cannot cut and paste from netbeans editor into notepad while I have the Find/Replace dialog open at bottom of editor.  Once I close it, I can then cut and paste from the editor.
Comment 9 Milutin Kristofic 2015-05-28 11:05:50 UTC
Bobspeck, how often you cannot cut and paste when searchbar is opened? Always, sometimes? I can. Do you have any reproducible steps? Thanks.
Comment 10 shortguy881 2015-06-23 17:03:29 UTC
There are no errors in messages.log.

I run into this error several times a day but had trouble trying to recreate it. I found I can reproduce it more frequently when I change a java file and don't save it, then try copying and pasting into notepad. This isn't fool proof and the IDE will copy and paste some of the time, but it fails considerably more when doing this (One out of five-ish).

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 2
Java: 1.8.0_25; Java HotSpot(TM) 64-Bit Server VM 25.25-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_25-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 11 mtamassia 2015-07-08 13:48:57 UTC
It happens to me a couple times a day and the only fix is to restart NetBeans. Very frustrating since this issue did not exist a few months when I was using an older release. 

It is almost as if Netbeans would retain the last data it copied to the clipboard.


Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 2
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 12 Ondrej Vrabec 2015-07-17 11:39:57 UTC
Same as i wrote to the duplicated bug 250558:
If any of you suffer from this regularly, there is a logging that can be switched on. Run NetBeans with -J-Dorg.netbeans.NbClipboard.level=FINE
Then every time you switch to an external app, copy something and switch back, the IDE log should be updated with a lot of log messages.
When the issue happens again, please try to pick the messages added when switched to NetBeans and attach them here.
If you know how to reproduce reliably, you're very welcome to share the steps to reproduce.
Thanks
Comment 13 JagonEye 2015-07-24 06:11:45 UTC
I am facing a similar but worse bug. While copy pasting within Netbeans copy paste function gets disabled on its own and when it does i cannot copy paste even by mouse. This happens when i am using ctrl+c/v in netbeans 8.02. After some digging on the internet i created a shortcut to clear the clipboard and then when the bug happened again i cleared the clipboard which made the copy paste work again. But i don't know if this solution will be a permanent one or not. Please look into this. I registered here only to provide a temporary solution to people who find this very annoyinig.
Comment 14 Saljack 2015-08-03 06:19:27 UTC
I have same problem. It is only in Windows. I haven't same issue in Linux.
Comment 15 Milutin Kristofic 2015-09-08 12:33:24 UTC
I understand frustration that users have with this bug. Copy/Pasting is essential part of code editor. I would like to help, but this bug is difficult to reproduce, it never happened on my system. If some user see this issue quite often, can use logs mentioned in Ondra's comment (https://netbeans.org/bugzilla/show_bug.cgi?id=246246#c12)

I am requesting waiver for this issue, so this issue will not stop NB 8.1. There is no much hope we will fix this in this short time to 8.1.
Comment 16 milanka 2015-09-08 13:39:40 UTC
I haven't experienced this anymore for months. Maybe "patch 2" or newer JDK has made a difference?

Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 2
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
Comment 17 Jiri Kovalsky 2015-09-09 16:40:37 UTC
Bug waiver for 8.1 approved.
Comment 18 Ondrej Vrabec 2015-09-11 13:55:40 UTC
*** Bug 247319 has been marked as a duplicate of this bug. ***
Comment 19 milanka 2015-09-26 14:10:08 UTC
Created attachment 156437 [details]
Log of switching to Netbeans and trying to paste data
Comment 20 milanka 2015-09-26 14:11:15 UTC
Created attachment 156438 [details]
Log of fixing issue temporarily by doing some copying in Netbeans
Comment 21 vlad_konov 2015-11-09 17:37:47 UTC
The same problem happens on daily basis for:

Product Version: NetBeans IDE 8.1 (Build 201510222201)
Java: 1.7.0_67; Java HotSpot(TM) 64-Bit Server VM 24.65-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_67-b01
Comment 22 Jiri Prox 2015-12-03 13:57:34 UTC
*** Bug 256910 has been marked as a duplicate of this bug. ***
Comment 23 alburnett 2015-12-18 15:22:54 UTC
I reinstalled NetBeans (8.1, but I didn't nuke everything first), and the problem still exists.  I can usually get cut/copy and paste to work when I do a reboot of my system, but once I do cut/copy and paste within the IDE (same file or different files) the clipboard reverts to the NetBeans-only mode.  Seems to be a Windows 10 issue, as the same configuration on Win 7 works fine.  On the other hand, my wife's clean install on her new Win 10 machine and existing install on a machine upgraded from Win 8 to Win 10 both work fine.
Comment 24 lbruby 2016-07-15 04:41:09 UTC
I'm having the same problem on Windows 8.1 with Netbeans 8.1. Once I copy and paste from within Netbeans I cannot paste anything I've put on the Windows clipboard outside of Netbeans into a file I'm editing in Netbeans. I have to close Netbeans and reopen it to fix the issue. Really annoying.
Comment 25 verdelyi 2016-08-22 10:33:14 UTC
The problem persists on:

Product Version: NetBeans IDE 8.1 (Build 201510222201)
Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1
Java: 1.8.0_102; Java HotSpot(TM) 64-Bit Server VM 25.102-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_102-b14
System: Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb)

One workaround that tends to work for me is to copy something ELSE, paste it somewhere, then copy what you originally wanted to copy and try pasting it again.
Comment 26 N3T 2016-11-01 05:12:41 UTC
This is also an issue on Windows 7. I am using NetBeans for Java training, and I frequently paste sample code from Google Chrome into an existing Java file in the NetBeans IDE. At least once a day, sometimes twice a day, I have to restart the IDE because it pastes something I previously copied inside the IDE and won't paste the content from Chrome, no matter how many times I Alt+Tab back and copy it. It is a very visible problem and makes me hesitant to recommend this IDE to other developers. I will be glad to turn on my logging features, but the fact that it has already been reported hundreds of times and marked "FIXED" leaves me feeling a bit hopeless.

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_102; Java HotSpot(TM) 64-Bit Server VM 25.102-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_102-b14
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 27 N3T 2016-11-07 09:18:21 UTC
Created attachment 162808 [details]
screencap and log files

what_i_copied.png (Chrome screenshot)

what_u_pasted.png (NetBeans screenshot)

messages - copypasted.log (Complete log file, immediately after bug appears)

messages - copypasted_x2.log (Complete log file, bug continues after 2nd attempt)
Comment 28 Ernique 2016-11-07 19:55:47 UTC
Hi, 

I have the same issue:

1) Set focus to Chrome
2) Copy "material"
3) ALT-TAB to Netbeans
4) paste > "materials"
5) ALT-TAB to Chrome
6) Copy "drivers"
7) ALT-TAB to Netbeans
8) Paste > "materials"
9) Wait xxx seconds (as adviced here: https://netbeans.org/bugzilla/show_bug.cgi?id=88161 )
10) Paste > "materials"

May I know how is this still an issue as it has been raised in 2006 already? Is anyone really trying to fix the IDE bugs?

I'm using:

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Java: 1.8.0_112; Java HotSpot(TM) 64-Bit Server VM 25.112-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_112-b15
System: Windows 7 version 6.1 running on amd64; Cp1250; cs_CZ (nb)

Thank you very much for fixing this and have a nice day...

With kind regards, 

Ernique
Comment 29 xantiva 2016-11-07 20:32:09 UTC
Every one who posted here a comment should also vote for this bug. 5 votes are not very much ...
Comment 30 rstander777 2016-12-14 14:47:27 UTC
I have the same problem on TWO Windows 7 pro machines. For some inconsistent-non-reproducible-when-required reason, NetBeans IDE 8.0.2 Build 201411181905 (actually 8.0.1 also) does not reliably handle clipboard copies and pastes. It works most of the time but when it stop working I have to restart Netbeans to get it going again.

I see this has been reported on and off since 2006 with the NetBeans IDE. Really? Wow. 

Are there no way to trap misbehaving clipboards? How about writing an AutoHotkey script that that copies and pastes an incremental number into Netbeans? Then you guys can check if the number is not 1 more than the previous one and if it is not then you have found the moment it happens.

If you want I can write that script for you? Any takers?

Can we please get a fix for this? It has been happening for 10 years guys. That some sort of anniversary not so?
Comment 31 rstander777 2016-12-14 14:52:00 UTC
(In reply to xantiva from comment #29)
> Every one who posted here a comment should also vote for this bug. 5 votes
> are not very much ...

How do I vote for a bug?
Comment 32 ossiejhmoore 2017-01-04 03:16:25 UTC
I would like to add a comment about this issue. Strictly speaking, I do not believe this is a Netbeans bug. Rather, I strongly suspect it is either a JRE or JDK bug. I have encountered problems with copy/paste in a Swing application I built to store to and retrieve from the copy buffer. 

Specifically, my swing application (called Pastey) uses this logic

  ... begin snippet ...
  Toolkit toolkit = Toolkit.getDefaultToolkit();
  Clipboard clipboard = toolkit.getSystemClipboard();
  String data = (String) clipboard.getData(DataFlavor.stringFlavor);
  ... end snippet ...

to get String data stored to the clipboard. Later, I use this logic

  ... begin snippet ...
  Toolkit toolkit = Toolkit.getDefaultToolkit();
  Clipboard clipboard = toolkit.getSystemClipboard();
  clipboard.setContents(new StringSelection(data), null);
  ... end snippet ...

to populate the clipboard with a String. I often find that when the conditions are right, the value stored (validated using logs) using setContents is *not* what I get back when I later call getData. Instead, I get the previously fetch value from that point forward. Restarting the application fixes the issue. Because of this, I suspect this issue is bigger than Netbeans itself. I will personally try to figure out a reliable way to replicate this condition and then see if I can get Netbeans to exhibit the same behavior. It does seem to happen more with copy/paste activity alternating between Java and Non-Java based applications.
Comment 33 Milutin Kristofic 2017-04-03 11:47:17 UTC
*** Bug 270255 has been marked as a duplicate of this bug. ***
Comment 34 gianneschif 2017-04-21 11:13:19 UTC
This bug seems a duplicate of #188643