More Java 5
Reformatted
Using assert* instead of Assert.assert*


git-svn-id: https://svn.apache.org/repos/asf/maven/shared/trunk@1716893 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 3698ee0..bbafabd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,25 +1,27 @@
 <?xml version='1.0' encoding='UTF-8'?>
 
 <!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
 
   http://www.apache.org/licenses/LICENSE-2.0
 
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
 -->
 
-<project xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd' xmlns='http://maven.apache.org/POM/4.0.0'>
+<project xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'
+  xmlns='http://maven.apache.org/POM/4.0.0'>
+
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -138,7 +140,7 @@
             <exclude>src/test/resources/test*/**/*.txt</exclude>
           </excludes>
         </configuration>
-      </plugin>      
+      </plugin>
     </plugins>
   </build>
 </project>
diff --git a/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java b/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
index fb0c3c4..6282ec7 100644
--- a/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
+++ b/src/main/java/org/apache/maven/shared/model/fileset/util/FileSetManager.java
@@ -75,13 +75,13 @@
     {
         if ( verbose )
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO,
-                                                      new MojoLogSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_DEBUG, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         }
         else
         {
-            this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO,
-                                                      new MojoLogSink( log ) );
+            this.messages =
+                new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         }
 
         this.verbose = verbose;
@@ -94,8 +94,8 @@
      */
     public FileSetManager( Log log )
     {
-        this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO,
-                                                  new MojoLogSink( log ) );
+        this.messages =
+            new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new MojoLogSink( log ) );
         this.verbose = false;
     }
 
@@ -128,8 +128,8 @@
      */
     public FileSetManager( Logger log )
     {
-        this.messages = new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO,
-                                                  new PlexusLoggerSink( log ) );
+        this.messages =
+            new DefaultMessageHolder( MessageLevels.LEVEL_INFO, MessageLevels.LEVEL_INFO, new PlexusLoggerSink( log ) );
         this.verbose = false;
     }
 
@@ -146,17 +146,16 @@
     // ----------------------------------------------------------------------
 
     /**
-     *
      * @param fileSet
      * @return the included files as map
      * @throws MapperException if any
      * @see #getIncludedFiles(FileSet)
      */
