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 - NbMavenProject doesn't mantain property change listeners in a thread safe way.
Summary: NbMavenProject doesn't mantain property change listeners in a thread safe way.
Status: RESOLVED INVALID
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.1
Hardware: PC Mac OS X
: P1 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-16 14:22 UTC by Denis Anisimov
Modified: 2015-11-16 15:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.