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 233164 - NullPointerException at org.netbeans.modules.css.refactoring.CssActionsImplementationProvider$TextComponentTask.run
Summary: NullPointerException at org.netbeans.modules.css.refactoring.CssActionsImplem...
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: CSS Editor (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-22 11:00 UTC by Marek Fukala
Modified: 2013-07-25 02:30 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 202227


Attachments
stacktrace (4.51 KB, text/plain)
2013-07-22 11:00 UTC, Marek Fukala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Fukala 2013-07-22 11:00:57 UTC
Build: NetBeans IDE Dev (Build 20130716-aa12654ceedd)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.6-b04, Java(TM) SE Runtime Environment, 1.7.0_10-b31
OS: Mac OS X

User Comments:
mfukala: just tried to find usages on a class or id selector in plain css code

pmaselkowski: Right clicked on css class definition (on selector name) in css file and then selected "Find usages"




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.css.refactoring.CssActionsImplementationProvider$TextComponentTask.run(CssActionsImplementationProvider.java:343)
   at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:593)
   at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:155)
   at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:139)
   at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:206)
   at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:203)
Comment 1 Marek Fukala 2013-07-22 11:00:59 UTC
Created attachment 137545 [details]
stacktrace
Comment 2 Marek Fukala 2013-07-22 12:28:11 UTC
The css file remained in some weird state of being half way initialized (no semantic coloring for example, but CC, navigator worked I think) and I was able to reproduce the issue until I modified the file. Then it started working properly.
Comment 3 Marek Fukala 2013-07-22 13:50:39 UTC
Another issue where ResultIterator obtained for css file returns null parser result. An invalidated CssParser instance seems to be reused by a new parsing task created by ParserManager.parse(Collections.singleton(source), ...);

Seems to quite easily reproducible by starting the IDE, opening any css file and choosing "Find Usages" on any of the selectors in the file. Until the file is modified the problem remains.

Passing to Tomas instead of duplicating as I'm not 100% sure this is the same problem as in issue 232789  and 233133
Comment 4 Tomas Zezula 2013-07-23 14:58:42 UTC
The problem is in CssParser, fixed jet-main a5ad1336c0c2

1st) The cancel has to check event.sourceChanged()
2nd) the cancel is written by other thread than it's accessed.
Comment 5 Marek Fukala 2013-07-23 19:42:49 UTC
(In reply to comment #4)
> The problem is in CssParser, fixed jet-main a5ad1336c0c2
> 
> 1st) The cancel has to check event.sourceChanged()
> 2nd) the cancel is written by other thread than it's accessed.

Thank you very much Tome! 

As for the SourceModificationEvent.sourceChanged() -- it's bit unintuitive and not much javadoc there.  I'd assume that when I get such event the source was really modified. So does it mean that such change event can be obtained when "active" editor is changed?
Comment 6 Quality Engineering 2013-07-25 02:30:15 UTC
Integrated into 'main-silver', will be available in build *201307242300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/a5ad1336c0c2
User: Tomas Zezula <tzezula@netbeans.org>
Log: #233164:NullPointerException at org.netbeans.modules.css.refactoring.CssActionsImplementationProvider$TextComponentTask.run