Bug 119617 - Cursor lost in editor
Cursor lost in editor
Status: RESOLVED WONTFIX
Product: editor
Classification: Unclassified
Component: Navigation
6.x
All All
: P2 with 12 votes (vote)
: 6.x
Assigned To: David Strupl
issues@editor
http://bugs.sun.com/bugdatabase/view_...
jdk_bug_4851685
: FOCUS
: 32755 120745 120880 123908 126260 127169 131197 131970 136212 155137 167562 170110 176395 187290 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-22 10:05 UTC by kawkhins
Modified: 2013-11-12 00:43 UTC (History)
17 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
Thread Dump after issue noticed (6.92 KB, text/plain)
2007-11-28 20:37 UTC, phoneycutt
Details
Editor Probe 1.1.0 (19.74 KB, application/octet-stream)
2008-02-19 16:49 UTC, Vitezslav Stejskal
Details
Editor probe output (15.89 KB, text/plain)
2008-02-19 17:43 UTC, David Vancouvering
Details
Editor Probe 1.2.0 - declares only dependencies on Nb6 libraries (19.78 KB, application/octet-stream)
2008-02-20 09:56 UTC, Vitezslav Stejskal
Details
Editor Probe dump from OS X when the editor is blocked (43.84 KB, text/plain)
2008-02-20 10:30 UTC, marvi
Details
/home/rvalyi/Desktop/editor_probe_dump_rvalyi_linux.txt (27.00 KB, txt/html)
2008-02-20 23:15 UTC, rvalyi
Details
Editor Probe 1.4.0 - uninstall the old version first! (21.44 KB, application/octet-stream)
2008-02-25 15:47 UTC, Vitezslav Stejskal
Details
Log from NPE in Editor Probe (6.46 KB, text/plain)
2008-02-25 17:29 UTC, marvi
Details
Editor Probe 1.6.0 - don't forget to install the JDK patch too (23.13 KB, application/octet-stream)
2008-03-01 17:25 UTC, Vitezslav Stejskal
Details
JDK5 patch for Editor Probe 1.6.0 (100.00 KB, application/octet-stream)
2008-03-01 17:25 UTC, Vitezslav Stejskal
Details
JDK6 patch for Editor Probe 1.6.0 (117.04 KB, application/octet-stream)
2008-03-01 17:26 UTC, Vitezslav Stejskal
Details
mac od / jdk 1.5 probe version (100.62 KB, application/octet-stream)
2008-03-14 11:42 UTC, Max Sauer
Details
Output from editor probe after editor freeze. (52.72 KB, text/plain)
2008-03-18 11:58 UTC, nigeleke1957
Details
Patched editor.probe log - pre-freeze (274.26 KB, text/plain)
2008-03-19 12:43 UTC, nigeleke1957
Details
Patched editor.probe log - post-freeze (274.26 KB, text/plain)
2008-03-19 12:43 UTC, nigeleke1957
Details
Annotated messages.log (59.49 KB, text/plain)
2008-03-21 04:09 UTC, nigeleke1957
Details
crashing again on Netbeans RC1 on Ubuntu, log for probe + jdk6 patch (42.13 KB, txt/html)
2008-04-14 01:26 UTC, rvalyi
Details
Visual view of a focus and cursor error...maybe key events...either way the JEditorPane looks different (80.20 KB, image/png)
2009-01-10 07:05 UTC, _ wadechandler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kawkhins 2007-10-22 10:05:03 UTC
Sometimes, the cursor is disabled in the java editor, not showing, impossible to type anything. The only solution is to
close the edited file and to open it again.

I saw this only on MacOSX10.4, I never had this on linux.

Product Version: NetBeans IDE Dev (Build 200710200000)
Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
Comment 1 Vitezslav Stejskal 2007-10-22 10:17:24 UTC
Strange, is there any CPU/disk activity when the editor is in this state? Do you have any idea what triggers it? Does it
happen for all files or just some (ie. a particular file type, files in version control, ...)? Did you get any
exceptions, could you attach the <userdir>/var/log/messages.log file? Thanks
Comment 2 Jiri Skrivanek 2007-11-01 09:33:26 UTC
*** Issue 120745 has been marked as a duplicate of this issue. ***
Comment 3 Torbjorn Norbye 2007-11-01 15:07:45 UTC
Hi Vita,
there is additional information (such as a thread dump) in issue 120745. Also, you can find a lot more discussion around
it in the comment section of this blog entry:
http://blogs.sun.com/tor/entry/ruby_screenshot_of_the_week21#comments
3 separate users reported similar scenarios.
Comment 4 Vitezslav Stejskal 2007-11-01 15:41:40 UTC
Hi Tor, thanks for pointing me to the discussion. I read through it and Graste seems to blame compiz for the problem,
but in #120747 he says the editor froze up again even without compiz. Looking at the thread dump there was *nothing*
running in the IDE at all AFAICT. I mean no deadlock, all threads either runnable or parked waiting for their request
queue. I'm really not sure what's wrong, but I know there are people here that use compiz/beryl on Ubuntu and other
linux distros and they don't complain. I think there is a special property that when set will produce extensive logs
about focus transition in/from editor panes. I can't remember what it was, but will find it and post it here. If
somebody who can reproduce the problem sets this property and send us logs we might be able to find something.

Comment 5 gfodor 2007-11-15 01:20:25 UTC
I can confirm this behavior as well on a Dell D610 Latitude running Ubuntu 7.10 Gutsy. Compiz is *not* enabled
(Appearance->Visual Effects is set to None) though it happens with Compiz on or off. I have tried it with JVM 1.5 and
1.6, same behavior. The loss of keyboard focus happens intermittantly if you navigate using the left hand navigation
tree, however, if you do a Navigate -> Go To File/Go To Class when the file is opened there is *never* focus. Closing
and re-opening the file in this manner does not fix it. This is a showstopper for me because "Go To File" is the way I
navigate my code, using the mouse is too cumbersome for large projects.
Comment 6 gfodor 2007-11-15 01:21:14 UTC
Note that I am using the latest RC1 bits and the problem persists.
Comment 7 pohl 2007-11-20 16:49:34 UTC
We see this problem in NB6rc1 on MacOS X 10.4 -- so I'm pretty sure Compiz cannot be to blame.
Comment 8 pohl 2007-11-20 16:52:25 UTC
My partner feels like this is most likely to happen after manipulating the quick-fix lightbulbs.  But that is not a sufficient way to reproduce it.  Seems like a 
heisenbug.
Comment 9 marvi 2007-11-20 21:15:26 UTC
This has happened to me a lot lately. I remebember seeing it in 5.5 a few times. Then it helped just to close and reopen
the editor window. But in 6.0 RC1 that often won't help. I have to restart Netbeans to be able to type in the Java
editor again. 

As pohl I also see a connection to the use of quick-fix lightbulbs, but I can't reproduce it. 

- MacOS X 10.4
- Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-164)
- Java HotSpot(TM) Client VM (build 1.5.0_07-87, mixed mode, sharing)
- NetBeans 6.0 RC1
Comment 10 phoneycutt 2007-11-28 20:37:13 UTC
Created attachment 53624 [details]
Thread Dump after issue noticed
Comment 11 phoneycutt 2007-11-28 20:49:26 UTC
The above thread dump was created immediately after seeing the behaviour described in this issue. I had created a new, stateless ejb and was in the process 
of using the lightbulb helpers to add the method declarations to the interface. Normally the lightbulb would change to a green circle, with an I inside to signify 
the method is defined in an interface. After switching back to the class file in the editor, the lightbulb was still present and it again prompted me with "method 
not exposed in any interface". I could click to add the method again and it would show up in the interface as a duplicate, but no error icon would show up.

The cursor and the keyboard no longer functioned in either file, other than to click the lightbulb helper.
Comment 12 phoneycutt 2007-11-28 20:51:07 UTC
The above thread dump was created immediately after seeing the behaviour described in this issue. I had created a new, stateless ejb and was in the 
process of using the lightbulb helpers to add the method declarations to the interface. Normally the lightbulb would change to a green circle, with an I 
inside to signify the method is defined in an interface. After switching back to the class file in the editor, the lightbulb was still present and it again 
prompted me with "method not exposed in any interface". I could click to add the method again and it would show up in the interface as a duplicate, but no 
error icon would show up.

The cursor and the keyboard no longer functioned in either file, other than to click the lightbulb helper.

Mac OS 10.4
Netbeans RC2

When I switched back to RC1, i was able to finish adding declarations to the interface using the lightbulbs with no issues, but I have seen this issue since 
5.5, just like the others.

