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.
Summary: | NullPointerException at org.netbeans.modules.csl.api.InstantRenameAction$1.run | ||
---|---|---|---|
Product: | editor | Reporter: | Sergey Petrov <sj-nb> |
Component: | CSL (API & infrastructure) | Assignee: | Milutin Kristofic <mkristofic> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dagguh, jhavlin, jrechtacek, pjiricka, sj-nb |
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 183156 |
Bug Depends on: | |||
Bug Blocks: | 219432 | ||
Attachments: |
stacktrace
stacktrace |
Description
Sergey Petrov
2012-10-04 12:29:47 UTC
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. 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 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 |