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 181156 - [68cat] NullPointerException at org.netbeans.module.copyfqn.actions.CopyFQNAction$1.run
Summary: [68cat] NullPointerException at org.netbeans.module.copyfqn.actions.CopyFQNAc...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on: 179368
Blocks:
  Show dependency tree
 
Reported: 2010-02-24 09:37 UTC by Michel Graciano
Modified: 2010-03-04 03:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 165663


Attachments
stacktrace (3.57 KB, text/plain)
2010-02-24 09:37 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Graciano 2010-02-24 09:37:10 UTC
Build: NetBeans IDE Dev (Build 100224-bf5861cd660c)
VM: Java HotSpot(TM) Client VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b07
OS: Linux

Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.module.copyfqn.actions.CopyFQNAction$1.run(CopyFQNAction.java:127)
   at org.netbeans.module.copyfqn.actions.CopyFQNAction$1.run(CopyFQNAction.java:115)
   at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:474)
   at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:151)
   at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:135)
   at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:190)
Comment 1 Michel Graciano 2010-02-24 09:37:14 UTC
Created attachment 94491 [details]
stacktrace
Comment 2 Michel Graciano 2010-02-24 09:43:01 UTC
It happens if we use EditorRegistry.focusedComponent()/Registry.getMostActiveDocument() instead EditorRegistry.lastFocusedComponent(). Looks like this is an regression of issue #179368. BTW, the CopyFQN module was already fixed.
To reproduce it, just change the o.n.m.copyfqn.actions.CopyFQNAction:126 and follow these step:
1-Run the changed plugin;
2-Open any java class file;
3-Select any element, an class for example;
4-Go to Edit > Copy FQN and the exception is thrown.

If you use the shortcut instead (Ctrl+J Ctrl+C) everything works fine, what I understand is that the editor hos no longer the focus when the action is invoked by menu item.
Comment 3 Vitezslav Stejskal 2010-02-24 10:49:18 UTC
(In reply to comment #2)
> It happens if we use
> EditorRegistry.focusedComponent()/Registry.getMostActiveDocument() instead
> EditorRegistry.lastFocusedComponent(). Looks like this is an regression of
> issue #179368.

In this particular case using ER.lastFC() is the right thing to do. I'll look at the changes done for issue #179368 and see if other places need fixing too. But in general R.getMAD() may have returned null and so any code calling it should have been prepared to handle nulls.


> BTW, the CopyFQN module was already fixed.

So, this is no longer a problem for CopyFQN, right? No one else has complained yet, so I guess the regression is not that bad. Nevertheless I'm going to doublecheck what the changes.
Comment 4 Michel Graciano 2010-02-24 11:11:12 UTC
Yes, CopyFQN is already fixed and is no longer a problem. My compain is just about any regression in another places. Thanks for your help.