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 256624

Summary: NbMavenProject doesn't mantain property change listeners in a thread safe way.
Product: projects Reporter: Denis Anisimov <ads>
Component: MavenAssignee: Tomas Stupka <tstupka>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P1    
Version: 8.1   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description Denis Anisimov 2015-11-16 14:22:35 UTC
org.netbeans.modules.maven.api.NbMavenProject uses java.beans.PropertyChangeSupport to maintain listeners (add/remove/fire events):

{{{

public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
        support.addPropertyChangeListener(propertyChangeListener);
    }
    
    public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
        support.removePropertyChangeListener(propertyChangeListener);
    }

}}}

But it's not synchronized anymore since Java 7.

As a result listeners work incorrectly since there is no protection from race condition. 

We have a bug which is caused most likely by this issue :

https://dev.vaadin.com/ticket/19254
Comment 1 Denis Anisimov 2015-11-16 15:14:56 UTC
Sorry, my bad: PropertyChangeSupport should be thread safe still, although they have removed synchronized methods. Now it uses internal synchronized map.