-    public Map mapIncludedFiles( FileSet fileSet )
+    public Map<String, String> mapIncludedFiles( FileSet fileSet )
         throws MapperException
     {
         String[] sourcePaths = getIncludedFiles( fileSet );
-        Map mappedPaths = new LinkedHashMap();
+        Map<String, String> mappedPaths = new LinkedHashMap<String, String>();
 
         FileNameMapper fileMapper = MapperUtil.getFileNameMapper( fileSet.getMapper() );
 
@@ -183,8 +182,7 @@
     /**
      * Get all the filenames which have been included by the rules in this fileset.
      *
-     * @param fileSet
-     *            The fileset defining rules for inclusion/exclusion, and base directory.
+     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of matching filenames, relative to the basedir of the file-set.
      */
     public String[] getIncludedFiles( FileSet fileSet )
@@ -202,8 +200,7 @@
     /**
      * Get all the directory names which have been included by the rules in this fileset.
      *
-     * @param fileSet
-     *            The fileset defining rules for inclusion/exclusion, and base directory.
+     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of matching dirnames, relative to the basedir of the file-set.
      */
     public String[] getIncludedDirectories( FileSet fileSet )
@@ -221,8 +218,7 @@
     /**
      * Get all the filenames which have been excluded by the rules in this fileset.
      *
-     * @param fileSet
-     *            The fileset defining rules for inclusion/exclusion, and base directory.
+     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of non-matching filenames, relative to the basedir of the file-set.
      */
     public String[] getExcludedFiles( FileSet fileSet )
@@ -240,8 +236,7 @@
     /**
      * Get all the directory names which have been excluded by the rules in this fileset.
      *
-     * @param fileSet
-     *            The fileset defining rules for inclusion/exclusion, and base directory.
+     * @param fileSet The fileset defining rules for inclusion/exclusion, and base directory.
      * @return the array of non-matching dirnames, relative to the basedir of the file-set.
      */
     public String[] getExcludedDirectories( FileSet fileSet )
@@ -273,13 +268,13 @@
      *
      * @param fileSet The file-set matching rules, along with search base directory.
      * @param throwsError Throw IOException when errors have occurred by deleting files or directories.
-     * @throws IOException If a matching file cannot be deleted and <code>throwsError=true</code>, otherwise
-     * print warning messages.
+     * @throws IOException If a matching file cannot be deleted and <code>throwsError=true</code>, otherwise print
+     *             warning messages.
      */
     public void delete( FileSet fileSet, boolean throwsError )
         throws IOException
     {
-        Set deletablePaths = findDeletablePaths( fileSet );
+        Set<String> deletablePaths = findDeletablePaths( fileSet );
 
         if ( messages != null && messages.isDebugEnabled() )
         {
@@ -287,11 +282,11 @@
             messages.addDebugMessage( "Found deletable paths: " + paths ).flush();
         }
 
-        List warnMessages = new LinkedList();
+        List<String> warnMessages = new LinkedList<String>();
 
-        for ( Iterator it = deletablePaths.iterator(); it.hasNext(); )
+        for ( Iterator<String> it = deletablePaths.iterator(); it.hasNext(); )
         {
-            String path = (String) it.next();
+            String path = it.next();
 
             File file = new File( fileSet.getDirectory(), path );
 
@@ -305,7 +300,7 @@
                         {
                             messages.addInfoMessage( "Deleting directory: " + file ).flush();
                         }
-    
+
                         removeDir( file, fileSet.isFollowSymlinks(), throwsError, warnMessages );
                     }
                     else
@@ -314,7 +309,7 @@
                         {
                             messages.addInfoMessage( "Deleting symlink to directory: " + file ).flush();
                         }
-    
+
                         if ( !file.delete() )
                         {
                             String message = "Unable to delete symlink " + file.getAbsolutePath();
@@ -353,11 +348,9 @@
 
         if ( messages != null && messages.isWarningEnabled() && !throwsError && ( warnMessages.size() > 0 ) )
         {
-            for ( Iterator it = warnMessages.iterator(); it.hasNext(); )
+            for ( Iterator<String> it = warnMessages.iterator(); it.hasNext(); )
             {
-                String msg = (String) it.next();
-
-                messages.addWarningMessage( msg ).flush();
+                messages.addWarningMessage( it.next() ).flush();
             }
         }
     }
@@ -381,24 +374,22 @@
         }
         if ( messages != null && messages.isDebugEnabled() )
         {
-            messages.addDebugMessage(
-                                      "Checking for symlink:\nFile's canonical path: "
-                                          + fileInCanonicalParent.getCanonicalPath()
-                                          + "\nFile's absolute path with canonical parent: "
-                                          + fileInCanonicalParent.getPath() ).flush();
+            messages.addDebugMessage( "Checking for symlink:\nFile's canonical path: "
+                + fileInCanonicalParent.getCanonicalPath() + "\nFile's absolute path with canonical parent: "
+                + fileInCanonicalParent.getPath() ).flush();
         }
         return !fileInCanonicalParent.getCanonicalFile().equals( fileInCanonicalParent.getAbsoluteFile() );
     }
 
-    private Set findDeletablePaths( FileSet fileSet )
+    private Set<String> findDeletablePaths( FileSet fileSet )
     {
-        Set includes = findDeletableDirectories( fileSet );
+        Set<String> includes = findDeletableDirectories( fileSet );
         includes.addAll( findDeletableFiles( fileSet, includes ) );
 
         return includes;
     }
 
-    private Set findDeletableDirectories( FileSet fileSet )
+    private Set<String> findDeletableDirectories( FileSet fileSet )
     {
         if ( verbose && messages != null )
         {
@@ -409,7 +400,7 @@
 
         if ( scanner == null )
         {
-            return Collections.EMPTY_SET;
+            return Collections.<String>emptySet();
         }
 
         Set<String> includes = new HashSet<String>( Arrays.asList( scanner.getIncludedDirectories() ) );
@@ -421,7 +412,7 @@
             if ( verbose && messages != null )
             {
                 messages.addInfoMessage( "Adding symbolic link dirs which were previously excluded"
-                                             + " to the list being deleted." ).flush();
+                    + " to the list being deleted." ).flush();
             }
 
             // we need to see which entries were only excluded because they're symlinks...
@@ -442,7 +433,7 @@
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): "
-                                            + linksForDeletion ).flush();
+                    + linksForDeletion ).flush();
             }
 
             excludes.removeAll( includedDirsAndSymlinks );