Comment 13 Jiri Prox 2007-11-29 07:52:43 UTC
The problems on Mac are discussed also in issue 120880
Comment 14 Vitezslav Stejskal 2007-12-13 07:39:58 UTC
*** Issue 123908 has been marked as a duplicate of this issue. ***
Comment 15 headius 2008-01-05 20:02:07 UTC
I have this issue constantly as well. It seems to be limited to when I do non-trivial refactorings. For example,
renaming a variable doesn't do it, but adding new methods to a Java class (like accessors) does it almost every time.
It's very annoying.

I do have a workaround that's not great but beats restarting: go into Preferences and just hit Ok. When you come back to
the editors the cursor will be back.

Looking forward to seeing this fixed.
Comment 16 emi 2008-01-24 09:36:55 UTC
This also happens to me all the time on OSX. It seems to show up after I use the lightbulbs to "Implement all abstract
methods" (and others like this).

There is no more focus in that particular Editor (the others seem ok). A quick solution I discovered is to open the
Settings and click on "Manual Proxy Settings". This makes a caret show up in there, and after I close the window (escape
key), I get the caret back in the Editor.

This is kinda ruining my workflow as I keep on fighting with the Editor for the caret :)

Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-121
System: Mac OS X version 10.4.11 running on i386; MacRoman; en_US (nb)
Comment 17 rvalyi 2008-01-24 21:55:46 UTC
Hi,

just adding my testimony this bugs is so annoying that I'm not even able to use Netbeans anymore. I found Netbeans so
great for Rails dev, but unfortunately this bug tends to happen almost on every file edition so it's not usable. I'm
back to Scite and Vim for the moment, sad.

I'm on Ubuntu Kernel 2.6.22-14, Intel core duo, Java 6 build 11.0-b09, using Gnome. The bug has been around for a while
(at least the last 6 months).

Guys I can't believe there is so little people having the trouble you don't fix it. Really it's ruining all your great
JRuby integration efforts. I might be wrong be I would say that if fixing this bug would take you half of the Ruby
features, it would still be a benefit for users like me. I guess it doesn't happen with the same frequency on every PC.
Still I re-installed lots of NB versions while Java uses to run fine on my PC, so I believe a few other people see the
same level of trouble I see, that should be devastating.

Best regards and thanks for the open source in any case.

Raphaël Valyi.
Comment 18 Vitezslav Stejskal 2008-02-06 13:17:32 UTC
Raphaël, what exactly is your JVM - 'Java 6 build 11.0-b09'? I'm on Ubuntu myself and have been using it + Netbeans for
everyday development for about a year. No focus problems at all. As we believe this issue is related to particular JVMs
that people use. Typical sufferers are Mac users, because they have no other choice that using Apple's JVM. On Ubuntu
you should be able to use latest stable JDK from Sun for example. I'm currently using JDK6 Update3 from java.sun.com:

java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
Comment 19 emi 2008-02-06 14:58:00 UTC
This is *not* as much a problem of Apple's VM as a NetBeans 6.0 problem ! I've used NetBeans 5.5(.0 and .1) for a long
time and the cursor didn't disappear on me like it does on NetBeans 6.0 (like 50 times a week at least).

Sure, maybe Apple's VM has some bugs (and please *close* this if it's provable only Apple's fault and there's no
workaround available) but this is foremost a NetBeans bug and I would say P1 or P2, not the lowend P3 like it is now.

I'm going to increase this to P2 and please someone explain why would they move it to P3 again, if they do it.
Comment 20 Vitezslav Stejskal 2008-02-12 10:54:11 UTC
*** Issue 127169 has been marked as a duplicate of this issue. ***
Comment 21 David Vancouvering 2008-02-12 18:07:25 UTC
I'm not sure why this issue as marked as incomplete?  What data are you looking for?  This issue is hitting a lot of
users, and I'm concerned it's not showing up on the dashboard because it's marked as incomplete.

I agree it's a P2.
Comment 22 Vitezslav Stejskal 2008-02-13 09:24:44 UTC
Right, at the moment we probably don't need more info, but what we could use some help. Neither Mila nor I work on Mac
OS and can't easily analyze this problem. Maybe the problem is not as much in Mac or Apple's VM as it is in Netbeans, we
don't know, but the fact is that it shows up on Mac OS a lot and only very rarely (if at all) on other OSes. We would
really appreciate if somebody with Mac OS could analyze the problem and find out what's wrong, why is it wrong and how
we can fix it. Thanks a lot.
Comment 23 emi 2008-02-13 09:46:25 UTC
Do you have an attack angle for this problem ? Some hints we could try to produce a patch or at least better debugging
info for you guys ?
Comment 24 Max Sauer 2008-02-14 14:56:09 UTC
*** Issue 120880 has been marked as a duplicate of this issue. ***
Comment 25 Vitezslav Stejskal 2008-02-15 11:35:05 UTC
Probably not directly related, but who knows - issue #126260.

Emilian, the truth is that we have no idea how to track this down. As I mentioned in #126260, I'm preparing a small
module, which should dump status info about opened editor windows. When it's ready I'll ask whoever is willing to help
to install it and send us its diagnostic output. If anybody has any idea (links to similar issues, docs to read, etc)
please post it here or drop me an email. Thanks
Comment 26 David Vancouvering 2008-02-15 16:56:28 UTC
FYI, this has stopped happening for me with recent builds...
Comment 27 rvalyi 2008-02-15 18:17:16 UTC
Hi,

unfortunately, bug as usual for me with last M1 version...
As usual, I didn't get the bug at the very first files openings, the first clicks and autocompletions. But still, soon
after opening a few ruby and rhtml files (6) from the project tree, I had my cursor not responding to keyboard actions,
as usual.

I don't know if it heps you, but some of my Ruby files are relatively large, one is more than 300 lines of code. My
whole Rails app isn't that small. It's also requiring Java and a few javabeans of my own to run properly (I don't know
if this could interfere). I think I got the same problem with standard Java files too actually.

A workaround for me is to open the Window > properties panel and then close it, then I can edit my file again (but don't
ask me why). Anyway this doesn't make editing very fluid either...

Guys, finally: I'M NOT RUNNING ON MACOSX, NO, I'M ON AN UP TO DATE UBUNTU, JUST LIKE OTHERS REPORTED. So please stop
flagging this topic as a pure MacOSX JVM issue, I believe it's not (at least for us it's not). MY JAVA IS ALSO UP TO DATE:
rvalyi@rvalyi-laptop:~$ java -version
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b09)
Java HotSpot(TM) Client VM (build 11.0-b09, mixed mode, sharing)

Finally: I'm responsible of the IT survey in the company I'm working in (www.Smile.fr) I've been a JRuby early adopter
and I'm only waiting my hour to demonstrate the true power of JRuby the my company. But until this is issue gets fixed,
I really can't present that to the company. I mean the guys will laugh at me when I'll tell Jruby has great IDE support
and the cursor in Nebteans will freeze every 5 minutes. JRuby is now rock solid I think I hope you get netbeans fixed too.
(Still congrats for the debugging support).

Regards,

Raphaël Valyi.
Comment 28 rvalyi 2008-02-15 18:27:51 UTC
Guys, as msauer suggested,

issue http://www.netbeans.org/issues/show_bug.cgi?id=126260
Is a perfect description of my problem too (including whole discussion). I guess both are duplicates indeed unless I
missed something very subtle.

Hope this helps.

Raphaël Valyi.
Comment 29 Vitezslav Stejskal 2008-02-18 11:04:27 UTC
*** Issue 126260 has been marked as a duplicate of this issue. ***
Comment 30 Vitezslav Stejskal 2008-02-18 12:51:22 UTC
Thanks Raphaël, we understand that this is not purely Mac OS issue.
Comment 31 Vitezslav Stejskal 2008-02-18 13:42:40 UTC
Ok, I downloaded and installed the same JDK as Raphaël. I'm also using Ubuntu 7.10 with Gnome and Intel Core Duo, 2GB
memory. I believe this is very similar environment to what Raphaël is using. I'll keep using this setup for a while for
my everyday development and we will see if I can reproduce the problem. The only apparent difference is that I don't do
Ruby, but Java.

uname -a:
Linux veech-laptop 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux

java -version:
java version "1.6.0_10-ea"
Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b11)
Java HotSpot(TM) Server VM (build 11.0-b11, mixed mode)
Comment 32 rvalyi 2008-02-18 21:39:03 UTC
Hi vstejskal,

glad to see you are trying to find out the issue and glad to see the OS platform has been moved to "all". To make sure
it wasn't due to the Ruby plugin, I just downloaded M1 again, but only the Java SE edition this time. Then I only
openned an existing java project: JRuby (SVN head; the java project, only consisting in java classes).

