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 205026 - NPE in PositionRef.getPosition
Summary: NPE in PositionRef.getPosition
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 7.1
Hardware: All All
: P2 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 09:46 UTC by Vladimir Kvashin
Modified: 2011-11-17 07:31 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace (1.63 KB, text/plain)
2011-11-12 09:46 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2011-11-12 09:46:37 UTC
Created attachment 113143 [details]
stack trace

I don't know how to reproduce it in NetBeans itself, so far it happens in Oracle Solaris Studio.

Here is the top of the stack (see full stack in the attachment)

java.lang.NullPointerException: Invalid doc parameter. Document may not be null!
org.openide.text.NbDocument.checkDocParameter(NbDocument.java:462)
org.openide.text.NbDocument.createPosition(NbDocument.java:208)
org.openide.text.PositionRef$Manager$DocumentRenderer.run(PositionRef.java:976)
org.openide.text.PositionRef$Manager$DocumentRenderer.render(PositionRef.java:895)
org.openide.text.PositionRef$Manager$DocumentRenderer.renderToObject(PositionRef.java:913)
org.openide.text.PositionRef$Manager$Kind.toMemory(PositionRef.java:487)
org.openide.text.PositionRef.getPosition(PositionRef.java:155)
Comment 1 Vladimir Kvashin 2011-11-12 09:51:56 UTC
As I understand, the NPE is guaranteed as soon we reach PositionRef.java:894
with opCode == KIND_TO_MEMORY:
    DOCUMENT.set(mgr);
    this.run();
And in run we call
    NbDocument.createPosition(mgr.getDoc(), ...)
And getDoc() is guaranteed to return null
since DOCUMENT field contains mgr
Comment 2 Vladimir Kvashin 2011-11-12 09:58:48 UTC
It is 100% reproducible with Studio with Blacktie plugin, I can not share the code right here but can create a Studio w/plugin distribution and a demo project and send you a pointer.
Comment 3 Miloslav Metelka 2011-11-16 13:28:46 UTC
OK, it would be nice to have the build available today since tomorrow we are branching the trunk.
BTW could you please also check whether issue #21237 influences the problem or not? Thanks.
Comment 4 Miloslav Metelka 2011-11-16 18:16:10 UTC
The only thing that I've found potentially wrong is not holding the document reference inside PositionRef.getPosition(). Hopefully it was the cause of the NPE. If not please reopen the issue.
http://hg.netbeans.org/jet-main/rev/adfd6a18f9a1
Comment 5 Quality Engineering 2011-11-17 07:31:47 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/adfd6a18f9a1
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #205026 - NPE in PositionRef.getPosition().