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 7728

Summary: Exceptions during create from template-close
Product: java Reporter: Svata Dedic <sdedic>
Component: UnsupportedAssignee: issues@java <issues>
Status: CLOSED FIXED    
Severity: normal    
Priority: P4    
Version: 3.x   
Hardware: PC   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Svata Dedic 2000-09-20 14:58:42 UTC
A test that creates a Java source from a template, then closes and removes the
file suffers from the following exception:

Wed Sep 13 09:57:57 GMT+02:00 2000java.lang.NullPointerException: null
java.lang.NullPointerException
        at org.netbeans.modules.java.Util.getContent(Util.java:424)
        at
org.netbeans.modules.java.gj.V8EngineBase.openSourceBuffer(V8EngineBase.java:307)
        at
org.netbeans.modules.java.gj.ParserEngine.parseObject(ParserEngine.java:100)
        at
org.netbeans.modules.java.gj.JavaParserEngine.process(JavaParserEngine.java:71)
        at
org.netbeans.modules.java.V8ParseRequest.process(V8ParseRequest.java:294)
        at
org.netbeans.modules.java.SourceElementImpl$DataRef.run(SourceElementImpl.java:1276)
        at org.openide.util.Task.run(Task.java:124)
        at
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:562)
org.openide.util.RequestProcessor$Holder(task
org.netbeans.modules.java.SourceElementImpl$DataRef@76852d [-328, 2])
        at
org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:275)
        at org.openide.util.RequestProcessor.post(RequestProcessor.java:99)
        at
org.netbeans.modules.java.SourceElementImpl.parseObject(SourceElementImpl.java:713)
        at
org.netbeans.modules.java.SourceElementImpl.afterSaveParse(SourceElementImpl.java:654)
        at
org.netbeans.modules.java.JavaEditor.saveDocument(JavaEditor.java:382)
        at
org.netbeans.modules.java.JavaEditor.saveDocument(JavaEditor.java:361)
        at org.openide.text.EditorSupport$EntryEnv.save(EditorSupport.java:542)
        at
org.netbeans.modules.java.JavaDataObject.updateSource(JavaDataObject.java:415)
        at
org.netbeans.modules.java.JavaDataObject.updateSourceStart(JavaDataObject.java:369)
        at
org.netbeans.modules.java.JavaDataObject.handleCreateFromTemplate(JavaDataObject.java:496)
        at org.openide.loaders.DataObject$7.run(DataObject.java:642)
        at
org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:352)
        at
org.openide.loaders.DataObject.createFromTemplate(DataObject.java:640)
        at javam.Common.createClass(Common.java:297)
        at javam.SourceGenerator.SourceGenerator.run(SourceGenerator.java:65)
Comment 1 Svata Dedic 2000-09-20 15:04:59 UTC
There's a race condition between a test whether the document is loaded and
acquiring the document. If another thread closes the document in the meantime
(about 6 lines of code between the test and getDocument()), NPE is thrown.
Comment 2 Quality Engineering 2003-07-01 13:19:02 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.