Bug 126673 - NPE in Buffer.addBufferChangedListener
Summary: NPE in Buffer.addBufferChangedListener
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-06 20:21 EST by Tim Hanson CLA
Modified: 2006-02-14 11:18 EST (History)
0 users

See Also:


Attachments
Proposed Patch (683 bytes, patch)
2006-02-06 20:36 EST, Tim Hanson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Hanson CLA 2006-02-06 20:21:14 EST
When running internal tests, we encountered the following intermittent stack trace:

     [java] java.lang.NullPointerException
     [java]     at org.eclipse.jdt.internal.core.Buffer.addBufferChangedListener(Buffer.java:62)
     [java]     at org.eclipse.jdt.internal.core.CompilationUnit.openBuffer(CompilationUnit.java:1023)
     [java]     at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:263)
     [java]     at org.eclipse.jdt.internal.core.CompilationUnit.getContents(CompilationUnit.java:581)
     [java]     at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:748)
     [java]     at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:588)
     [java]     at com.bea.wlw.common.core.ast.ReaderUtil.parse(ReaderUtil.java:74)
     [java]     at com.bea.wlw.netui.core.page.model.PageStructureBuilder.build(PageStructureBuilder.java:142)
     [java]     at com.bea.wlw.common.core.model.AbstractExternalEventAdapter$StructureBuilderJob.run(AbstractExternalEventAdapter.java:256)
     [java]     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)

It appears that there is one unsynchronized write to the field Buffer.changeListeners inside of the method Buffer.close()
Comment 1 Tim Hanson CLA 2006-02-06 20:36:54 EST
Created attachment 34253 [details]
Proposed Patch

This just synchronizes around the write to this.changeListeners in close()
Comment 2 Jerome Lanneluc CLA 2006-02-07 10:07:12 EST
Thanks for the patch, Tim. Released it in HEAD.
Comment 3 Frederic Fusier CLA 2006-02-14 11:18:28 EST
Code verified for 3.2 M5 using build I20060214-0010.