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 191072 - Unchecked NPE in org.netbeans.modules.xml.dtd.grammar.DTDParser.parse
Summary: Unchecked NPE in org.netbeans.modules.xml.dtd.grammar.DTDParser.parse
Status: RESOLVED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-18 08:44 UTC by emi
Modified: 2012-03-24 11:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch which fixes the issue (688 bytes, patch)
2010-11-01 09:35 UTC, emi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2010-10-18 08:44:19 UTC
DTDParser  starts with a null 'res' variable in parse(InputSource) and continues later on to check for this:

if (res != null) {
                parser.setEntityResolver(res);
}

At the end of the method though we get a possible NPE in the call:

        dtdGrammar.setResolvedEntities(res.getResolvedSystemIds());

More to the point, I got the following stacktrace since I had no default UserCatalog (on a custom configuration).


SEVERE: Error in RequestProcessor org.netbeans.spi.editor.completion.support.AsyncCompletionTask
java.lang.NullPointerException
        at org.netbeans.modules.xml.dtd.grammar.DTDParser.parse(DTDParser.java:139)
        at org.netbeans.modules.xml.dtd.grammar.DTDGrammarQueryProvider.getGrammar(DTDGrammarQueryProvider.java:74)
        at org.netbeans.modules.xml.api.model.GrammarQueryManager$DefaultQueryManager.getGrammar(GrammarQueryManager.java:151)
        at org.netbeans.modules.xml.text.completion.GrammarManager.loadGrammar(GrammarManager.java:316)
        at org.netbeans.modules.xml.text.completion.GrammarManager.getGrammar(GrammarManager.java:133)
        at org.netbeans.modules.xml.text.completion.XMLCompletionQuery.getPerformer(XMLCompletionQuery.java:297)
        at org.netbeans.modules.xml.text.completion.XMLCompletionQuery.queryElements(XMLCompletionQuery.java:309)
        at org.netbeans.modules.xml.text.completion.XMLCompletionQuery.query(XMLCompletionQuery.java:125)
        at org.netbeans.modules.xml.text.completion.XMLCompletionProvider$Query.query(XMLCompletionProvider.java:122)
        at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:223)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1960)
Comment 1 emi 2010-11-01 09:35:17 UTC
Created attachment 102737 [details]
Patch which fixes the issue
Comment 2 Svata Dedic 2012-03-23 13:17:13 UTC
Changeset: 508f49c5bced
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-03-23 14:17
Message:   Issue #191072 - Unchecked NPE in org.netbeans.modules.xml.dtd.grammar.DTDParser.parse: fixed
Check for null resolver
Comment 3 Svata Dedic 2012-03-23 13:17:53 UTC
Thanks for the report - and for the patch ! Sorry for the resolution took such a while.
Comment 4 Quality Engineering 2012-03-24 11:06:14 UTC
Integrated into 'main-golden', will be available in build *201203240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/508f49c5bced
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #191072 - Unchecked NPE in org.netbeans.modules.xml.dtd.grammar.DTDParser.parse: fixed
Check for null resolver