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.
Build: NetBeans IDE Dev (Build 20120924-33dc4b5c0263) VM: Java HotSpot(TM) Client VM, 22.1-b02, Java(TM) SE Runtime Environment, 1.7.0_03-b05 OS: Windows 7 User Comments: GUEST: Executing SQL statement sj-nb: ctrl-r in SQL editor dagguh: I opened a shell script with PHP as a PHP file and tried to rename a variable Stacktrace: java.lang.NullPointerException at org.netbeans.modules.csl.api.InstantRenameAction$1.run(InstantRenameAction.java:128) at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:583) at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:150) at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:134) at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:200) at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:197)
Created attachment 125380 [details] stacktrace
it may have the same reason as issue 219432. the question is if csl api need to handle such cases or api users should do/implement something to avoid these exceptions
it may matter: sql editor was invoked for a connection on services tab.
http://hg.netbeans.org/jet-main/rev/8e1bf7c1bee4
Integrated into 'main-golden', will be available in build *201210050002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/8e1bf7c1bee4 User: Milutin Kristofic <mkristofic@netbeans.org> Log: #219520 - NullPointerException at org.netbeans.modules.csl.api.InstantRenameAction$1.run
Created attachment 125436 [details] stacktrace ctrl-r in jqpl editor
after 219432 fix I have the same exception (but on line 129 now) in both sql and jpql editors.
Ok, I was checking if resultIterator can be null. My next candidate is parserresult.
Sergey, does jpgl has parser? ResultIterator doesn't have its parser, therefore parserResult is empty and throws null. I can check null and do nothing, or you can give a parser to resultIterator and enable rename refactor.
cc jrechtacek@netbeans.org for sql editor. regarding jpql, I'm not sure I use api properly, it was design at some minimum level for this release, what do you mean by parser? Currently I have lexer skeleton with minimum functionality, also content is parsed by cc but it's entirely in jpql cc area. Regarding functionality itself, I don't refactor rename as really useful for jpql editor so far and likely in terms of parser which can be used in refactor rename there is no plan to support it at least in 7.3
Your JPQLLanguage in org.netbeans.modules.j2ee.persistence.jpqleditor.lexer extends DefaultLanguageConfig. DefaultLanguageConfig has method getParser() and it returns always null. Therefore when SourceCache in org.netbeans.modules.parsing.impl calls getParser() method [1] where it uses lookup for your jpql mimetype, the parseFactory create null parser. This nullparser creates null parserResult and throws nullpointer exception in InstantRenameAction. [1] Lookup lookup = MimeLookup.getLookup (mimeType); ParserFactory parserFactory = lookup.lookup (ParserFactory.class); if (parserFactory != null) { final Snapshot _snapshot = getSnapshot (); final Collection<Snapshot> _tmp = Collections.singleton (_snapshot); _parser = parserFactory.createParser (_tmp); } So you can override getParser() in JPQLLanguage and implement simple parser. Or I can check null value and throw warning.
It's nice if you can just check for null for now
http://hg.netbeans.org/jet-main/rev/5883ac8f78eb
Integrated into 'main-golden', will be available in build *201210120002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5883ac8f78eb User: Milutin Kristofic <mkristofic@netbeans.org> Log: #219520 - NullPointerException at org.netbeans.modules.csl.api.InstantRenameAction$1.run