@@ -479,7 +470,7 @@
             if ( verbose && messages != null )
             {
                 messages.addInfoMessage( "Adding symbolic link files which were previously excluded "
-                                             + "to the list being deleted." ).flush();
+                    + "to the list being deleted." ).flush();
             }
 
             // we need to see which entries were only excluded because they're symlinks...
@@ -500,7 +491,7 @@
             if ( messages != null && messages.isDebugEnabled() )
             {
                 messages.addDebugMessage( "Symlinks marked for deletion (originally mismarked): "
-                                            + linksForDeletion ).flush();
+                    + linksForDeletion ).flush();
             }
 
             excludes.removeAll( includedFilesAndSymlinks );
@@ -515,8 +506,7 @@
 
     /**
      * Removes all parent directories of the already excluded files/directories from the given set of deletable
-     * directories. I.e. if "subdir/excluded.txt" should not be deleted, "subdir" should be excluded from deletion,
-     * too.
+     * directories. I.e. if "subdir/excluded.txt" should not be deleted, "subdir" should be excluded from deletion, too.
      * 
      * @param excludedPaths The relative paths of the files/directories which are excluded from deletion, must not be
      *            <code>null</code>.
@@ -525,9 +515,9 @@
      */
     private void excludeParentDirectoriesOfExcludedPaths( List<String> excludedPaths, Set<String> deletablePaths )
     {
-        for ( Iterator it = excludedPaths.iterator(); it.hasNext(); )
+        for ( Iterator<String> it = excludedPaths.iterator(); it.hasNext(); )
         {
-            String path = (String) it.next();
+            String path = it.next();
 
             String parentPath = new File( path ).getParent();
 
@@ -576,7 +566,7 @@
      * @param warnMessages A list of warning messages used when <code>throwsError=false</code>.
      * @throws IOException If a matching file cannot be deleted and <code>throwsError=true</code>.
      */
-    private void removeDir( File dir, boolean followSymlinks, boolean throwsError, List warnMessages )
+    private void removeDir( File dir, boolean followSymlinks, boolean throwsError, List<String> warnMessages )
         throws IOException
     {
         String[] list = dir.list();
diff --git a/src/main/mdo/fileset.mdo b/src/main/mdo/fileset.mdo
index f506390..656d54d 100644
--- a/src/main/mdo/fileset.mdo
+++ b/src/main/mdo/fileset.mdo
@@ -153,7 +153,7 @@
     public String[] getIncludesArray()
     {
         String[] includesArry = null;
-        java.util.Collection includes = getIncludes();
+        java.util.List<String> includes = getIncludes();
         if ( includes != null && !includes.isEmpty() )
         {
             includesArry = (String[]) includes.toArray( new String[0] );
@@ -172,7 +172,7 @@
     public String[] getExcludesArray()
     {
         String[] excludesArry = null;
-        java.util.Collection excludes = getExcludes();
+        java.util.List<String> excludes = getExcludes();
         if ( excludes != null && !excludes.isEmpty() )
         {
             excludesArry = (String[]) excludes.toArray( new String[0] );
diff --git a/src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java b/src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java
index 6b61b78..abae5c6 100644
--- a/src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java
+++ b/src/test/java/org/apache/maven/shared/model/fileset/mappers/MapperUtilTest.java
@@ -53,7 +53,8 @@
     }
 
     @Test
-    public void getFileNameMapperShouldFileNameMapperType() throws MapperException
+    public void getFileNameMapperShouldFileNameMapperType()
+        throws MapperException
     {
         // check with FileNameMapper type
         Mapper mapper = new Mapper();
@@ -66,7 +67,7 @@
     }
 
     @Test
-    public void testGetFileNameMapper()
+    public void testGetFileNameMapper() throws MapperException
     {
         Mapper mapper = null;
         try
@@ -94,15 +95,9 @@
         mapper.setType( "glob" );
         mapper.setFrom( "*.java" );
         mapper.setTo( "*.class" );
-        try
-        {
-            FileNameMapper fileNameMapper = MapperUtil.getFileNameMapper( mapper );
-            assertNotNull( fileNameMapper );
-            assertEquals( "/var/SomeClasses.class", fileNameMapper.mapFileName( "/var/SomeClasses.java" ) );
-        }
-        catch ( MapperException e )
-        {
-            fail( "Unexpected exception " + e );
-        }
+
+        FileNameMapper fileNameMapper = MapperUtil.getFileNameMapper( mapper );
+        assertNotNull( fileNameMapper );
+        assertEquals( "/var/SomeClasses.class", fileNameMapper.mapFileName( "/var/SomeClasses.java" ) );
     }
 }
diff --git a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
index a9a5043..cdcf3b2 100644
--- a/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
+++ b/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
@@ -32,7 +32,6 @@
 import org.apache.maven.shared.utils.cli.Commandline;
 import org.apache.maven.shared.utils.io.FileUtils;
 
-import junit.framework.Assert;
 import junit.framework.TestCase;
 
 /**
@@ -82,7 +81,7 @@
 
         String[] included = fileSetManager.getIncludedFiles( set );
 
-        Assert.assertEquals( 1, included.length );
+        assertEquals( 1, included.length );
     }
 
     /**
@@ -112,7 +111,7 @@
 
         String[] included = fileSetManager.getIncludedFiles( set );
 
-        Assert.assertEquals( 1, included.length );
+        assertEquals( 1, included.length );
     }
 
     /**
@@ -143,7 +142,7 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertFalse( subdir.exists() );
+        assertFalse( subdir.exists() );
     }
 
     /**
@@ -164,7 +163,7 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertFalse( "file in marked subdirectory still exists.", subdirFile.exists() );
+        assertFalse( "file in marked subdirectory still exists.", subdirFile.exists() );
     }
 
     /**
@@ -192,7 +191,7 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertFalse( "directory still exists", directory.exists() );
+        assertFalse( "directory still exists", directory.exists() );
     }
 
     /**
@@ -212,7 +211,7 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
+        assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
     }
 
     /**
@@ -232,7 +231,7 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
+        assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
     }
 
     /**
@@ -252,9 +251,9 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
-        Assert.assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
-        Assert.assertFalse( "included file has not been deleted", new File( directory, "included.txt" ).exists() );
+        assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
+        assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
+        assertFalse( "included file has not been deleted", new File( directory, "included.txt" ).exists() );
     }
 
     /**
@@ -274,9 +273,9 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
-        Assert.assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
-        Assert.assertFalse( "included file has not been deleted", new File( directory, "included.txt" ).exists() );
+        assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
+        assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
+        assertFalse( "included file has not been deleted", new File( directory, "included.txt" ).exists() );
     }
 
     /**
@@ -301,12 +300,12 @@
 
         fileSetManager.delete( set );
 
-        Assert.assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
-        Assert.assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
-        Assert.assertFalse( "included dirlink has not been deleted", new File( directory, "dirlink" ).exists() );
-        Assert.assertFalse( "included filelink has not been deleted", new File( directory, "filelink" ).exists() );
-        Assert.assertFalse( "included directory has not been deleted", new File( directory, "dir0" ).exists() );
-        Assert.assertFalse( "included directory has not been deleted", new File( directory, "dir1" ).exists() );
+        assertTrue( "excluded file has been deleted", new File( directory, "excluded.txt" ).exists() );
+        assertTrue( "excluded directory has been deleted", new File( directory, "excluded" ).exists() );
+        assertFalse( "included dirlink has not been deleted", new File( directory, "dirlink" ).exists() );
+        assertFalse( "included filelink has not been deleted", new File( directory, "filelink" ).exists() );
+        assertFalse( "included directory has not been deleted", new File( directory, "dir0" ).exists() );
+        assertFalse( "included directory has not been deleted", new File( directory, "dir1" ).exists() );
     }
 
     /**
@@ -349,7 +348,7 @@
 
         if ( sourceResource == null )
         {
-            Assert.fail( "Source directory for test: " + directoryName + " cannot be found." );
+            fail( "Source directory for test: " + directoryName + " cannot be found." );
         }
 
         File sourceDir = new File( URLDecoder.decode( sourceResource.getPath(), "UTF-8" ) );