Then I only had to open some 3 files. I each of those 3 files, I tried trivial things like positioning the cursor inside
a java method, then writing "this." and pressing CTRL+Space to see the autocompletion popup. I tried to happen a few
(less than 10) methods removing them afterwards to try with an other. On the third file I clicked in the project tree,
the cursor was frozen unresponsive to keyboard events in the freshly open file: same bug. Again, no CPU usage, no
apparent memory leak; rather sounds like the cursor gets disabled programmatically for whatever reason. When coding in
Ruby, this tends to happen either on file opening, either on auto completion, either in Ruby and RHTML files.

So no this isn't even due to the Ruby plugin: this is happening as easily in plain java projects without the ruby
plugin. Again, openning Window > properties and closing the properties panel enabled the cursor again.

Also, on the #jruby IRC chat, Charles Nutter, JRuby lead told me that he had the problem occurring occasionally when
refactoring Java code. I guess he was speaking about the same issue. Indeed it's him who told me about the properties
panel hack to enable the cursor again, and that's almost the only thing that worked for me too, so I guess it was the
same issue. I guess he is on Mac OSX, but as others reported, including me, this happens on Linux + GTK too.

So far the About popup in netbeans told:
Product Version: NetBeans IDE 6.0.1 (Build 200801291616)
Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM 11.0-b09
System: Linux version 2.6.22-14-generic running on i386; UTF-8; fr_FR (nb)

And last thing about the JVM: I tried a few other java 6 version before this one and had the bug all the time. I think I
didn't had the bug on Netbeans 5.5 but I'm not very sure since I used it very little.

If there is any thing easy I might try to help you to find out what is going wrong (like launching an instrumented
version), please let me know. Good luck,

Raphaël Valyi.
Comment 33 Vitezslav Stejskal 2008-02-19 16:48:22 UTC
Ok, the bad news first, I've been using the environment for nearly two days without any problem (I was developing
Netbeans, having about 20 projects opened, mostly editing java files). Moreover, there are now two guys in my office
running Mac OS X 10.5.2 and using it for their normal everyday Netbeans work as well and still no problems... There are
probably still some differences in our environments or in the way we work, which obscure the problem. 

Now, the good news, I prepared a little plugin which when installed will dump the editor status. I'd like to ask anybody
who can reproduce the problem and is willing to spend half an hour on diagnosing this problem please follow the
instructions below and attach the dump file here or send it directly to my nb.org email. The plugin shows information
that I think will be useful for the analyzes, but we might need to add more output and run through several iterations.
So, please be patient.


You can build the plugin from main/contrib or use the version attached to this issue:

1. hg clone http://hg.netbeans.org/main/contrib
2. Open editor.probe project
3. Right click the project node and 'Create NBM'


In order to use the module:

1. Install the module and check for 'Editor Probe listening on port XYZ' message in the log (console).
2. Go to your browser and load http://localhost:XYZ/.
3. You should see a message asking you to switch back to Netbeans and wait, please do so.
4. After a while (5 sec) the page will be refreshed with the editor status.
5. You can copy-paste or 'Save Page As' the status info and attach it here.

Please note that in #3 it is important that Netbeans has a focus otherwise the page in your browser won't refresh. You
should preferably use Alt+Tab (on Mac I think it is Meta(Apple)+Tab) for switching back to Netbeans. Please avoid using
mouse and clicking somewhere inside the IDE, because it may change the focused component. After 5 sec or slightly more
you can switch back to your browser, the status page should be there. If it is not, please try repeating steps 2-4 and
possibly wait a bit longer.

Thanks for your help!
Comment 34 Vitezslav Stejskal 2008-02-19 16:49:59 UTC
Created attachment 56877 [details]
Editor Probe 1.1.0
Comment 35 David Vancouvering 2008-02-19 17:43:51 UTC
Created attachment 56883 [details]
Editor probe output
Comment 36 David Vancouvering 2008-02-19 17:45:47 UTC
Attached my dump from editor probe.  A couple of other things to note:

- I am writing code in Java, not Ruby
- I am using JDK 1.5
- The problem happens much less frequently than it used to, but it still happens about three times a day
- The workaround of going to Preferences, clicking around, and coming back to the editor works for me.  This is
significantly more acceptable than restarting NB, but most people won't know that this does the trick.
Comment 37 rvalyi 2008-02-20 00:17:05 UTC
Hi vstejskal,

I would like to install your probe plugin to help out but was unable to do so with Netbeans 6M1 java SE only. In the
plugin manager, when attempting to install the .nbm  you attached, I got:

Missing required modules for Plugin Editor Probe:
Editor Library 2 [module org.netbeans.modules.editor.lib2/1 > 1.6.0.2]
Editor Utilities [module org.netbeans.modules.editor.util/1 > 1.22]
File System API [module org.openide.filesystems > 7.6]
Datasystems API [module org.openide.loaders > 6.8]
Module System API [module org.openide.modules > 7.4]
Nodes API [module org.openide.nodes > 7.3.0.1]
Utilities API [module org.openide.util > 7.12.0.1]
Window System API [module org.openide.windows > 6.19] 

Any idea how I can install it (like force to discover the dependent modules, from where)? I'm sorry, I can't build it
from HG. Not used to it and no time. You can also reach me at r-v-a-l-y-i-@g-m-a-i-l.com (without the - of course) if
that might helps. Thanks in advance,

Raphaël Valyi.

Comment 38 rvalyi 2008-02-20 00:26:53 UTC
BTW, for me the bug arises far more than 3 times a day. When developing it's occurring like on every single minute but
always on file edition or auto completion (only). So for Ruby dev, I've a balanced feeling with constantly firing the
properties window or sticking with Vim or Scite. For regular Java dev, I don't even think a minute about using Netbeans,
this bug really kills it for me. So as I said, I hope it's a bit exceptional because else it's bad for Sun image. I
can't compare with co-workers as they all use Eclipse. i hope I can provide you helpful log if you give me more clues to
install your probe as I said earlier.

Raphaël Valyi.
Comment 39 Vitezslav Stejskal 2008-02-20 08:35:22 UTC
Raphaël, I'm sorry, my bad, I'll update the dependencies in the probe to match those in Nb6, this way it should install
to Nb6 and later builds. I'll attach a new nbm here. Thanks

David, the output you attached shows that there were no editors open in the IDE. Did you generate the output when the
IDE was in the broken state? Thanks
Comment 40 Vitezslav Stejskal 2008-02-20 09:56:17 UTC
Created attachment 56910 [details]
Editor Probe 1.2.0 - declares only dependencies on Nb6 libraries
Comment 41 marvi 2008-02-20 10:30:15 UTC
Created attachment 56916 [details]
Editor Probe dump from OS X when the editor is blocked
Comment 42 marvi 2008-02-20 10:32:00 UTC
I attached output from my environment when the editor was blocked. I clicked on the lightbulb to implement all missing
methods from an Interface when it happened.
Comment 43 Vitezslav Stejskal 2008-02-20 16:19:51 UTC
Thanks for the dump, you had two editors and none of them had focus, but I'm not sure why. So, the first thing we should
do is to find out where the focus had gone. Maybe we could try installing our own FocusManager, which would log focus
transitions between components or something along this path.
Comment 44 rvalyi 2008-02-20 23:15:21 UTC
Created attachment 56952 [details]
/home/rvalyi/Desktop/editor_probe_dump_rvalyi_linux.txt
Comment 45 rvalyi 2008-02-20 23:18:10 UTC
Ok, and here is mine: (/home/rvalyi/Desktop/editor_probe_dump_rvalyi_linux.txt)
I had 4 java files openned when it happenned, it was just after the autocompletion popup appeared. I cliked back in the
file and the editor had no cursor. Hope this helps.

Raphaël Valyi.
Comment 46 Vitezslav Stejskal 2008-02-22 14:34:21 UTC
Umm, Raphaël, your file shows only two editors - RubyContinuation.java and another nomadic editor pane (no file-based).
The editor with RubyContinuation.java apparently did have a focus.
Comment 47 rvalyi 2008-02-22 23:48:21 UTC
vstejskal,

well, I'm not sure there is absolutely no focus somewhere. Then my question is: how I can check where the hell my focus
is gone? If You try to move arrow keys, nothing happens, it doesn't bring me in some mysterious panel that got the
focus. Also,  it's still obviously a bug the focus to go away when auto completing or opening a file. Since I would be
very happy to use Netbeans for Rails dev, please feel free to tell me other things I might try to help you to track what
s going wrong. BTW, I code Java all day long at my job, I have some 2 years of experience in Swing dev, and never had
such a trouble except with Netbeans 6. That's just to emphasis I doubt it's my Java install or me misusing Netbeans. I
don't really know about how it works, but may be we could set up some VNC access to my Linux box if you want to try
yourself if the problem were to persist.

Regards and thanks for your efforts,

