Fixed safe publication issue in DefaultArtifact, re-changed CopyOnWriteArraySet to unmodifiableSet

Verified the existence of unsafe publication regarding file and resolved attributes in DefaultArtifact.


Revised earlier change to strengthen intended focus on immutability of HashSet 

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@908650 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kristian Rosenvold 2010-02-10 19:52:07 +00:00
parent 92a7283378
commit a1438752da
2 changed files with 5 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public class DefaultArtifact
private String scope;
private File file;
private volatile File file;
private ArtifactRepository repository;
@ -71,7 +71,7 @@ public class DefaultArtifact
private VersionRange versionRange;
private boolean resolved;
private volatile boolean resolved;
private boolean release;

View File

@ -20,6 +20,7 @@ package org.apache.maven;
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
@ -50,7 +51,7 @@ public class DefaultArtifactFilterManager
static
{
List<String> artifacts = new ArrayList<String>();
Set<String> artifacts = new HashSet<String>();
artifacts.add( "classworlds" );
artifacts.add( "plexus-classworlds" );
@ -87,7 +88,7 @@ public class DefaultArtifactFilterManager
* wagon from their plugin realm.
*/
DEFAULT_EXCLUSIONS = new CopyOnWriteArraySet<String>( artifacts);
DEFAULT_EXCLUSIONS = Collections.unmodifiableSet( artifacts);
}
protected Set<String> excludedArtifacts = new HashSet<String>( DEFAULT_EXCLUSIONS );