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 205697

Summary: Copy & paste functionality
Product: platform Reporter: tim_sa <tim_sa>
Component: Window SystemAssignee: Stanislav Aubrecht <saubrecht>
Status: RESOLVED DUPLICATE    
Severity: normal CC: anebuzelsky, augcampos, Awerin, ceklock, diek, hmichel, ijacek, inonit, issues, jiriprox, MackSix, marfous, markiewb, mmirilovic, muellermi, ppisl, rudyment, theosib
Priority: P2    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Video
messages.log
lolg

Description tim_sa 2011-11-30 09:21:39 UTC
[ BUILD # : 201111242103 ]
[ JDK VERSION : 1.7.1 ]

I've come across an issue when copy from other sources (ie firefox or
notepad++) into NetBeans. 
NetBeans seems to keep the last item that it copied, rather than replacing it
with the new item. See http://www.screencast-o-matic.com/watch/cXXvjkU0k

I am unfortunately unable to provide steps to reproduce as this seems to happen
sporadically (Hence the video).
Comment 1 Jiri Prox 2011-12-01 06:52:07 UTC
This seems serious
Comment 2 Stanislav Aubrecht 2011-12-01 11:21:26 UTC
the video isn't working for me. could be a duplicate of #88161

please provide more info about your environment, thanks
Comment 3 tim_sa 2011-12-01 11:46:13 UTC
Created attachment 113695 [details]
Video

I've uploaded the video to the issuezilla, hopefully this allows you to watch it.

Environment is as follows:
Windows 7 SP1
Core i7
16 Gb RAM
Comment 4 Stanislav Aubrecht 2011-12-01 11:57:07 UTC
thanks for the video. some more questions:
- can you reproduce that with a clean user dir?
- does the IDE or notepad run in virtual box?
- is it reproducible with every editor window and every input field in the ide?
- does the paste action work if you don't select the text first? seems like some sort of 'auto-copy' plugin being installed...
Comment 5 tim_sa 2011-12-01 12:33:12 UTC
> - can you reproduce that with a clean user dir?
When this happened I had just installed  build 201111242103 - I clean out the userdirs before i start working with different builds.

> - does the IDE or notepad run in virtual box?
There wasn't any virtualization involved


As I mentioned in the initial report I don't know how to reproduce this, which is why I provided the screen-cast of it occurring.  I first noticed the behavior in build 201109141017 ( http://forums.netbeans.org/viewtopic.php?t=45033 ) when I was doing a significant amount of copying and pasting between netbeans and excel.  

One other member of the netcat process has also noted that he's seen this behaviour (See the previously mentioned URL), so I'm pretty sure that it isn't something peculiar to my environment
Comment 6 Jiri Prox 2011-12-02 10:15:15 UTC
I've seem it as well, but it cannot it reproduce it.

Steps what I did:
1) select some text from textarea in firefox and ctrl-c
2) paste action in Netbeans editor (java file)
-> previous content of clipboard was pasted, not the current one
3) paste action in Notepad 
-> content captured as step 1 was pasted
Comment 7 swpalmer 2011-12-02 14:30:42 UTC
I had a suspicion at one point that this may be related to the flavours of the text available on the clipboard.  E.g. there may be a rich text flavour in addition to the plain text.  I don't know for sure.
Comment 8 Stanislav Aubrecht 2011-12-05 15:20:19 UTC
still cannot reproduce in:

Product Version: NetBeans IDE Dev (Build 20111205-4801b56f0c8e)
Java: 1.7.0_01; Java HotSpot(TM) Client VM 21.1-b02
System: Windows 7 version 6.1 running on x86; Cp1250; en_US (nb)
Comment 9 Stanislav Aubrecht 2011-12-05 15:20:55 UTC
can anybody reproduce with this command line switch?

-J-Dnetbeans.slow.system.clipboard.hack=false
Comment 10 tim_sa 2011-12-06 08:12:29 UTC
This just happened to me again using build 201112030901

http://www.screencast-o-matic.com/watch/cXl1iCUSo
(I tried to attach the file to bugzilla, but got an error indicating the file was too large)

I was not using the -J-Dnetbeans.slow.system.clipboard.hack=false command line switch