Raphaël Valyi.
Comment 48 David Vancouvering 2008-02-23 00:24:09 UTC
FYI, one thing that seems to regularly do it for me is choosing the lightbulb hint to add the @Override notation.  You
might try that to see if you can more reliably reproduce...
Comment 49 rvalyi 2008-02-23 19:44:18 UTC
BTW, I also tried whith an other JVM:
java version "1.6.0_04"
Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
And also tried to force the Metal look and feel, but none of the two helped. Also tried to increase -Xmx and MaxPermGen,
and also tried to totally disable my Compiz 3D Desktop but without any success regarding this bug. 
Now trying with last Netbeans snapshot...
Comment 50 Vitezslav Stejskal 2008-02-24 11:02:15 UTC
Raphaël, thanks for your help. None of us is saying that it is you or your way of using java/Netbeans, my friend. David,
I am aware that using hints seems to expose the problem and I've been using them as much as I could in the last several
days. But unfortunately with no success. Anyway, we are going to keep hunting it. The VNC session might be a good idea,
but first I'll try preparing that logging FocusManager.
Comment 51 Vitezslav Stejskal 2008-02-25 15:46:37 UTC
I have a new version of the probe which listens on FocusManager and logs focus transitions to standard Netneans log
file. It also dumps more info about current focused component. I'd like to kindly ask you to install it and send me the
output it generates plus the Netbeans *log* file from the same IDE session.

I had to change the codenamebase of the module, because it violated our new (Hg) naming conventions, which means that
you will first have to explicitly uninstall the old version. You can do that from the plugin manager, just go to the
'Installed' tab and enter 'probe' in the search text field. Then tick the checkbox in the 'Uninstall' column. After that
go to 'Downloaded' tab and use 'Add plugins...' to install the new nbm. If in doubt what version you are installing it
should be 1.4.0.

Also before you send us any log files please double check that it contains lines starting with "INFO [nbeditor.focus]:".
If you can't see any then the probe didn't log anything and it most likely means that your logging level is higher then
INFO. You can change the level by running the IDE with '-J-Dnbeditor.focus.level=INFO' (without apostrophes).

Thanks again for your help.
Comment 52 Vitezslav Stejskal 2008-02-25 15:47:54 UTC
Created attachment 57198 [details]
Editor Probe 1.4.0 - uninstall the old version first!
Comment 53 marvi 2008-02-25 17:27:26 UTC
I get:
"Exception in Editor Probe: null"

From the log:
VARNING [org.netbeans.modules.editor.retools.probe.Installer]: Exception in Editor Probe
java.lang.NullPointerException
	at org.netbeans.modules.editor.retools.probe.Probe.dumpAncestors(Probe.java:273)
	at org.netbeans.modules.editor.retools.probe.Probe.addGeneralStatus(Probe.java:151)
	at org.netbeans.modules.editor.retools.probe.Probe.getStatus(Probe.java:90)
	at org.netbeans.modules.editor.retools.probe.Installer$HttpServer$1.run(Installer.java:140)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused: java.lang.reflect.InvocationTargetException
	at java.awt.EventQueue.invokeAndWait(EventQueue.java:853)
	at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1257)
[catch] at org.netbeans.modules.editor.retools.probe.Installer$HttpServer.serve(Installer.java:136)
	at org.netbeans.modules.editor.retools.probe.NanoHTTPD$HTTPSession.run(NanoHTTPD.java:302)
	at java.lang.Thread.run(Thread.java:613)

I will attach a file with some more context from the log.
Comment 54 marvi 2008-02-25 17:29:32 UTC
Created attachment 57211 [details]
Log from NPE in Editor Probe
Comment 55 Vitezslav Stejskal 2008-02-26 11:08:46 UTC
Thanks for the log marvi. I think it actually shows something useful. I think the exception is just another symptom of
the problem we are trying to solve. The exception was thrown because there was no focus owner (a component), but it was
thrown from the probe when it was generating the status info, which doesn't happen unless the IDE has a focus (precisely
the IDE's main window has a focus). So, the FocusManager in the IDE was in the state where it had an activeWindow,
focusedWindow, but no focusOwner nor permanentFocusOwner. Now, I'm not an expert in this field, but I would believe that
this should never happen unless all components in the application are non-focusable or something about focus traversal
policy is broken.

Anyway, the interesting part of the log is just before the probe crashed and I assume that it is when the focus got
broken and the editor became unusable. 

- Here things were as usual - QuietEditorPane is the editor, its focusCycleRoot is the TabbedAdapter, ...
'focusOwner' old=[org.openide.text.QuietEditorPane@8194e2; name='null'; isFocusable=true; isFocusOwner=false] new=[null]
'permanentFocusOwner' old=[org.openide.text.QuietEditorPane@8194e2; name='null'; isFocusable=true; isFocusOwner=false]
new=[null]
'currentFocusCycleRoot' old=[org.netbeans.core.windows.view.ui.tabcontrol.TabbedAdapter@d2240d; name='null';
isFocusable=true; isFocusOwner=false] new=[org.netbeans.core.windows.view.ui.MainWindow@c3c5ee; name='frame1';
isFocusable=true; isFocusOwner=false]

- Here the focus goes to a mysterious java.awt.Panel and then to null (probably when you switched to your browser)
'focusOwner' old=[null] new=[java.awt.Panel@76d490; name='panel0'; isFocusable=true; isFocusOwner=true]
'permanentFocusOwner' old=[null] new=[java.awt.Panel@76d490; name='panel0'; isFocusable=true; isFocusOwner=true]
'permanentFocusOwner' old=[java.awt.Panel@76d490; name='panel0'; isFocusable=true; isFocusOwner=true] new=[null]
'focusOwner' old=[java.awt.Panel@76d490; name='panel0'; isFocusable=true; isFocusOwner=false] new=[null]
'permanentFocusOwner' old=[null] new=[null]

I'll keep investigating it and attach new version of the probe. But I think we might need to do some JDK patching in
order to find out what that mysterious java.awt.Panel is. Thanks
Comment 56 Vitezslav Stejskal 2008-03-01 17:23:30 UTC
I have updated version of the probe, which records where instances of java.awt.Component were created from. It also
records failures in Component.requestFocus() and similar calls. In order to do that I had to patch java.awt.Component
and add our own custom code to it. Therefore installing the probe now requires a special jar to be placed at the
beginning of the bootclasspath. The jar (in fact two jars - one for JDK5 and the other for JDK6) contains patched
version of java.awt.Component class and is queried from the probe when it generates its output. Here are the
instructions how to install the jar:

1. decide which one you need; if running Netbeans on JDK5 grab the editor-probe-jdk5patches.jar if on JDK6 use
editor-probe-jdk6patches.jar
2. copy the jar to your Netbeans *installation* directory
3. edit the <nb-install-dir>/etc/netbeans.conf file and add '-J-Xbootclasspath/p:editor-probe-jdk5patches.jar' (or
...jdk6patches.jar if on JDK6) at the end of the 'netbeans_default_options' entry

You can then run Netbeans as usually, install the probe from the attached nbm (version 1.6.0) and generate and attach
its output here when your editor misbehaves. Thanks
Comment 57 Vitezslav Stejskal 2008-03-01 17:25:02 UTC
Created attachment 57603 [details]
Editor Probe 1.6.0 - don't forget to install the JDK patch too
Comment 58 Vitezslav Stejskal 2008-03-01 17:25:55 UTC
Created attachment 57604 [details]
JDK5 patch for Editor Probe 1.6.0
Comment 59 Vitezslav Stejskal 2008-03-01 17:26:31 UTC
Created attachment 57605 [details]
JDK6 patch for Editor Probe 1.6.0
Comment 60 Vitezslav Stejskal 2008-03-06 08:02:47 UTC
Probably related to issue #90371.
Comment 61 Vitezslav Stejskal 2008-03-06 11:32:59 UTC
Could somebody please try the new probe with the JDK patches and post the report here? I know this is dragging, but
without further help and without being able to reproduce the problem I can't do much. Thanks a lot
Comment 62 marvi 2008-03-06 12:10:40 UTC
When using your settings the Editor Probe complains about a missing method, meaning the patch wasn't activated.

NetBeans on Windows uses the NetBeans directory as current working directory. On Mac/Linux it is the bin directory that
is CWD. I ran into this in my platform app when I wanted to reference a jar from netbeans_default_options. You can't do
that in a platform independent way. You could in 5.5.

When I succesfully added the patch, NetBeans wouldn't start. No error message, even if I start it on the command line.
The shell script just exits after ten seconds. No window opens. This is Java 5 on OS X.
Comment 63 phil59 2008-03-10 20:32:42 UTC
Guys,

Perhaps this would be a perfect time to make the case to your managers that you need a shinny new iMac to diagnose
issues like this :)

FYI... I've been having this problem since I upgraded to NB 6.0.1 (I don't think I saw it with 6.0).

Phil

