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.
Summary: | AssertionError: Node org.netbeans.modules.java.JavaNode[name=BeanC; displayName=BeanC.java][Name=BeanC, displayName=BeanC.java] returns null from getProperties() for one or more of its property sets | ||
---|---|---|---|
Product: | platform | Reporter: | ttokoly |
Component: | Nodes | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bolsover, exceptions_reporter, jlahoda |
Priority: | P2 | ||
Version: | 7.2 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | 189490 |
Attachments: |
stacktrace
Test case showing synchronization bug in Sheet.toArray. |
Description
ttokoly
2012-06-14 10:53:20 UTC
Created attachment 120830 [details]
stacktrace
Problem is in JavaNode, isn't it? I do not see the bug in JavaNode, JavaNode does not override getPropertySets, it only overrides createSheet, and I do not see how were we would be passing null PropertySet there (supporting evidence: there are at least two more node implementations noted in the exceptions, incorrectly duplicated to a java.source bug!). I do however see a synchronization bug in Sheet.toArray() itself (the array may be returned from the method *before* it is filled with data). I'll attach a test case that proves that. Created attachment 126680 [details]
Test case showing synchronization bug in Sheet.toArray.
*** Bug 218638 has been marked as a duplicate of this bug. *** ergonomics#804dabae07b6 - thanks for the test - it made me fix the issue differently than by enclosing the whole method into synchronized block. Integrated into 'main-golden', will be available in build *201210310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/ff87db51fd7c User: Jan Lahoda <jlahoda@netbeans.org> Log: #214193: the synchronization guarantees of Sheet.toArray are somewhat weak, and Nodes are responsible for not returning null in their property sets, trying to do that correctly for JavaNode. Integrated into 'main-golden', will be available in build *201211010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/804dabae07b6 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #214193: Synchronization problem in Sheet - avoid double checked locking (In reply to comment #6) > ergonomics#804dabae07b6 - thanks for the test - it made me fix the issue > differently than by enclosing the whole method into synchronized block. I think this is still incorrect - "sets" is an unsynchronized ArrayList, whose size can change between the invocation of .size() and .toArray() (or even during invocation of .toArray() as such, so cannot be easily fixed by calling toArray(empty-array), IMO). As a side note, I don't think that the use of infinite loop is necessary, "return array;" in the second synchronized block would IMO work in the same way. I don't think the criticism applies: arr can only get new fields while it is local. As soon as it becomes shared, it is effectively immutable. |