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 162771 - NPE from CompletionContextImpl.populateModelMap
Summary: NPE from CompletionContextImpl.populateModelMap
Status: RESOLVED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Nikita Krjukov
URL:
Keywords:
Depends on: 165747
Blocks:
  Show dependency tree
 
Reported: 2009-04-15 23:38 UTC by Jesse Glick
Modified: 2009-05-21 20:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-04-15 23:38:30 UTC
Thrown often, but not always, when getting schema-aware completion in an XML document.

java.lang.NullPointerException
        at
org.netbeans.modules.xml.schema.completion.util.CompletionContextImpl.populateModelMap(CompletionContextImpl.java:612)
[catch] at
org.netbeans.modules.xml.schema.completion.util.CompletionContextImpl.specialCompletion(CompletionContextImpl.java:637)
        at org.netbeans.modules.xml.schema.completion.util.CompletionContextImpl.initModels(CompletionContextImpl.java:606)
        at org.netbeans.modules.xml.schema.completion.CompletionQuery.getCompletionItems(CompletionQuery.java:103)
        at org.netbeans.modules.xml.schema.completion.CompletionQuery.query(CompletionQuery.java:87)
        at org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:218)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:573)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1005)
Comment 1 Jesse Glick 2009-04-15 23:39:12 UTC
#219811e28c4b will show this in the log, BTW.
Comment 2 Jesse Glick 2009-04-23 23:32:41 UTC
Schema completion seems to be broken more often than not.
Comment 3 Sergey Lunegov 2009-05-06 12:49:55 UTC
Nikita, please take a look.
Comment 4 Nikita Krjukov 2009-05-15 18:24:58 UTC
I eliminated all reasons of NPE http://hg.netbeans.org/main/rev/8367f0fc041d
According to sources the NPE could appear in case of absence of the schema root tag. 
It's the only idea for testing. 
Comment 5 Quality Engineering 2009-05-16 08:55:17 UTC
Integrated into 'main-golden', will be available in build *200905160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8367f0fc041d
User: supernikita@netbeans.org
Log: Fix the issue #162771 - NPE from CompletionContextImp.populateModelMap
Comment 6 Jesse Glick 2009-05-19 21:17:11 UTC
Nope, something similar still broken:

java.lang.NullPointerException
        at org.netbeans.modules.xml.schema.completion.util.CompletionUtil.populateItemsForAny(CompletionUtil.java:508)
        at org.netbeans.modules.xml.schema.completion.util.CompletionUtil.substituteAny(CompletionUtil.java:499)
        at org.netbeans.modules.xml.schema.completion.util.CompletionUtil.getElements(CompletionUtil.java:239)
        at org.netbeans.modules.xml.schema.completion.CompletionQuery.getCompletionItems(CompletionQuery.java:110)
        at org.netbeans.modules.xml.schema.completion.CompletionQuery.query(CompletionQuery.java:87)

Just try to get completion on some of the Jelly tags in e.g.

http://fisheye4.atlassian.com/browse/~raw,r=10807/hudson/trunk/hudson/plugins/active-directory/src/main/resources/hudson/plugins/active_directory/ActiveDirectorySecurityRealm/config.jelly

(The catalog installed by hudson.maven should offer schemas for the jelly:* namespaces.)

Validation (A-S-F9) works, at least after cdev #28ae937a7bd3 which fixes some bugs in schema handling (unrelated
swallowed NPEs). I'm not sure what you mean by "absence of schema root tag"; both the document and the schemas appear
well-formed and in fact valid.
Comment 7 Nikita Krjukov 2009-05-20 17:20:19 UTC
I think the last described NPE is similar only because it is also NPE. So it would be better to create a new issue. 
But I don't see serious reasons of appearing an NPE in the referenced line - CompletionUtil.java:508

    AXIModel am = AXIModelFactory.getDefault().getModel(cm.getSchemaModel);

The only real possibility to have NPE here is cm == null. But if it is null, then according to sources, an NPE has to
appear before. 

Anyway, I need some additional details. If it's easy to reproduce, then could you provide me with steps you managed to
get the NPE. 
Comment 8 Nikita Krjukov 2009-05-20 17:22:41 UTC
Maybe not only steps, but a project or full XML file with all required schema as well? 
Comment 9 Quality Engineering 2009-05-20 19:18:55 UTC
Integrated into 'main-golden', will be available in build *200905201401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/28ae937a7bd3
User: Jesse Glick <jglick@netbeans.org>
Log: UserXMLCatalog was often throwing NPEs when validating schema-based documents, and SharedXMLSupport was swallowing them.
Observed while trying to reproduce #162771: schema-based code completion throws (other) NPEs.
Comment 10 Jesse Glick 2009-05-21 20:52:01 UTC
.
Comment 11 Jesse Glick 2009-05-21 20:52:33 UTC
Restoring original resolution for fix of initially reported NPE.