System Version:	Mac OS X 10.4.11 (8S2167)
Kernel Version:	Darwin 8.11.1
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)

Product Version: NetBeans IDE 6.0.1 (Build 200801291616)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-121
System: Mac OS X version 10.4.11 running on i386; MacRoman; en_US (nb)

Comment 64 phil59 2008-03-10 20:32:43 UTC
Guys,

Perhaps this would be a perfect time to make the case to your managers that you need a shinny new iMac to diagnose
issues like this :)

FYI... I've been having this problem since I upgraded to NB 6.0.1 (I don't think I saw it with 6.0).

Phil

System Version:	Mac OS X 10.4.11 (8S2167)
Kernel Version:	Darwin 8.11.1
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)

Product Version: NetBeans IDE 6.0.1 (Build 200801291616)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-121
System: Mac OS X version 10.4.11 running on i386; MacRoman; en_US (nb)

Comment 65 Vitezslav Stejskal 2008-03-11 11:00:11 UTC
marvi, thanks for the info. I think I will have to prepare a special version of the JDK patches for Mac.
Comment 66 Max Sauer 2008-03-14 11:41:32 UTC
Adding probe version for MacOSX/JDK1.5.
Comment 67 Max Sauer 2008-03-14 11:42:38 UTC
Created attachment 58379 [details]
mac od / jdk 1.5 probe version
Comment 68 Vitezslav Stejskal 2008-03-14 12:09:32 UTC
Thanks for this Maxi. Just to summarize - jdk5patches.jar and jdk6patches.jar should work on linux/solaris/windows and
jdk5patches_mac.jar should work on Mac OS X. There is no JDK6 version of the patches for Mac. Regarding where to place
the jar before starting Netbeans, you can place it anywhere on your disk and then add its full path to the
'-Xbootclasspath/p' switch. This is safer than the steps I described originally.

Additional questions for those suffering with this problem: What keyboard profile are you using? Could you confirm if
showing a hint (eg. alt+ENTER on a line with a lightbulb) and then canceling it by ESC does or does not trigger the
problem? Thanks
Comment 69 marvi 2008-03-14 15:20:08 UTC
After installing the new JDK patch, I haven't been able to reproduce the problem like before. I will have it installed
for a while and see if it shows again. 
Comment 70 Vitezslav Stejskal 2008-03-15 09:09:10 UTC
Thanks marvi. What you're saying sounds like a timing issue of some sort, because all the patches do is that they record
stacktraces when an instance of java.awt.Component is created and when some of its requestFocus calls fails (ie. would
return false to a caller).

We've noticed some Mac OS X specific code in java.awt.Component, which was why the original jdk5patches.jar didn't work.
I'm going to have a closer look at it to see if there is something suspicious.

Another thing to look at is the use of requestFocus vs requestFocusInWindow. The javadoc discourages using the former
one in favor of the latter saying that it's behavior is platform dependent. Still, in Netbeans we use requestFocus in
many places.
Comment 71 rvalyi 2008-03-15 15:54:04 UTC
Hi vstejskal,

sorry for the delay: not much time. BUT, THIS IS FANTASTIC, I CAN NOW USE NETBEANS! BYBY RADRAILS!!!
Same as marvi: activating the JDK6 patch fixes all cursor issues for me! Time to patch the JDK or Netbeans for real then.
I quite sure of it. I t tried everyting I could, either eiditing (J)Ruby code, eitheir editing Java, no bug. then I
disapled the command line option and the bug was there again. So I'll stcik with the patch and hope Sun can do something
for all the folks I suspect might see the bug and are neither able to patch anything, neither aware of it.

Still, if you want me to try to log something while reactivating the bug I could do it, I'll stick arround.
Best regards.

Raphaël Valyi.


Comment 72 Vitezslav Stejskal 2008-03-15 17:35:33 UTC
Thanks Raphaël! I'm really happy for you guys, but at the same time this is still puzzling me. The patches we prepared
actually do *not* patch or fix anything. They only record creation stacktraces of AWT components and failures in focus
transition calls to j.a.Component.requestFocus and similar. At the best the patches may slow down things a little bit.
So, after all this exercise the only thing we know is that something is broken around requestFocus calls, but we don't
know what nor how to fix it. We don't still even know if it's JDK or Netbeans to blame.

Should the problem happen again when running with the JDK patch please use the probe to generate the report and post it
here. Hopefully there will be enough evidence in the report to find out what went wrong. Thanks
Comment 73 nigeleke1957 2008-03-18 11:58:38 UTC
Created attachment 58565 [details]
Output from editor probe after editor freeze.
Comment 74 nigeleke1957 2008-03-18 23:13:43 UTC
This problem occurs frequently in my setup.  Too frequently, unfortunately, to make Netbeans useful.  I can confirm 
also that it does appear to be related to the hints at the side of the editor.
I can recreate the problem fairly easily:
1. Create new project.
2. Create new class.
3. Edit class source code so that an error message occurs and red triangle appears.
4. Save file and close netbeans.
Then either:
5a. Simply restart netbeans (editor is locked up immediately) or
5b. Restart netbeans, click on red triange.

I've attached Editor.probe output from the above scenario.  If there's anything else I can help with please let me 
know.

Nigel
Comment 75 Vitezslav Stejskal 2008-03-19 10:54:05 UTC
Hi Nigel, thanks for the report. Could you please install the jkd6patches.jar and rerun the test? If the editor locks up
again please generate and attach the probe info here again. If it doesn't lock up anymore then, well, you have a
workaround and we will have to keep searching ;-). Thanks
Comment 76 nigeleke1957 2008-03-19 12:43:02 UTC
Created attachment 58647 [details]
Patched editor.probe log - pre-freeze
Comment 77 nigeleke1957 2008-03-19 12:43:55 UTC
Created attachment 58648 [details]
Patched editor.probe log - post-freeze
Comment 78 nigeleke1957 2008-03-19 12:49:51 UTC
Hi Vita - many thanks for the help for applying patches.   I have now attached two traces.  To obtain these I:

a) Started netbeans - with the test project (which opens with a source file containing compilation error)
b) Confirmed source file is editable at that stage
c) Took snapshot 20080319_1
d) Clicked on red triangle in editor gutter
e) Confirmed source file is no longer editable
f) Took snapshot 20080319_2

Hope this sheds some light... as usual, let me know if there's anything further I can do.

Cheers,

Nigel
Comment 79 nigeleke1957 2008-03-21 04:07:51 UTC
I have some additional info, which I hope will help track down this problem.  I am attaching an annotated output of
messages.log.  (Look for ">> NEKE++" comments for significant actions during the trace).

Basically, as before, I
a) start Netbeans
b) click on red error icon
c) focus on editor window.

Nigel
Comment 80 nigeleke1957 2008-03-21 04:09:09 UTC
Created attachment 58811 [details]
Annotated messages.log
Comment 81 nigeleke1957 2008-03-21 08:37:15 UTC
One more symptom to report.  Following a freeze, if I right-click on the file's "title" and select Undock (or Dock, if
the window was already undocked), the file is then editable.

The freeze can occur on docked and undocked windows.
Comment 82 Vitezslav Stejskal 2008-03-26 10:34:20 UTC
Thanks a lot Nigel!
Comment 83 Jiri Prox 2008-03-27 08:26:41 UTC
*** Issue 131197 has been marked as a duplicate of this issue. ***
Comment 84 Jan Lahoda 2008-03-27 08:26:43 UTC
*** Issue 131197 has been marked as a duplicate of this issue. ***
Comment 85 nigeleke1957 2008-03-27 09:08:16 UTC
Shame to note the waive request.

Clearly I'm biased as I'm suffering from this defect, however please keep in mind the 'duplicates' that are also being
raised here, when evaluating the request.

Thanks for all the patches etc to help us track the problem.
Comment 86 Vitezslav Stejskal 2008-03-31 09:33:14 UTC
This is not to make excuses or anything. But we don't seem to be the only IDE fighting focus problems -
http://www.jetbrains.net/jira/browse/IDEADEV-2359. I also found
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685, which seems to be closed as 'not reprodicuble'. It was
originally opened for JDK5, but it contains some not so old comments complaining about the same problem in JDK6...
Comment 87 Jiri Prox 2008-04-04 09:49:31 UTC
*** Issue 131970 has been marked as a duplicate of this issue. ***
Comment 88 Martin Krauskopf 2008-04-07 13:55:21 UTC
> Re: TM -> Future

Note there is already 'Dev' TM for the next release.
Comment 89 rvalyi 2008-04-14 01:26:04 UTC
Created attachment 60105 [details]
crashing again on Netbeans RC1 on Ubuntu, log for probe + jdk6 patch
Comment 90 rvalyi 2008-04-14 01:31:57 UTC
Hi,

