Author: khmarbaise
Date: Sun Aug 20 13:09:02 2017
New Revision: 1805556
URL: http://svn.apache.org/viewvc?rev=1805556&view=rev
Log:
[MSHARED-655] ArtifactInstaller check for integrity of parameters null, empty
collection, being a directory
o Followup refactored code.
Modified:
maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstaller.java
Modified:
maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstaller.java
URL:
http://svn.apache.org/viewvc/maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstaller.java?rev=1805556&r1=1805555&r2=1805556&view=diff
==============================================================================
---
maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstaller.java
(original)
+++
maven/shared/trunk/maven-artifact-transfer/src/main/java/org/apache/maven/shared/artifact/install/internal/DefaultArtifactInstaller.java
Sun Aug 20 13:09:02 2017
@@ -48,18 +48,7 @@ public class DefaultArtifactInstaller
public void install( ProjectBuildingRequest request, Collection<Artifact>
mavenArtifacts )
throws ArtifactInstallerException, IllegalArgumentException
{
- if ( request == null )
- {
- throw new IllegalArgumentException( "The parameter request is not
allowed to be null." );
- }
- if ( mavenArtifacts == null )
- {
- throw new IllegalArgumentException( "The parameter mavenArtifacts
is not allowed to be null." );
- }
- if ( mavenArtifacts.isEmpty() )
- {
- throw new IllegalArgumentException( "The collection mavenArtifacts
is not allowed to be empty." );
- }
+ validateParameters( request, mavenArtifacts );
try
{
@@ -79,10 +68,7 @@ public class DefaultArtifactInstaller
public void install( ProjectBuildingRequest request, File localRepositry,
Collection<Artifact> mavenArtifacts )
throws ArtifactInstallerException
{
- if ( request == null )
- {
- throw new IllegalArgumentException( "The parameter request is not
allowed to be null." );
- }
+ validateParameters( request, mavenArtifacts );
if ( localRepositry == null )
{
throw new IllegalArgumentException( "The parameter localRepository
is not allowed to be null." );
@@ -91,14 +77,6 @@ public class DefaultArtifactInstaller
{
throw new IllegalArgumentException( "The parameter localRepository
must be a directory." );
}
- if ( mavenArtifacts == null )
- {
- throw new IllegalArgumentException( "The parameter mavenArtifacts
is not allowed to be null." );
- }
- if ( mavenArtifacts.isEmpty() )
- {
- throw new IllegalArgumentException( "The collection mavenArtifacts
is not allowed to be empty." );
- }
try
{
@@ -114,6 +92,22 @@ public class DefaultArtifactInstaller
}
}
+ private void validateParameters( ProjectBuildingRequest request,
Collection<Artifact> mavenArtifacts )
+ {
+ if ( request == null )
+ {
+ throw new IllegalArgumentException( "The parameter request is not
allowed to be null." );
+ }
+ if ( mavenArtifacts == null )
+ {
+ throw new IllegalArgumentException( "The parameter mavenArtifacts
is not allowed to be null." );
+ }
+ if ( mavenArtifacts.isEmpty() )
+ {
+ throw new IllegalArgumentException( "The collection mavenArtifacts
is not allowed to be empty." );
+ }
+ }
+
/**
* @return true if the current Maven version is Maven 3.1.
*/