Use java7 features
diff --git a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
index 6108d47..4894536 100644
--- a/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/AbstractWarMojo.java
@@ -271,7 +271,7 @@
* @since 2.1-alpha-1
*/
@Parameter
- private List<Overlay> overlays = new ArrayList<Overlay>();
+ private List<Overlay> overlays = new ArrayList<>();
/**
* A list of file extensions that should not be filtered. <b>Will be used when filtering webResources and
@@ -369,7 +369,7 @@
*/
protected String[] getExcludes()
{
- List<String> excludeList = new ArrayList<String>();
+ List<String> excludeList = new ArrayList<>();
if ( StringUtils.isNotEmpty( warSourceExcludes ) )
{
excludeList.addAll( Arrays.asList( StringUtils.split( warSourceExcludes, "," ) ) );
@@ -495,10 +495,10 @@
}
catch ( MavenFilteringException e )
{
- getLog().error( "fail to build filering wrappers " + e.getMessage() );
+ getLog().error( "fail to build filtering wrappers " + e.getMessage() );
throw new MojoExecutionException( e.getMessage(), e );
}
-
+
final WarPackagingContext context =
new DefaultWarPackagingContext( webapplicationDirectory, structure, overlayManager, defaultFilterWrappers,
getNonFilteredFileExtensions(), filteringDeploymentDescriptors,
@@ -510,7 +510,7 @@
{
warPackagingTask.performPackaging( context );
}
-
+
getLog().debug( "Webapp assembled in [" + ( System.currentTimeMillis() - startTime ) + " msecs]" );
}
@@ -568,7 +568,7 @@
private boolean filteringDeploymentDescriptors;
- private boolean useJvmChmod = true;
+ private boolean useJvmChmod;
private final Boolean failOnMissingWebXml;
@@ -611,22 +611,22 @@
}
this.useJvmChmod = useJvmChmod;
this.failOnMissingWebXml = failOnMissingWebXml;
-
+
if ( !webappDirectory.exists() )
{
- outdatedResources = Collections.emptyList();
+ outdatedResources = Collections.emptyList();
}
else if ( getWarSourceDirectory().toPath().equals( webappDirectory.toPath() ) )
{
- getLog().info( "Can't detect outdated resources when running inplace goal" );
- outdatedResources = Collections.emptyList();
+ getLog().info( "Can't detect outdated resources when running inplace goal" );
+ outdatedResources = Collections.emptyList();
}
- else
+ else
{
outdatedResources = new ArrayList<>();
try
{
- Files.walkFileTree( webappDirectory.toPath(), new SimpleFileVisitor<Path>()
+ Files.walkFileTree( webappDirectory.toPath(), new SimpleFileVisitor<Path>()
{
@Override
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs )
diff --git a/src/main/java/org/apache/maven/plugins/war/Overlay.java b/src/main/java/org/apache/maven/plugins/war/Overlay.java
index 43e3292..d0ef32a 100644
--- a/src/main/java/org/apache/maven/plugins/war/Overlay.java
+++ b/src/main/java/org/apache/maven/plugins/war/Overlay.java
@@ -372,7 +372,7 @@
private String[] parse( String s )
{
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
if ( s == null )
{
return result.toArray( new String[result.size()] );
diff --git a/src/main/java/org/apache/maven/plugins/war/WarMojo.java b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
index c7e7620..ecf4fd0 100644
--- a/src/main/java/org/apache/maven/plugins/war/WarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
@@ -183,22 +183,14 @@
{
performPackaging( warFile );
}
- catch ( DependencyResolutionRequiredException e )
+ catch ( DependencyResolutionRequiredException | ArchiverException e )
{
throw new MojoExecutionException( "Error assembling WAR: " + e.getMessage(), e );
}
- catch ( ManifestException e )
+ catch ( ManifestException | IOException e )
{
throw new MojoExecutionException( "Error assembling WAR", e );
}
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Error assembling WAR", e );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error assembling WAR: " + e.getMessage(), e );
- }
}
/**
diff --git a/src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java b/src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java
index c455dbe..d1cf6d0 100644
--- a/src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java
+++ b/src/main/java/org/apache/maven/plugins/war/overlay/OverlayManager.java
@@ -61,7 +61,7 @@
String[] defaultExcludes, Overlay currentProjectOverlay )
throws InvalidOverlayConfigurationException
{
- this.overlays = new ArrayList<Overlay>();
+ this.overlays = new ArrayList<>();
if ( overlays != null )
{
this.overlays.addAll( overlays );
@@ -92,7 +92,7 @@
*/
public List<String> getOverlayIds()
{
- final List<String> result = new ArrayList<String>();
+ final List<String> result = new ArrayList<>();
for ( Overlay overlay : overlays )
{
result.add( overlay.getId() );
@@ -115,7 +115,7 @@
// Build the list of configured artifacts and makes sure that each overlay
// refer to a valid artifact
- final List<Artifact> configuredWarArtifacts = new ArrayList<Artifact>();
+ final List<Artifact> configuredWarArtifacts = new ArrayList<>();
final ListIterator<Overlay> it = overlays.listIterator();
while ( it.hasNext() )
{
@@ -241,7 +241,7 @@
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
final Set<Artifact> artifacts = project.getArtifacts();
- final List<Artifact> result = new ArrayList<Artifact>();
+ final List<Artifact> result = new ArrayList<>();
for ( Artifact artifact : artifacts )
{
if ( !artifact.isOptional() && filter.include( artifact ) && ( "war".equals( artifact.getType() ) ) )
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/ArtifactsPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/ArtifactsPackagingTask.java
index aed17f4..f01ecc9 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/ArtifactsPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/ArtifactsPackagingTask.java
@@ -171,8 +171,8 @@
private List<String> findDuplicates( WarPackagingContext context, Set<Artifact> artifacts )
throws InterpolationException
{
- List<String> duplicates = new ArrayList<String>();
- List<String> identifiers = new ArrayList<String>();
+ List<String> duplicates = new ArrayList<>();
+ List<String> identifiers = new ArrayList<>();
for ( Artifact artifact : artifacts )
{
String candidate = getArtifactFinalName( context, artifact );
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/ClassesPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/ClassesPackagingTask.java
index 12aa782..e07cff6 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/ClassesPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/ClassesPackagingTask.java
@@ -90,7 +90,7 @@
/**
* @param context The warPackingContext.
- * @throws MojoExecutionException In casae of an error.
+ * @throws MojoExecutionException In case of an error.
*/
protected void generateJarArchive( WarPackagingContext context )
throws MojoExecutionException
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/WarPackagingContext.java b/src/main/java/org/apache/maven/plugins/war/packaging/WarPackagingContext.java
index e85cca5..9629e5a 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/WarPackagingContext.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/WarPackagingContext.java
@@ -70,9 +70,9 @@
String[] getWebappSourceIncludes();
/**
- * Returns {@code true} if empty directories should be includes, othewrwise {@code false}
+ * Returns {@code true} if empty directories should be includes, otherwise {@code false}
*
- * @return {@code true} if empty directories should be includes, othewrwise {@code false}
+ * @return {@code true} if empty directories should be includes, otherwise {@code false}
*/
boolean isWebappSourceIncludeEmptyDirectories();
diff --git a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
index a01e88b..64e37de 100644
--- a/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
+++ b/src/main/java/org/apache/maven/plugins/war/packaging/WarProjectPackagingTask.java
@@ -95,7 +95,7 @@
handleWebResources( context );
- handeWebAppSourceDirectory( context );
+ handleWebAppSourceDirectory( context );
// Debug mode: dump the path set for the current build
PathSet pathSet = context.getWebappStructure().getStructure( "currentBuild" );
@@ -166,7 +166,7 @@
* @param context the packaging context
* @throws MojoExecutionException if the sources could not be copied
*/
- protected void handeWebAppSourceDirectory( WarPackagingContext context )
+ protected void handleWebAppSourceDirectory( WarPackagingContext context )
throws MojoExecutionException
{
// CHECKSTYLE_OFF: LineLength
@@ -364,7 +364,7 @@
scanner.setBasedir( resource.getDirectory() );
if ( resource.getIncludes() != null && !resource.getIncludes().isEmpty() )
{
- scanner.setIncludes( (String[]) resource.getIncludes().toArray( new String[resource.getIncludes().size()] ) );
+ scanner.setIncludes( resource.getIncludes().toArray( new String[resource.getIncludes().size()] ) );
}
else
{
@@ -372,7 +372,7 @@
}
if ( resource.getExcludes() != null && !resource.getExcludes().isEmpty() )
{
- scanner.setExcludes( (String[]) resource.getExcludes().toArray( new String[resource.getExcludes().size()] ) );
+ scanner.setExcludes( resource.getExcludes().toArray( new String[resource.getExcludes().size()] ) );
}
scanner.addDefaultExcludes();
diff --git a/src/main/java/org/apache/maven/plugins/war/util/ClassesPackager.java b/src/main/java/org/apache/maven/plugins/war/util/ClassesPackager.java
index 3001674..e2008b1 100644
--- a/src/main/java/org/apache/maven/plugins/war/util/ClassesPackager.java
+++ b/src/main/java/org/apache/maven/plugins/war/util/ClassesPackager.java
@@ -74,19 +74,7 @@
archiver.getArchiver().addDirectory( classesDirectory );
archiver.createArchive( session, project, archiveConfiguration );
}
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Could not create classes archive", e );
- }
- catch ( ManifestException e )
- {
- throw new MojoExecutionException( "Could not create classes archive", e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Could not create classes archive", e );
- }
- catch ( DependencyResolutionRequiredException e )
+ catch ( ArchiverException | ManifestException | IOException | DependencyResolutionRequiredException e )
{
throw new MojoExecutionException( "Could not create classes archive", e );
}
diff --git a/src/main/java/org/apache/maven/plugins/war/util/DependencyInfo.java b/src/main/java/org/apache/maven/plugins/war/util/DependencyInfo.java
index 164487b..ff145e3 100644
--- a/src/main/java/org/apache/maven/plugins/war/util/DependencyInfo.java
+++ b/src/main/java/org/apache/maven/plugins/war/util/DependencyInfo.java
@@ -19,6 +19,8 @@
* under the License.
*/
+import java.util.Objects;
+
import org.apache.maven.model.Dependency;
/**
@@ -55,7 +57,7 @@
}
/**
- * Returns the target filen ame of the dependency. If no target file name is associated, returns <tt>null</tt>.
+ * Returns the target filename of the dependency. If no target file name is associated, returns <tt>null</tt>.
*
* @return the target file name or <tt>null</tt>
*/
@@ -90,12 +92,7 @@
DependencyInfo that = (DependencyInfo) o;
- if ( dependency != null ? !dependency.equals( that.dependency ) : that.dependency != null )
- {
- return false;
- }
-
- return true;
+ return Objects.equals( dependency, that.dependency );
}
/**
diff --git a/src/main/java/org/apache/maven/plugins/war/util/WebappStructure.java b/src/main/java/org/apache/maven/plugins/war/util/WebappStructure.java
index 34ded21..f5dc06c 100644
--- a/src/main/java/org/apache/maven/plugins/war/util/WebappStructure.java
+++ b/src/main/java/org/apache/maven/plugins/war/util/WebappStructure.java
@@ -56,7 +56,7 @@
public WebappStructure( List<Dependency> dependencies )
{
this.dependenciesInfo = createDependenciesInfoList( dependencies );
- this.registeredFiles = new HashMap<String, PathSet>();
+ this.registeredFiles = new HashMap<>();
}
/**
@@ -76,7 +76,7 @@
*/
public List<Dependency> getDependencies()
{
- final List<Dependency> result = new ArrayList<Dependency>();
+ final List<Dependency> result = new ArrayList<>();
if ( dependenciesInfo == null )
{
return result;
@@ -294,7 +294,7 @@
{
return Collections.emptyList();
}
- final List<DependencyInfo> result = new ArrayList<DependencyInfo>();
+ final List<DependencyInfo> result = new ArrayList<>();
for ( Dependency dependency : dependencies )
{
result.add( new DependencyInfo( dependency ) );
diff --git a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
index 0372511..994c470 100644
--- a/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/AbstractWarExplodedMojoTest.java
@@ -160,7 +160,7 @@
assertTrue( "source file not found: " + expectedWebSourceFile.toString(), expectedWebSourceFile.exists() );
assertTrue( "source file not found: " + expectedWebSource2File.toString(), expectedWebSource2File.exists() );
- final List<File> content = new ArrayList<File>();
+ final List<File> content = new ArrayList<>();
content.add( expectedWebSourceFile );
content.add( expectedWebSource2File );
@@ -178,7 +178,7 @@
File expectedWEBXMLFile = new File( webAppDirectory, "WEB-INF/web.xml" );
assertTrue( "web xml not found: " + expectedWEBXMLFile.toString(), expectedWEBXMLFile.exists() );
- final List<File> content = new ArrayList<File>();
+ final List<File> content = new ArrayList<>();
content.add( expectedWEBXMLFile );
return content;
@@ -194,7 +194,7 @@
*/
protected List<File> assertCustomContent( File webAppDirectory, String[] filePaths, String customMessage )
{
- final List<File> content = new ArrayList<File>();
+ final List<File> content = new ArrayList<>();
for ( String filePath : filePaths )
{
final File expectedFile = new File( webAppDirectory, filePath );
@@ -220,7 +220,7 @@
*/
protected void assertWebAppContent( File webAppDirectory, List<File> expectedFiles, FileFilter filter )
{
- final List<File> webAppContent = new ArrayList<File>();
+ final List<File> webAppContent = new ArrayList<>();
if ( filter != null )
{
buildFilesList( webAppDirectory, filter, webAppContent );
@@ -245,7 +245,7 @@
*
* @param dir the base directory
* @param filter the filter
- * @param content the current content, updated recursivly
+ * @param content the current content, updated recursively
*/
private void buildFilesList( final File dir, FileFilter filter, final List<File> content )
{
@@ -284,7 +284,7 @@
}
else
{
- this.rejectedFilePaths = new ArrayList<String>();
+ this.rejectedFilePaths = new ArrayList<>();
}
this.webAppDirIndex = webAppDirectory.getAbsolutePath().length() + 1;
}
diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
index e68563f..55e165f 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoFilteringTest.java
@@ -63,7 +63,7 @@
File webAppResource = new File( getTestDirectory(), testId + "-test-data/resources" );
File sampleResource = new File( webAppResource, "custom-setting.cfg" );
File sampleResourceWDir = new File( webAppResource, "custom-config/custom-setting.cfg" );
- List<String> filterList = new LinkedList<String>();
+ List<String> filterList = new LinkedList<>();
ResourceStub[] resources = new ResourceStub[] { new ResourceStub() };
createFile( sampleResource );
diff --git a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
index f6be401..22ff280 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarExplodedMojoTest.java
@@ -19,6 +19,8 @@
* under the License.
*/
+import static org.junit.Assert.assertNotEquals;
+
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.plugin.testing.stubs.ArtifactStub;
import org.apache.maven.plugins.war.stub.AarArtifactStub;
@@ -937,8 +939,8 @@
// 1st phase destination is older than source
// destination starts with a value of error replaced with a blank source
- assertFalse( "source files not updated with new copy: " + expectedWebSourceFile.toString(),
- "error".equals( FileUtils.fileRead( expectedWebSourceFile ) ) );
+ assertNotEquals( "source files not updated with new copy: " + expectedWebSourceFile.toString(),
+ "error", FileUtils.fileRead( expectedWebSourceFile ) );
// TODO: uncomment when lastModified problem is resolved
// FileWriter writer = new FileWriter(expectedWebSourceFile);
diff --git a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
index dac7474..dd6acae 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarMojoTest.java
@@ -27,12 +27,10 @@
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.war.WarMojo;
import org.apache.maven.plugins.war.stub.JarArtifactStub;
import org.apache.maven.plugins.war.stub.MavenProject4CopyConstructor;
import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub;
@@ -497,17 +495,17 @@
throws IOException
{
// Sanity check
- assertEquals( "Could not test, files and filesContent lenght does not match", files.length, filesContent.length );
+ assertEquals( "Could not test, files and filesContent length does not match", files.length, filesContent.length );
assertTrue( "war file not created: " + expectedJarFile.toString(), expectedJarFile.exists() );
- final Map<String, JarEntry> jarContent = new HashMap<String, JarEntry>();
+ final Map<String, JarEntry> jarContent = new HashMap<>();
final JarFile jarFile = new JarFile( expectedJarFile );
JarEntry entry;
Enumeration<JarEntry> enumeration = jarFile.entries();
while ( enumeration.hasMoreElements() )
{
- entry = (JarEntry) enumeration.nextElement();
+ entry = enumeration.nextElement();
Object previousValue = jarContent.put( entry.getName(), entry );
assertNull( "Duplicate Entry in Jar File: " + entry.getName(), previousValue );
}
@@ -520,7 +518,7 @@
if ( filesContent[i] != null )
{
assertEquals( "Content of file[" + file + "] does not match", filesContent[i],
- IOUtil.toString( jarFile.getInputStream( (ZipEntry) jarContent.get( file ) ) ) );
+ IOUtil.toString( jarFile.getInputStream( jarContent.get( file ) ) ) );
}
}
if ( mustNotBeInJar != null )
diff --git a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
index 791c3aa..4b249ec 100644
--- a/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/WarOverlaysTest.java
@@ -98,7 +98,7 @@
final ArtifactStub overlay = buildWarOverlayStub( "overlay-one" );
final File webAppDirectory = setUpMojo( testId, new ArtifactStub[] { overlay } );
- final List<File> assertedFiles = new ArrayList<File>();
+ final List<File> assertedFiles = new ArrayList<>();
try
{
mojo.execute();
@@ -132,7 +132,7 @@
final ArtifactStub overlay2 = buildWarOverlayStub( "overlay-two" );
final File webAppDirectory = setUpMojo( testId, new ArtifactStub[] { overlay, overlay2 } );
- final List<File> assertedFiles = new ArrayList<File>();
+ final List<File> assertedFiles = new ArrayList<>();
try
{
mojo.execute();
@@ -207,7 +207,7 @@
"org/sample/company/test.jsp", "jsp/b.jsp" } );
// Add the tags
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
overlays.add( new DefaultOverlay( overlay1 ) );
overlays.add( new DefaultOverlay( overlay2 ) );
overlays.add( new DefaultOverlay( overlay3 ) );
@@ -240,7 +240,7 @@
"org/sample/company/test.jsp", "jsp/b.jsp" } );
// Add the tags
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
// Add the default project explicitely
overlays.add( mojo.getCurrentProjectOverlay() );
@@ -265,7 +265,7 @@
private void assertScenariOne( String testId, File webAppDirectory )
throws Exception
{
- final List<File> assertedFiles = new ArrayList<File>();
+ final List<File> assertedFiles = new ArrayList<>();
try
{
mojo.execute();
@@ -337,7 +337,7 @@
mojo.addOverlay( mojo.getCurrentProjectOverlay() );
mojo.addOverlay( over4 );
- final List<File> assertedFiles = new ArrayList<File>();
+ final List<File> assertedFiles = new ArrayList<>();
try
{
mojo.execute();
@@ -407,7 +407,7 @@
mojo.addOverlay( mojo.getCurrentProjectOverlay() );
mojo.addOverlay( over4 );
- final List<File> assertedFiles = new ArrayList<File>();
+ final List<File> assertedFiles = new ArrayList<>();
try
{
mojo.execute();
diff --git a/src/test/java/org/apache/maven/plugins/war/overlay/OverlayManagerTest.java b/src/test/java/org/apache/maven/plugins/war/overlay/OverlayManagerTest.java
index a74af3d..c46f2e4 100644
--- a/src/test/java/org/apache/maven/plugins/war/overlay/OverlayManagerTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/overlay/OverlayManagerTest.java
@@ -24,9 +24,6 @@
import org.apache.maven.plugin.testing.stubs.ArtifactStub;
import org.apache.maven.plugins.war.Overlay;
-import org.apache.maven.plugins.war.overlay.DefaultOverlay;
-import org.apache.maven.plugins.war.overlay.InvalidOverlayConfigurationException;
-import org.apache.maven.plugins.war.overlay.OverlayManager;
import org.apache.maven.plugins.war.stub.MavenProjectArtifactsStub;
import org.apache.maven.plugins.war.stub.WarArtifactStub;
import org.codehaus.plexus.PlexusTestCase;
@@ -47,15 +44,15 @@
throws Exception
{
final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
try
{
- final Overlay currentProjectOVerlay = Overlay.createInstance();
+ final Overlay currentProjectOverlay = Overlay.createInstance();
OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
- currentProjectOVerlay );
+ currentProjectOverlay );
assertNotNull( manager.getOverlays() );
assertEquals( 1, manager.getOverlays().size() );
- assertEquals( currentProjectOVerlay, manager.getOverlays().get( 0 ) );
+ assertEquals( currentProjectOverlay, manager.getOverlays().get( 0 ) );
}
catch ( InvalidOverlayConfigurationException e )
{
@@ -72,7 +69,7 @@
final ArtifactStub first = newWarArtifact( "test", "test-webapp" );
project.addArtifact( first );
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
try
{
@@ -99,7 +96,7 @@
final ArtifactStub first = newWarArtifact( "test", "test-webapp" );
project.addArtifact( first );
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
overlays.add( new DefaultOverlay( first ) );
try
@@ -119,7 +116,7 @@
}
}
- public void testUnknonwnOverlay()
+ public void testUnknownOverlay()
throws Exception
{
@@ -127,13 +124,13 @@
final ArtifactStub first = newWarArtifact( "test", "test-webapp" );
project.addArtifact( first );
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
overlays.add( new Overlay( "test", "test-webapp-2" ) );
try
{
- final Overlay currentProjectOVerlay = Overlay.createInstance();
- new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOVerlay );
+ final Overlay currentProjectOverlay = Overlay.createInstance();
+ new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOverlay );
fail( "Should have failed to validate an unknown overlay" );
}
catch ( InvalidOverlayConfigurationException e )
@@ -152,7 +149,7 @@
project.addArtifact( first );
project.addArtifact( second );
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
overlays.add( new DefaultOverlay( first ) );
final Overlay currentProjectOverlay = Overlay.createInstance();
overlays.add( currentProjectOverlay );
@@ -186,7 +183,7 @@
project.addArtifact( first );
project.addArtifact( second );
- final List<Overlay> overlays = new ArrayList<Overlay>();
+ final List<Overlay> overlays = new ArrayList<>();
overlays.add( new DefaultOverlay( first ) );
overlays.add( new DefaultOverlay( second ) );
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java b/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java
index 3ac8f13..de6890e 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/AbstractArtifactStub.java
@@ -67,12 +67,10 @@
}
/*
- * TODO: Coppied from org/apache/maven/artifact/DefaultArtifact.java; Consider merging...
+ * TODO: Copied from org/apache/maven/artifact/DefaultArtifact.java; Consider merging...
*/
- public int compareTo( Artifact o )
+ public int compareTo( Artifact a )
{
- Artifact a = (Artifact) o;
-
/* -- We need to support groupId=null (it is missing in DefaultArtifact.java) */
int result;
if ( a.getGroupId() != null )
@@ -123,7 +121,7 @@
}
/*
- * TODO: Coppied from org/apache/maven/artifact/DefaultArtifact.java; Consider merging...
+ * TODO: Copied from org/apache/maven/artifact/DefaultArtifact.java; Consider merging...
*/
public boolean equals( Object o )
{
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
index e923a95..e9a58ab 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenProject4CopyConstructor.java
@@ -42,7 +42,7 @@
public List<Artifact> getAttachedArtifacts()
{
- return new LinkedList<Artifact>();
+ return new LinkedList<>();
}
// to prevent the MavenProject copy constructor from blowing up
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectArtifactsStub.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectArtifactsStub.java
index 4e10cd4..45f7855 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectArtifactsStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectArtifactsStub.java
@@ -36,7 +36,7 @@
public MavenProjectArtifactsStub()
throws Exception
{
- artifacts = new TreeSet<Artifact>();
+ artifacts = new TreeSet<>();
}
public void addArtifact( ArtifactStub stub )
@@ -53,9 +53,9 @@
{
if ( getArtifacts() == null )
{
- return new ArrayList<Dependency>();
+ return new ArrayList<>();
}
- final List<Dependency> dependencies = new ArrayList<Dependency>();
+ final List<Dependency> dependencies = new ArrayList<>();
for (Object o : getArtifacts()) {
Artifact a = (Artifact) o;
Dependency dependency = new Dependency();
@@ -74,7 +74,7 @@
public List<String> getRuntimeClasspathElements()
{
- List<String> artifacts = new ArrayList<String>();
+ List<String> artifacts = new ArrayList<>();
artifacts.add(
"src/test/resources/unit/manifest/manifest-with-classpath/sample-artifacts/maven-artifact1-1.0-SNAPSHOT.jar" );
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectBasicStub.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectBasicStub.java
index 020760e..7b2ac30 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectBasicStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenProjectBasicStub.java
@@ -48,7 +48,7 @@
public Set<Artifact> getArtifacts()
{
- return new HashSet<Artifact>();
+ return new HashSet<>();
}
public String getName()
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/MavenZipProject.java b/src/test/java/org/apache/maven/plugins/war/stub/MavenZipProject.java
index ef61db4..7a5b95d 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/MavenZipProject.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/MavenZipProject.java
@@ -38,7 +38,7 @@
throws Exception
{
super();
- this.artifacts = new HashSet<Artifact>();
+ this.artifacts = new HashSet<>();
}
public Set<Artifact> getArtifacts()
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/ModelStub.java b/src/test/java/org/apache/maven/plugins/war/stub/ModelStub.java
index 97dedc5..e15b8b2 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/ModelStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/ModelStub.java
@@ -90,11 +90,11 @@
public List<Profile> getProfiles()
{
- return new LinkedList<Profile>();
+ return new LinkedList<>();
}
public List<String> getModules()
{
- return new LinkedList<String>();
+ return new LinkedList<>();
}
}
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java b/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java
index 53c5fb3..dbe22b0 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/ResourceStub.java
@@ -36,12 +36,12 @@
public List<String> getIncludes()
{
- return new ArrayList<String>();
+ return new ArrayList<>();
}
public List<String> getExcludes()
{
- return new ArrayList<String>();
+ return new ArrayList<>();
}
public void setDirectory( String _directory )
diff --git a/src/test/java/org/apache/maven/plugins/war/stub/WarArtifact4CCStub.java b/src/test/java/org/apache/maven/plugins/war/stub/WarArtifact4CCStub.java
index ed54297..c2b05b2 100644
--- a/src/test/java/org/apache/maven/plugins/war/stub/WarArtifact4CCStub.java
+++ b/src/test/java/org/apache/maven/plugins/war/stub/WarArtifact4CCStub.java
@@ -25,7 +25,7 @@
/**
* stub for copy constructor
- * to preven the copy constructor frow blowing up
+ * to prevent the copy constructor from blowing up
*/
public class WarArtifact4CCStub
extends WarArtifactStub
diff --git a/src/test/java/org/apache/maven/plugins/war/util/PathSetTest.java b/src/test/java/org/apache/maven/plugins/war/util/PathSetTest.java
index 33f1011..2ccfc6b 100644
--- a/src/test/java/org/apache/maven/plugins/war/util/PathSetTest.java
+++ b/src/test/java/org/apache/maven/plugins/war/util/PathSetTest.java
@@ -139,7 +139,7 @@
*/
public void testPathsSetAddAlls()
{
- Set<String> s1set = new HashSet<String>();
+ Set<String> s1set = new HashSet<>();
s1set.add( "/a/b" );
s1set.add( "a/b/c" );
s1set.add( "a\\b/c" );