Unfortunately, as you can see:
http://www.netbeans.org/nonav/issues/showattachment.cgi/60105/nb_rc1_ubuntu_lost_focus_rvalyi.txt
It's still crashing with Netbeans RC1, just editing a basic Java SE file
on Ubuntu Linux, with last JDK6.
The probe makes the bug happen quite less often, but IT DOES STILL HAPPEN and it sucks when it appears. I don't know how
many users get it, but as for myself at least that's a showstopper for version 6.1, saddly.
Please if you can't fix it, try to provide some button or something to go back editing when it happens; it would still
make our life much simpler than always try to invent a working way to get the focus back. May be a plugin forcing the
focus to come back for the crashing platforms?

Thank you for your help.
BTW: I didn't provide a log sooner because I was lacking of time for that, not because the bug didn't show up. It still
does happen on a very regular basis.

Raphaël Valyi.
Comment 91 Vitezslav Stejskal 2008-04-14 10:50:45 UTC
Thanks Raphaël. That's what I suspected, the probe doesn't fix the problem it only changes timing and the defect may
happen less frequently. Anyway, having a button that would somehow force the focus back to the editor is not a bad idea.
I also have one more question - are you guys using 'focus follow mouse'?
Comment 92 nigeleke1957 2008-04-14 11:43:15 UTC
I'm not using 'Focus follow Mouse'.  I turned it on to see if there was any difference, but there isn't.
Comment 93 rvalyi 2008-04-14 21:33:42 UTC
Hi vstejskal,

No, not using any "focus follow mouse" option either. Thank you for your help anyway.

Raphaël Valyi.
Comment 94 nigeleke1957 2008-04-28 13:57:14 UTC
Change of environment has "fixed" this problem for me.

I have recently upgraded to Ubuntu 8.04 (AMD) release.  As a result I have also upgraded to Netbeans 6.1 (RC2) (and
today - 6.1) releases.  The lock-up does not appear to occur for me now.

The hardware environment is the same.
Comment 95 rvalyi 2008-04-29 00:56:26 UTC
Hi all,

Sorry for the bad news, but I'm also on Ubuntu 8.04 with Netbeans 6.1 final and I DO HAVE THE EDITOR FREEZE!
Yes, it's seems it's not very often, not as often as it used to be, even pretty usable, but it does still occur for me.

Several times in the past I got misleader: the bug didn't show up very often so I thought it was gone, but then it came
back showing up very often again. So even if I saw it only once after 1 hours of use, I wouldn't say it's over. It's a
one year old friend and I'm starting to know him...

Sorry for the bad news then. Great work on the (J)Ruby editor still!
Comment 96 nigeleke1957 2008-04-29 10:24:53 UTC
My Ubuntu upgrade was also from i386 to AMD, i.e. 32-bit to 64-bit.  But I do say "fixed" with reservations.  To date it
hasn't re-occurred, but I'll continue to follow this defect and post if I do see this happen again.
Comment 97 Vitezslav Stejskal 2008-05-07 09:41:57 UTC
*** Issue 32755 has been marked as a duplicate of this issue. ***
Comment 98 rvalyi 2008-05-17 19:51:42 UTC
A few more details:

At least our bug doesn't seem to be this bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6465038
at least as I coudln't reproduce that #6465038 bug.

Also I tried, starting Ubuntu in failsafe mode without Gnome (only terminal and then Netbeans 6.1 final) and experienced
focus losses again. So that's really nothing to do with Compiz or Gnome.

Still, that other issue seems weird on my Ubuntu: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685
If I focus outside from the JTextField and then try to writte inside again, it won't work. That's weird but
unfortunately I didn't understand if this was the expected behavior.

Making the field a static property (still in #4851685)  and doing it the following allows me to gain the focus again in
the provided test case. That would be perfect if we could apply such a fix for Netbeans but I'm not sure yet that the
same case and what to do exactly.

        public void focusLost(FocusEvent e) {
            System.out.println(name + (e.isTemporary() ? " lost temporary focus." : " lost focus."));
            if (field != null) {
                window.setVisible(true);// if you don't do this you can't gain the focus again; but that one seems      
                                        //expected after the focus spec since the field owner is a JWindow 
                                        //which isn't focusable.
                field.requestFocus();
            }
        }


Hope this helps some way.
Comment 99 rvalyi 2008-05-19 11:15:50 UTC
READ: WORKAROUND INCLUDED: use last Java 1.5 on Linux!

Hi guys,

I actually CONFIRM I do have this bug almost systematically on my Ubuntu:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685
I just confirmed that on my Ubuntu I'm not able to focus the JTextField again after I click outside it once. On the
contrary, on an other Windows PC we don't see that bug, never (see comments for #4851685).

So, it might be something else, but it's also highly probable that the bug we see with Netbeans is actually #4851685

I've two reasons to believe it's the same bug:
1) since I'm one of the few one having both two bugs, it's probable they are related.
2) somebody told #4851685 was fixed in last JDK1.5 updates (see comments). Actually as I said (see comments (I didn't
observe a fix of #4851685 (because of what appears to be an other bug, but I couldn't either try the same jdk 1.5 build
because it's not available for download anymore, see my #4851685 comments). But I GOT NETBEANS 6.1 final WORKING FINE
USING 1.5.0_15-b04 RATHER THAN ANY JAVA 6!!!

SO GUYS RUN TO JAVA 1.5 DOWNLOADS PAGE AND USE IT WITH NETBEANS (only) IF YOU ARE IN TROUBLE WITH THAT BUG.
CAN ANYONE CONFIRM ? (at least on Linux). Still Java 1.5 sucks because the font rendering is much worse.

Still, I could find the comment here: scroll to "gfodor Thu Nov 15 01:20:25 +0000 2007" where godfor said he had the
problem using Ubuntu and Java 1.5 (version no mentionned). But may be it was due to a previous Java 1.5 or a previous
Netbeans release. All other folks reporting the issue with Java1.5 seem to run Mac/OSX and this could be an other JVM
issue then.

ANYWAY I THINK SUN MADE A SERIOUS JAVA6 REGRESSION HERE. Any workaround/patch for using Java 6?

Hope this helps,

Raphaël Valyi
www.smile.fr
Comment 100 Vitezslav Stejskal 2008-05-19 12:08:33 UTC
Thanks a lot Raphaël for all this work and sharing it with others.
Comment 101 Jan Pokorsky 2008-06-03 09:19:48 UTC
*** Issue 136212 has been marked as a duplicate of this issue. ***
Comment 102 Jan Becicka 2008-06-18 13:53:30 UTC
This is JDK bug.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685
Comment 103 marvi 2008-06-18 14:05:18 UTC
jbecicka: Are you sure? The JDK bug doesn't mention OS X. And it is closed as not reproduceable?

The issue is resolved for me in Leopard, with Java 6 and Netbeans 6.1. 

Comment 104 pohl 2008-06-18 14:28:17 UTC
Could we leave this issue open until we're sure that a proper bug report (open, accepted, covers this actual bug...) has been filed against the JDK?  I see no 
indication from  Raphaël that Anton's request (that a separate issue be  filed) had been met.
Comment 105 phantomsoul 2008-06-18 15:44:36 UTC
Problem is still occuring on the latest available NetBeans 6.1 release at this time.

Mac OS 10.5.3 on i386 (Intel-based)
Apple JRE (based on Java HotSpot VM 1.5.0_13-119)
Using the Metal/Ocean look and feel.

Problem seems to occur every time any macro action is invoked that results in any kind of editor text to be altered, e.g. invoking the light bulb hints to add 
imports or implement interfaces, or using the code re-factoring macros.  So far, the only way I've been able to restore the cursor/editability is to complete 
close out of NetBeans and restart it, which is way too much of a burden every time an automated process is used to alter code.
Comment 106 rvalyi 2008-06-23 23:24:43 UTC
pohl,

Despite Anton request, I confirm that http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685 seems to be a very
correct description of the bug that seems involved here. At least I'm able to reproduce issue #4851685 with any jdk6 I
tried on my Ubuntu so I think this is the big. At least I've no better bug description for Anton that #4851685 which
seems the exact bug for me (see attached explanations).

Also, I found a better work around, at least for Linux users like me: for me, using jdk7 (build 26 at least and above)
fixes that bug and provides a much better Swing that JDK5. So you could end up using JDK7 at least for Netbeans. BTW I
use jdk7 for everything else on my dev PC except for production of course and I saw no regression so far.

Hope this helps and wish good luck to your MacOSX folks; bare in mind that for MacOSX, the bug might be different.

Raphaël Valyi
Comment 107 Jan Becicka 2008-07-30 08:33:09 UTC
> The JDK bug doesn't mention OS X.
Yes. Sun's bug tracking system does not track OS X issues, because OS X JDK is developed by Apple.
> And it is closed as not reproduceable?
Yes, we cannot reproduce it either, but we are work closely with JDK team on it. If anyone of you have steps to
reproduce, please contact me privately, I'll contact you with responsible JDK engineer.
Thanks



