Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import java.io.File;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -79,7 +81,7 @@ public class MavenSession
new ConcurrentHashMap<>();


public void setProjects( List<MavenProject> projects )
public synchronized void setProjects( List<MavenProject> projects )
{
if ( !projects.isEmpty() )
{
Expand Down Expand Up @@ -239,14 +241,41 @@ public MavenSession clone()
{
try
{
return (MavenSession) super.clone();
MavenSession thisClone = (MavenSession) super.clone();
thisClone.setProjects( getProjectsClone() );

return thisClone;
}
catch ( CloneNotSupportedException e )
{
throw new RuntimeException( "Bug", e );
}
}

private synchronized List<MavenProject> getProjectsClone()
{
if ( projects == null )
{
return null;
}
else
{
if ( projects.isEmpty() )
{
return Collections.emptyList();
}
else
{
List<MavenProject> clonedProjects = new ArrayList<>( projects.size() );
for ( MavenProject project : projects )
{
clonedProjects.add( project.clone() );
}
return clonedProjects;
}
}
}

public Date getStartTime()
{
return request.getStartTime();
Expand Down Expand Up @@ -302,7 +331,7 @@ public Map<String, MavenProject> getProjectMap()
{
return projectMap;
}

@Deprecated
public MavenSession( PlexusContainer container, RepositorySystemSession repositorySession,
MavenExecutionRequest request, MavenExecutionResult result )
Expand Down