the other applications that i tried copying from where notepad++, FireFox and Chrome
Comment 11 Jiri Prox 2011-12-07 11:03:56 UTC
*** Bug 206065 has been marked as a duplicate of this bug. ***
Comment 12 Jiri Prox 2011-12-07 12:52:09 UTC
*** Bug 206075 has been marked as a duplicate of this bug. ***
Comment 13 Stanislav Aubrecht 2012-01-09 11:10:00 UTC
(In reply to comment #9)
> can anybody reproduce with this command line switch?
> 
> -J-Dnetbeans.slow.system.clipboard.hack=false

anybody tried the above switch and reproduced this issue?
Comment 14 tim_sa 2012-01-10 09:13:40 UTC
(In reply to comment #13)
> (In reply to comment #9)
> > can anybody reproduce with this command line switch?
> > 
> > -J-Dnetbeans.slow.system.clipboard.hack=false
> 
> anybody tried the above switch and reproduced this issue?

Its now part of my netbeans.conf, so is enabled every time that I start. Haven't had any issues with it yet, however I've only been using it for part of a day.

Will report back in a while as to whether it made a difference or not
Comment 15 inonit 2012-01-12 16:58:57 UTC
Yes, I experienced it just now running 7.1 with this in my netbeans.conf (as part of netbeans_default_options):

-J-Dnetbeans.slow.system.clipboard.hack=false

This is on JDK 1.7, NB 7.1, Windows 7 x64

Unfortunately I can't yet figure out how to get to the point where I can reproduce it. (I can reproduce it right now by trying to paste from another application into NetBeans; it seems to fail for any application, pasting code earlier copied in NetBeans instead of what is on the system clipboard.)
Comment 16 inonit 2012-01-12 17:02:02 UTC
The good news is that this time I did not have to restart the IDE to fix it. I'm not sure what fixed it, but I believe it was copying something else onto the clipboard from *within* NetBeans (no amount of copying things from *outside* NetBeans seemed to do the trick). This then allowed me to copy from external applications again.

But sorry I was not more careful, so I'm not quite exactly sure what sequence I followed.
Comment 17 Jiri Prox 2012-01-25 08:53:42 UTC
*** Bug 207548 has been marked as a duplicate of this bug. ***
Comment 18 Marian Mirilovic 2012-01-25 08:59:03 UTC
Standa, could you please evaluate this ASAP ? We might consider this one as a candidate for 7.1.1
Comment 19 Jiri Prox 2012-02-20 07:32:20 UTC
*** Bug 208614 has been marked as a duplicate of this bug. ***
Comment 20 Jiri Prox 2012-03-09 16:14:17 UTC
*** Bug 208715 has been marked as a duplicate of this bug. ***
Comment 21 theosib 2012-03-11 21:39:42 UTC
While I've had a lot of trouble with pasting what I copy from other programs, I'm now having trouble pasting what I copy from Netbeans itself.  Now, I've got Netbeans in some weird state where it cannot seem to alter the clipboard, so regardless of what I copy, what gets pasted is something I copied earlier.
Comment 22 theosib 2012-03-11 21:41:20 UTC
Addendum to my last comment:  If I use the Edit menu, it works correctly within Netbeans.  This bug arises if I use Ctrl-C / Ctrl-V.

This doesn't change the fact that I can't paste into Netbeans what I copied from another program, regardless of whether or not I use the Edit menu.
Comment 23 theosib 2012-03-11 21:42:29 UTC
Another addendum:  Using the edit menu seems to have gotten Netbeans unstuck with regard to copy/paste WITHIN Netbeans.
Comment 24 tkellerer 2012-03-11 21:49:38 UTC
If I cannot paste text that have I copied in other applications, then usually the copy & paste items in the context menu of the editor are disabled
Comment 25 tim_sa 2012-03-20 10:29:41 UTC
(In reply to comment #14)
> (In reply to comment #13)
> > (In reply to comment #9)
> > > can anybody reproduce with this command line switch?
> > > 
> > > -J-Dnetbeans.slow.system.clipboard.hack=false
> > 
> > anybody tried the above switch and reproduced this issue?
> 
> Its now part of my netbeans.conf, so is enabled every time that I start.
> Haven't had any issues with it yet, however I've only been using it for part of
> a day.
> 
> Will report back in a while as to whether it made a difference or not

This still happens when using the -J-Dnetbeans.slow.system.clipboard.hack=false
Comment 26 tim_sa 2012-03-20 10:38:30 UTC
(In reply to comment #16)
> The good news is that this time I did not have to restart the IDE to fix it.
> I'm not sure what fixed it, but I believe it was copying something else onto
> the clipboard from *within* NetBeans (no amount of copying things from
> *outside* NetBeans seemed to do the trick). This then allowed me to copy from
> external applications again.
> 
> But sorry I was not more careful, so I'm not quite exactly sure what sequence I
> followed.

This is the behavior that I experience as well
Comment 27 Stanislav Aubrecht 2012-03-27 12:55:38 UTC
Reporters, please check messages.log for any exceptions when clipboard operation fails. There's similar bug #204355 that's been caused by third-party clipboard listener...
Comment 28 theosib 2012-03-29 00:06:25 UTC
I have a really basic WinXP installation.  The only thing "weird" about my setup is that it's installed in Parallels, so Parallels tools are installed, and probably one of those is a clipboard listener, because the clipboard is shared between the Mac and Windows.  This may be a useful clue as to what's going on.  If all Java apps had this trouble, then we might have a case for blaming Parallels, but that has not been my experience.
Comment 29 Stanislav Aubrecht 2012-03-29 10:12:27 UTC
(In reply to comment #28)
> I have a really basic WinXP installation.  The only thing "weird" about my
> setup is that it's installed in Parallels, so Parallels tools are installed,
> and probably one of those is a clipboard listener, because the clipboard is
> shared between the Mac and Windows.  This may be a useful clue as to what's
> going on.  If all Java apps had this trouble, then we might have a case for
> blaming Parallels, but that has not been my experience.

Ok, that's a new info. If you put something to clipboard in Mac, then switch to Parallels you have to activate some other application first, then switch to NetBeans to update its clipboard. By default NetBeans checks for external clipboard changes only on main window de(activation).
If you start NetBeans with -J-Dnetbeans.slow.system.clipboard.hack=false command-line switch the clipboard should work as expected - at least in your case...
Comment 30 theosib 2012-03-29 10:20:10 UTC
I've tried pasting through another app.  For instance, I can paste into Notepad then copy again and then past into Netbeans.  That usually doesn't work.
Comment 31 tim_sa 2012-03-29 10:25:14 UTC
(In reply to comment #29)
> Ok, that's a new info. If you put something to clipboard in Mac, then switch to
> Parallels you have to activate some other application first, then switch to
> NetBeans to update its clipboard. By default NetBeans checks for external
> clipboard changes only on main window de(activation).
> If you start NetBeans with -J-Dnetbeans.slow.system.clipboard.hack=false
> command-line switch the clipboard should work as expected - at least in your
> case...

I don't know if any of the following details are relevant, but they came to mind as I was reading the above.
- My setup is a dual screen one.
- I don't run any virtualization software 
- I often remotely connect to other computers using Remote Desktop Connections
Comment 32 Stanislav Aubrecht 2012-04-19 08:59:02 UTC
Reporters, please run your IDE with switch -J-Dorg.netbeans.NbClipboard.level=FINE
to turn logging in NB clipboard on. When you reproduce the problem, please attach new message.log and reopen, thanks.
Comment 33 theosib 2012-06-13 20:35:09 UTC
I'm still having this problem.  I'd like to try "-J-Dorg.netbeans.NbClipboard.level=FINE", but I have no idea where to put it.  Thanks.
Comment 34 Michel Graciano 2012-06-13 20:41:58 UTC
(In reply to comment #33)
> I'm still having this problem.  I'd like to try
> "-J-Dorg.netbeans.NbClipboard.level=FINE", but I have no idea where to put it. 
> Thanks.

Put it at your {NB_INSTALL}/etc/netbeans.conf file. Use the netbeans_default_options property for that.
Comment 35 theosib 2012-06-13 20:56:58 UTC
Thank you.  That option helped a lot.  I'll let you know if it fails at any point.

Why isn't FINE the default setting?
Comment 36 Michel Graciano 2012-06-13 21:07:38 UTC
(In reply to comment #35)
> Thank you.  That option helped a lot.  I'll let you know if it fails at any
> point.
> 
> Why isn't FINE the default setting?

It will generate a lot of log and it is not intended to polute the log with fine grained log. AFAIK WARNING is the default setting for logs for NetBeans. Just for a second, imagine the whole IDE running with FINE option, since we have hundreds, probably thousands of logs being printed, so it probably would be a mess :)
Comment 37 theosib 2012-06-13 21:19:48 UTC
Created attachment 120800 [details]
messages.log
Comment 38 theosib 2012-06-13 21:21:24 UTC
Two things:

(1) It's still set to FINE, but it's no longer pasting from the clipboard.  That seems to be a one-time event.  Now, it'll only paste whatever was copied inside of NetBeans.
(2) I've uploaded a log from where I started NetBeans, pasted (the wrong thing), undid the paste, and then quit.
Comment 39 Stanislav Aubrecht 2012-06-14 08:41:37 UTC
(In reply to comment #37)
> Created attachment 120800 [details]
> messages.log

There are no clipboard-related log messages in the attachment. And it doesn't seem you've adjusted the logging in your netbeans.conf either...
Comment 40 theosib 2012-06-14 18:05:20 UTC
The file I modified is named:

C:\Program Files\NetBeans Dev 201206130001\etc\netbeans.conf

And I modified this line:

netbeans_default_options="-J-Dorg.netbeans.NbClipboard.level=FINE -J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true -J-Dplugin.manager.check.updates=false"

The log file I attached is this one (the newest file in that directory at the time):

C:\Documents and Settings\Administrator\.netbeans\dev\var\log\messages.log.2

So, what did I do incorrectly?

Thanks.
Comment 41 javydreamercsw 2012-09-12 13:26:13 UTC
This is still valid on 201209110001. Also it looks like the previous comment is expecting feedback from NetBeans team but it was resolved incomplete? Changing to reopen so it gets visibility again.
Comment 42 Stanislav Aubrecht 2012-09-12 13:29:06 UTC
Probably a duplicate of #88161
Comment 43 Milutin Kristofic 2012-09-13 13:29:17 UTC
*** Bug 217900 has been marked as a duplicate of this bug. ***
Comment 44 Milutin Kristofic 2012-09-13 13:33:00 UTC
I cannot copy new content to clipboard. Happens, once per day, restarting netbeans helps.

Product Version: NetBeans IDE Dev (Build 201209120001)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Linux version 3.0.0-25-generic running on amd64; UTF-8; en_US (nb
Comment 45 Milutin Kristofic 2012-09-13 14:42:18 UTC
Created attachment 124320 [details]
lolg

I just add log from -J-Dorg.nbeans.NbClipboard.level=FINE, but i don't see anything useful.

I can copy and paste inside one instance of netbeans. If I copy something from netbeans to clipboard, I cannot paste it in other program. Vice versa, I cannot copy from f.e. chrome to netbeans. Also Clipboard History is not refreshing its list.
Comment 46 Martin Fousek 2012-09-14 11:23:46 UTC
I happens to me too - not once per day, but three, four -times daily and just the IDE restart helps. :/ I'll try to attach the log too once I'll reproduce it with the logging switch.
Comment 47 Jiri Prox 2012-09-17 09:37:35 UTC
*** Bug 218456 has been marked as a duplicate of this bug. ***
Comment 48 Vladimir Voskresensky 2012-09-17 11:46:37 UTC
It happens on Solaris as well
Comment 49 Stanislav Aubrecht 2012-09-19 13:00:22 UTC
*** Bug 218549 has been marked as a duplicate of this bug. ***
Comment 50 Stanislav Aubrecht 2012-09-19 13:14:52 UTC

*** This bug has been marked as a duplicate of bug 218447 ***
Comment 51 ceklock 2012-12-07 23:56:03 UTC
I had this bug now with NetBeans 7.2.1. I can't paste in NetBeans the text that
I copied from outside. I had to close and reopen NetBeans to paste the text.


Product Version: NetBeans IDE 7.2.1 (Build 201210100934)
Java: 1.7.0_09; Java HotSpot(TM) Server VM 23.5-b02
System: Windows 7 version 6.1 running on x86; Cp1252; en_BR (nb)
Comment 52 mouleoub 2013-05-22 18:11:50 UTC
I am using netbean 7.1 and I am having same problem, the only fix is when I close some netbean open files, and leave only one or three
Comment 53 ChemMitch 2019-05-14 18:30:53 UTC
(In reply to mouleoub from comment #52)
> I am using netbean 7.1 and I am having same problem, the only fix is when I
> close some netbean open files, and leave only one or three

Just saw the same issue using NetBeans 11