Comment 108 _ wadechandler 2008-08-14 11:48:45 UTC
I don't think this is just a Mac issue. I think I'm also experiencing this on Windows XP SP3 using JDK 1.6 update 4. See
issue #143830 which I think may be a duplicate of this issue, but it is certainly happening. Is there any relation to
what is in my issue with any one else's? Are any of you using another IDE to edit files? Is it happening when you try to
use find? Anyways, I feel this needs to be left opened and not have a WONTFIX as it definitely is real. If you close my
bug as a duplicate, then please reopen this one; it is real, on multiple operating systems, and needs to be on the radar
and not hidden behind a WONTFIX. Either way I'll see if I can find out something by debugging the IDE and anything else
if I can actually figure out what is making it happen on my system.
Comment 109 Vitezslav Stejskal 2008-08-18 10:37:27 UTC
Umm, I'm not sure if issue #143830 is a duplicate of this one. In #143830 you say that the editor pane reacts to the
arrow buttons, but they scroll the pane instead of moving the caret. This exactly happens if there are no shortcuts
(keybindings) loaded in an editor pane; it's then forwarding all keyevents to its parent scroll pane. If #143830 were
the focus issue the pane would ignore the keyboard input completely.
Comment 110 dariusp 2008-11-19 16:19:30 UTC
I am using Netbeans 6.5beta, and lost focus issue appears every time when i somethink type in skype, and return to
netbeans editor.

Product Version: NetBeans IDE Dev (Build 200810090201)
Java: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)
Userdir: /home/darius/.netbeans/dev
Comment 111 Miloslav Metelka 2008-11-25 15:43:59 UTC
Have you tried the attached Editor probe? Could you please attach the messages.log after using the tool? Thanks.
Comment 112 Vitezslav Stejskal 2008-12-01 11:22:15 UTC
> I am using Netbeans 6.5beta, and lost focus issue appears every time when i somethink type in skype,
> and return to netbeans editor.

Interesting, that it happens always. I use Skype and Netbeans everyday without problems. I tried that with dev builds
and it worked fine (I had a different JDK though).

Product Version: NetBeans IDE Dev (Build 081201)
Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.22-16-generic running on i386; UTF-8; en_US (nb)

I still think that this is a JDK issue and can't be fixed in Netbeans.
Comment 113 _ wadechandler 2008-12-01 16:54:22 UTC
Are any of you folks experiencing this issue able or willing to download VirtualBox:
http://www.virtualbox.org/

Setup the image basically like your computer. You don't have to put everything on there you have on your system, but try
to get the issue to surface in the setup. Then, when you get the issue to occur, would you be able to share that image?
If you can do that it might actually help track the issue down whether it is in the JDK or in some logic patterns or NB.
Otherwise the developers are stuck on the issue really. Thanks.
Comment 114 _ tboudreau 2008-12-02 01:29:26 UTC
Vita, I'm sure I am reopening your nightmare as I reopen this bug - mea culpa :-).  Given the number of users commenting
and people running into this (and a substantial thread on the DreamTeam list), it seems like any sort of workaround that
would at least get people out of having to restart NetBeans would be a help.  I've run into this issue on my Mac in the
past (I think I filed one of the duplicates here) - I did discover that a workaround was to get focus to another window
such as the Find dialog (invoked by mouse from the menu) and back.

Perhaps a small module which does the horrible hack of installing a keystroke which, when invoked will
 - Open a new window with some focusable component in it
 - Send focus to that component
 - Close the window
 - Send focus back to the editor
would probably at least enable people to get work done.

FYI, I noticed a few peculiarities of focus handling in NetBeans a few years ago when I was working on the window
system.  I don't know if this is still true - and it is probably an artifact of hacks somewhere in the window system -
but I recall that there are some differences between a normal Swing app's focus behavior and NetBeans' - I never tracked
down the culprit, I just noticed it when I was writing a focus logging module similar to what you wrote here. What I saw
was that in a normal Swing app, focus traversal from component A to component B is usually just A -> B.  In NetBeans, if
you listen to KeyboardFocusManager, what you usually see is A -> null -> B.  Anyway, perhaps that could help provide a clue.

The main reason for reopening is that the JDK bug which is the assumed culprit is closed as not reproducible.  There
needs to be a bug open somewhere that documents that this needs really is broken.  I'd suggest pushing hard on the JDK
team to reopen their bug and then close this, but any workaround would probably help a lot of people here out.  
Comment 115 kiyut 2008-12-12 07:13:13 UTC
On linux and ubuntu

I encounter this bug long time ago when I was still using Netbeans 5.5
and found that gnome scim have problem (stealing the focus) with my
Netbeans usage. So just remove the scim and the problem gone. And now
on Ubuntu 8.04 and Netbeans 6.5, I never use/install scim again :)

So I suspect, it is related with some application eg: Input Methods Software, etc that compete/stealing the focus from
eg: Netbeans.

And it might happend in other platform (my case is Linux and Gnome) when similar application are trying to steal focus.
Comment 116 kiyut 2008-12-12 18:43:37 UTC
It seem it is not Netbeans specific bug, but it is Java Swing and Linux bug. Please see the Sun Java bug report for this
case http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6506617
Comment 117 _ wadechandler 2008-12-12 19:19:20 UTC
It was happening to me on Windows XP. But, the main problem for NB is that it isn't affecting JDeveloper or IntelliJ as
far as I have seen or read. Of course as Eclipse uses SWT this particular bug doesn't affect it. But, it kills NB for
those running into it. 

Too, as it seems to only be affecting NB we need some workaround or something. Can't wait for Java 7 for those folks who
can't use it or they can't use NB...lost users and bad word of mouth, and there has apparently been no movement to show
it would be fixed for Java 7. 

It only manifested for me when working in another IDE, JDeveloper, and switching back and forth between NB working on
the same files, having them both opened at the same time, and I'm not 100% sure why, and not near as much as it did for
some of these folks. It has never happened to me on openSuSE 10-11.
Comment 118 Miloslav Metelka 2009-01-07 11:49:07 UTC
*** Issue 155137 has been marked as a duplicate of this issue. ***
Comment 119 _ wadechandler 2009-01-07 15:43:33 UTC
I don't know if it is related or not, but certainly seems it can be the same bug, but on one of my XP systems on
location controlled through GoToMyPC, not the same as Windows virtual terminal services, the edited document will be
messed up when I ALT+TAB to other applications then ALT+TAB back. So far I haven't found a method to reliably reproduce
though. Essentially it does it sometimes and not others, and at times it does it more often. The problem is the cursor
shows up, but keys don't work and the arrow keys move the scrollbars back and forth and up and down; thus the arrow keys
move the view as if I was using the mouse on the scrollbars. The cursor does not move, but is in the document.
Comment 120 _ wadechandler 2009-01-10 07:03:53 UTC
Seems related to some of the things going on in the side of the editor such as the gutter and other things like code
folds. Mine is now looking different and acting slightly different. The cursor shows up and I can move it with the mouse
and the arrow keys move the scrollbars. I can type, but I must then use the mouse to go back and delete something, so
the arrow keys and focus are messed up in some funny ways. It certainly seems it may be related though, and may be
exposing the root cause albeit in the JSP editor, but very similar none the less. I'll attach a screen shot. This is
happening very frequently.
Comment 121 _ wadechandler 2009-01-10 07:05:56 UTC
Created attachment 75656 [details]
Visual view of a focus and cursor error...maybe key events...either way the JEditorPane looks different
Comment 122 Vitezslav Stejskal 2009-01-10 07:32:41 UTC
Wade, I think your report is the same problem as issue #154292. I'm not sure if it's related to the original problem
mentioned in this issue, but let's keep it separate. In #154292 there seems to be a problem in accessing SVN, which
could be the rot cause for all this. Are you using any kind of VCS on the machine where this happens? The messages.log
attached in #154292 shows exceptions when accessing SVN through a tunnel and the connection apparently could not have
been established. Please post your comments (messages.log and/or uiguestures) to #154292. Thanks
Comment 123 _ wadechandler 2009-01-10 15:11:28 UTC
I am actually using SVN with this project this has been happening. 
Comment 124 _ wadechandler 2009-02-04 16:10:12 UTC
More information. It happened again, but this time I couldn't even get a cursor in the editor. This was on a local
laptop running Windows XP SP3. This was on a project using Mercurial. I was working on
https://hg.netbeans.org/platformx. I had build scripts and some Java files opened. I changed them in a text editor,
TextPad, outside of the IDE; I was checking on some things, opened them, and just worked on them there...spontaneous I
guess. Anyways, I changed back to NB, tried to click in the editor, and nothing. I had to close the files and reopen them. 

Is anyone else noticing this as being their issue? Are you editing files outside of the IDE and then switching back and
roughly then it is losing focus? Every time this or the other issue has happened to me I have been using something else
to edit files and switching between the other editor and NB. This has happened to me in Ant, Java, and JSP files now.
Comment 125 _ wadechandler 2009-02-04 16:13:13 UTC
Too, this doesn't happen always. It is sporadic. I can edit files quite regularly at times back and forth, and it
doesn't happen. Other days it happens a whole lot. In all cases it seems to have been when changing files outside the
IDE. Maybe some of you others have not been using another editor, but maybe you have been using svn or hg to update
files and ones you have opened in the editor are reloaded perhaps? Anyways, I'm just noticing this as a pattern from my
end on more than one system now.
Comment 126 Marian Mirilovic 2009-02-20 17:27:13 UTC
waiver update
Comment 127 minashokry 2009-06-30 10:00:39 UTC
hi guys,
I can confirm this issue happens with me on netbeans and other java applications.
It happens with me with netbeans 6.0, 6.1, 6.5, and 6.7 on sun java and openJDK. ALso happens with Dynamsoft
SourceAnywhere for VSS.
I am mainly developing JavaME and every time I run my application and start the emulator, after I return to netbeans I
found it not receiving input from keyboard.
It isn't necessary to open a dialog to restore input, just opening and closing a menu by mouse is sufficient.
Comment 128 Jiri Prox 2009-08-17 15:58:55 UTC
*** Issue 170110 has been marked as a duplicate of this issue. ***
Comment 129 Jiri Prox 2009-08-19 15:31:50 UTC
*** Issue 167562 has been marked as a duplicate of this issue. ***
Comment 130 _ wadechandler 2009-09-11 16:26:47 UTC
All you really need to see the issue is a GoToMyPC.com account. Probably already accounts on gotomypc used at Sun from
home computers...maybe...maybe not. But seems to show the issue seemingly every time I leave NB running, exit GoToMyPC,
and then reconnect.
Comment 131 Vitezslav Stejskal 2010-02-18 09:00:24 UTC
*** Bug 176395 has been marked as a duplicate of this bug. ***
Comment 132 Vitezslav Stejskal 2010-06-08 09:46:21 UTC
*** Bug 187290 has been marked as a duplicate of this bug. ***
Comment 133 David Strupl 2010-08-24 12:50:33 UTC
I am closing this report is "wontfix". I have marked it as JDK Bug 4851685 with what a lot of people in this thread already agreed. If you think that the behavior you see is indeed a NetBeans bug (and not general Java bug in your setup) please file separate issues.

Also it is highly probably that the code that deals with focus is somewhere in the platform and not in the editor itself so tracking this issue as editor problem is rather inaccurate.

Thanks everyone for your understanding and patience with us.
Comment 134 nairbv 2010-08-24 13:39:10 UTC
(In reply to comment #133)
> I am closing this report is "wontfix". I have marked it as JDK Bug 4851685 with
> what a lot of people in this thread already agreed. If you think that the
> behavior you see is indeed a NetBeans bug (and not general Java bug in your
> setup) please file separate issues.
> 
> Also it is highly probably that the code that deals with focus is somewhere in
> the platform and not in the editor itself so tracking this issue as editor
> problem is rather inaccurate.
> 
> Thanks everyone for your understanding and patience with us.

Can you link us to a JDK bug report we can track?

I only see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4851685
which is marked as "closed, not reproducible," and which doesn't have any comments pointing back to this netbeans example.  If we can help them get a net-beans based test case I think we'll be more likely to see our issue resolved.
Comment 135 sguha 2011-10-07 17:56:08 UTC
This bug is STILL present on Netbeans 7.0.1

From netbeans about box.
Product Version: NetBeans IDE 7.0.1 (Build 201107282000)
Java: 1.6.0_25-ea; Java HotSpot(TM) 64-Bit Server VM 20.0-b10
System: Linux version 2.6.18-128.el5 running on amd64; UTF-8; en_US (nb)
Userdir: /home/sguha/.netbeans/7.0

>uname -a
Linux gull.arc.nasa.gov 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux


Keyboard input for Netbeans IDE goes dead. 
Cursor shows up in the editor window, when mouse is clicked. 
Mouse works, all mouse related menus work. 
Could not find a workaround: 
Only workaround: restart IDE. 

Keyboard keystrokes work on other applications
I run with debug on, no exceptions on console. 

Thanks
Comment 136 bornmw 2011-11-07 18:08:50 UTC
(In reply to comment #135)
> This bug is STILL present on Netbeans 7.0.1

It is also present on not-a-Netbeans, so I guess it's some kind of a more general Java bug.
I'm experiencing exactly the same behavior with IntelliJ Idea 10.5.2

$ java -version
java version "1.7.0_147-icedtea"
OpenJDK Runtime Environment (IcedTea7 2.0) (Gentoo build 1.7.0_147-icedtea-b147)
OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

$ uname -a
Linux xxx 3.1.0 #1 SMP Sat Nov 5 16:39:33 MSK 2011 x86_64 Intel(R) Core(TM) i3 CPU M 330 @ 2.13GHz GenuineIntel GNU/Linux

BTW, it was not present on IcedTea6
Comment 137 Petr Jiricka 2012-01-06 19:23:39 UTC
There are more complaints about this problem here: http://www.shinephp.com/netbeans-ide-for-php-7-1-available/. Is this now happening more frequently?
Comment 138 Petr Jiricka 2012-01-06 19:29:14 UTC
BTW, since this user can reproduce the problem *consistently*, would it be worth it to work with him, e.g. by giving him a build with special logging messages, so we can chase this down and figure out where exactly the problem is?
Comment 139 dirk_schmitt 2013-02-08 19:08:55 UTC
I still run in this **serious** issue on 7.3.rc1.

On every start after some seconds no keyboard input in the editor was possible.
This shows on openjdk-7, oracle-7, oracle-8 below ubuntu 12.04 (amd64).

The workaround I use is to use the openjdk-6.  
(see also comment #136).
Comment 140 Marian Mirilovic 2013-02-12 14:48:42 UTC
Please do not change version.

Also would be nice and much better to track it as new bug, since this one is too old and contains all relevant & irrelevant informations. Thanks for understanding.
Comment 141 iamwill 2013-03-25 23:48:44 UTC
I have also encountered the keyboard dropping out after creating a new file problem.  The only solution is to restart Netbeans. (I have been unsuccessful with just closing and reopening the file, and keyboard inputs don't work anywhere else in Netbeans after the drop.)  

Caps lock and number lock still function while Netbeans is the focused window.

I have also noticed when I try to highlight/copy/paste from chrome web browser, the keyboard drops, and when I switch to chrome web browser and do a search, it's a 50/50 chance that the keyboard will drop.

I am running compiz with fusion icon, and either window manager (compiz or xfwm4) doesn't matter, problem is reproducible every time.  Below are some system stats in case it helps.

Arch Linux x86_64 - kernel 3.7.10-1
Netbeans 7.3-1
jdk7-openjdk 7.u17_2.3.8-1
jre7-openjdk 7.u17_2.3.8-1
jre7-openjdk-headless 7.u17_2.3.8-1
xfce 4.10.0-6

- Will
Comment 142 ihsahn 2013-03-28 20:42:09 UTC
I came across the same issue:

- netbeans 7.3
- Oracje JDK 1.7 u17 64 bit
- Ubuntu 12.10 with Xfce
- all of the above 64 bit system (64 bit kernel etc)

NB starts, loads project, I can edit file, but as soon as I alt-tab to 
other application and get back.. no keyboard actions are available. I 
mean click on the editor and I see that status bar indicates that curor 
position changed, but there is no cursor, I cannot type anything etc.. I 
may leave NB open and do some other work and after some time when I get 
back cursor is available, but of course when I switch to other 
application for a moment, everything starts again... making

I've tried following things with no effect:
- Netbeans 6.2
- Jdk 1.7 u 17 32 bit

the only thing that currently works is downgrading jdk to 1.6 so it would suggest that it's indeed JDK issue, however issue linked there as root cause is closed long ago....

also, exacly the same configuration, except that running on 32 bit 
system shows no problems.
Comment 143 johny65 2013-11-12 00:43:45 UTC
I had the same problem using Xubuntu 64-bit and Netbeans 7.4, it was practically unusable, as ihsahn says in comment #142, as soon as I alt-tab to other application and get back I couldn't enter any text.

The solution that worked for me is to enable "Honor standard ICCCM focus hint" in the "Window Manager Tweaks" configuration of Xfce (http://docs.xfce.org/xfce/xfwm4/wmtweaks#focus). With that activated, I have no more problem.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo