Cleanup code using java 7 features
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
index 42bef47..cbc1562 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
@@ -392,7 +392,7 @@
     /**

      * Split {@link #fixTags} by comma.

      *

-     * @see {@link #init()}

+     * @see #init()

      */

     private String[] fixTagsSplitted;

 

@@ -1145,10 +1145,8 @@
      * @param stringWriter    not null

      * @param originalContent not null

      * @param entity          not null

-     * @param changeDetected

-     * @return the updated changeDetected flag

      * @throws IOException if any

-     * @see #extractOriginalJavadoc(String, AbstractJavaEntity)

+     * @see #extractOriginalJavadoc

      */

     private void takeCareSingleComment( final StringWriter stringWriter, final String originalContent,

                                         final JavaAnnotatedElement entity )

@@ -1262,9 +1260,9 @@
      * <font color="#000000">DummyClass&nbsp;</font><font color="#000000">{}</font></code>

      * </code>

      *

-     * @param buffer    not null

-     * @param javaClass not null

-     * @param indent    not null

+     * @param stringWriter not null

+     * @param javaClass    not null

+     * @param indent       not null

      * @see #getDefaultClassJavadocComment(JavaClass)

      * @see #appendDefaultAuthorTag(StringBuilder, String)

      * @see #appendDefaultSinceTag(StringBuilder, String)

@@ -1417,7 +1415,7 @@
                 }

                 else

                 {

-                    sb.append( value.toString().substring( 0, 39 ) ).append( "\"{trunked}" );

+                    sb.append( value.toString(), 0, 39 ).append( "\"{trunked}" );

                 }

                 // CHECKSTYLE_ON: MagicNumber

             }

@@ -1496,11 +1494,11 @@
      * <font color="#000000">){}</font>

      * </code>

      *

-     * @param buffer     not null

+     * @param stringWriter   not null

      * @param javaExecutable not null

-     * @param indent     not null

+     * @param indent         not null

      * @throws MojoExecutionException if any

-     * @see #getDefaultMethodJavadocComment(JavaMethod)

+     * @see #getDefaultMethodJavadocComment

      * @see #appendDefaultSinceTag(StringBuilder, String)

      */

     private void addDefaultMethodComment( final StringWriter stringWriter, final JavaExecutable javaExecutable,

@@ -1576,7 +1574,6 @@
      * @param originalContent not null

      * @param entity          not null

      * @param indent          not null

-     * @param changeDetected

      * @return the updated changeDetected flag

      * @throws MojoExecutionException if any

      * @throws IOException            if any

@@ -1805,7 +1802,7 @@
         while ( linktagMatcher.find() )

         {

             int startName = linktagMatcher.end();

-            resolvedComment.append( comment.substring( startIndex, startName ) );

+            resolvedComment.append( comment, startIndex, startName );

             int endName = comment.indexOf( "}", startName );

             if ( endName >= 0 )

             {

@@ -1949,21 +1946,19 @@
                 }

 

                 String paramName = params.get( 0 );

-                if ( docletTag.getName().equals( PARAM_TAG ) )

-                {

-                    javaEntityTags.putJavadocParamTag( paramName, originalJavadocTag );

-                }

-                else if ( docletTag.getName().equals( RETURN_TAG ) )

-                {

-                    javaEntityTags.setJavadocReturnTag( originalJavadocTag );

-                }

-                else if ( docletTag.getName().equals( THROWS_TAG ) )

-                {

-                    javaEntityTags.putJavadocThrowsTag( paramName, originalJavadocTag );

-                }

-                else

-                {

-                    javaEntityTags.getUnknownTags().add( originalJavadocTag );

+                switch ( docletTag.getName() ) {

+                    case PARAM_TAG:

+                        javaEntityTags.putJavadocParamTag( paramName, originalJavadocTag );

+                        break;

+                    case RETURN_TAG:

+                        javaEntityTags.setJavadocReturnTag( originalJavadocTag );

+                        break;

+                    case THROWS_TAG:

+                        javaEntityTags.putJavadocThrowsTag( paramName, originalJavadocTag );

+                        break;

+                    default:

+                        javaEntityTags.getUnknownTags().add( originalJavadocTag );

+                        break;

                 }

             }

             else

@@ -2789,7 +2784,7 @@
      * @param javaMethod the QDox JavaMethod object not null

      * @return <code>true</code> if <code>javaMethod</code> exists in the given <code>clazz</code>,

      *         <code>false</code> otherwise.

-     * @see #isInherited(JavaMethod)

+     * @see #isInherited(JavaExecutable)

      */

     private boolean isInherited( Class<?> clazz, JavaExecutable javaMethod )

     {

@@ -2945,8 +2940,8 @@
      * @param className not null

      * @return the Class corresponding to the given class name using the project classloader.

      * @throws MojoExecutionException if class not found

-     * @see {@link ClassUtils#getClass(ClassLoader, String, boolean)}

-     * @see {@link #getProjectClassLoader()}

+     * @see ClassUtils#getClass(ClassLoader, String, boolean)

+     * @see #getProjectClassLoader()

      */

     private Class<?> getClass( String className )

         throws MojoExecutionException

@@ -3036,18 +3031,8 @@
     private static void writeFile( final File javaFile, final String encoding, final String content )

         throws IOException

     {

-        Writer writer = null;

-        try

-        {

-            writer = WriterFactory.newWriter( javaFile, encoding );

-            writer.write( StringUtils.unifyLineSeparators( content ) );

-            writer.close();

-            writer = null;

-        }

-        finally

-        {

-            IOUtil.close( writer );

-        }

+        String unified = StringUtils.unifyLineSeparators( content );

+        FileUtils.fileWrite( javaFile, encoding, unified );

     }

 

     /**

@@ -3625,7 +3610,7 @@
         }

 

         String textTrimmed = text.trim();

-        return text.substring( text.indexOf( textTrimmed ), text.length() );

+        return text.substring( text.indexOf( textTrimmed ) );

     }

 

     /**

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index b4da580..0dc5ca8 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -1920,11 +1920,9 @@
 

     protected final void verifyRemovedParameter( String paramName )

     {

-        Object pluginConfiguration = mojo.getConfiguration();

-        if ( pluginConfiguration instanceof Xpp3Dom )

+        Xpp3Dom configDom = mojo.getConfiguration();

+        if (configDom != null)

         {

-            Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;

-

             if ( configDom.getChild( paramName ) != null )

             {

                 throw new IllegalArgumentException( "parameter '" + paramName

@@ -1935,11 +1933,9 @@
 

     private void verifyReplacedParameter( String oldParamName, String newParamNew )

     {

-        Object pluginConfiguration = mojo.getConfiguration();

-        if ( pluginConfiguration instanceof Xpp3Dom )

+        Xpp3Dom configDom = mojo.getConfiguration();

+        if (configDom != null)

         {

-            Xpp3Dom configDom = (Xpp3Dom) pluginConfiguration;

-

             if ( configDom.getChild( oldParamName ) != null )

             {

                 throw new IllegalArgumentException( "parameter '" + oldParamName

@@ -2395,12 +2391,7 @@
         {

             return resourceResolver.resolveDependencySourcePaths( config );

         }

-        catch ( final ArtifactResolutionException e )

-        {

-            throw new MavenReportException(

-                "Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e );

-        }

-        catch ( final ArtifactNotFoundException e )

+        catch ( final ArtifactResolutionException | ArtifactNotFoundException e )

         {

             throw new MavenReportException(

                 "Failed to resolve one or more javadoc source/resource artifacts:\n\n" + e.getMessage(), e );

@@ -2480,7 +2471,7 @@
             String[] excludedPackages = getExcludedPackages();

             String[] subpackagesList = subpackages.split( "[:]" );

 

-            excludedNames = JavadocUtil.getExcludedNames( sourcePaths, subpackagesList, excludedPackages );

+            excludedNames = JavadocUtil.getExcludedNames( sourcePaths, excludedPackages );

         }

 

         String excludeArg = "";

@@ -2740,23 +2731,7 @@
                     tc = tcs.get( 0 );

                 }

             }

-            catch ( NoSuchMethodException e )

-            {

-                // ignore

-            }

-            catch ( SecurityException e )

-            {

-                // ignore

-            }

-            catch ( IllegalAccessException e )

-            {

-                // ignore

-            }

-            catch ( IllegalArgumentException e )

-            {

-                // ignore

-            }

-            catch ( InvocationTargetException e )

+            catch ( SecurityException | ReflectiveOperationException e )

             {

                 // ignore

             }

@@ -3743,25 +3718,7 @@
         {

             jVersion = JavadocUtil.getJavadocVersion( jExecutable );

         }

-        catch ( IOException e )

-        {

-            if ( getLog().isWarnEnabled() )

-            {

-                getLog().warn( "Unable to find the javadoc version: " + e.getMessage() );

-                getLog().warn( "Using the Java version instead of, i.e. " + JAVA_VERSION );

-            }

-            jVersion = JAVA_VERSION;

-        }

-        catch ( CommandLineException e )

-        {

-            if ( getLog().isWarnEnabled() )

-            {

-                getLog().warn( "Unable to find the javadoc version: " + e.getMessage() );

-                getLog().warn( "Using the Java version instead of, i.e. " + JAVA_VERSION );

-            }

-            jVersion = JAVA_VERSION;

-        }

-        catch ( IllegalArgumentException e )

+        catch ( IOException | CommandLineException | IllegalArgumentException e )

         {

             if ( getLog().isWarnEnabled() )

             {

@@ -3829,8 +3786,8 @@
      * @param b                   the flag which controls if the argument is added or not.

      * @param value               the argument value to be added.

      * @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f

-     * @see #addArgIf(java.util.List, boolean, String)

-     * @see #isJavaDocVersionAtLeast(float)

+     * @see #addArgIf(List, boolean, String)

+     * @see #isJavaDocVersionAtLeast(JavaVersion)

      */

     private void addArgIf( List<String> arguments, boolean b, String value, JavaVersion requiredJavaVersion )

     {

@@ -3860,7 +3817,7 @@
      * @param arguments a list of arguments, not null

      * @param key       the argument name.

      * @param value     the argument value to be added.

-     * @see #addArgIfNotEmpty(java.util.List, String, String, boolean)

+     * @see #addArgIfNotEmpty(List, String, String, boolean)

      */

     private void addArgIfNotEmpty( List<String> arguments, String key, String value )

     {

@@ -3880,7 +3837,7 @@
      * @param splitValue          if <code>true</code> given value will be tokenized by comma

      * @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f

      * @see #addArgIfNotEmpty(List, String, String, boolean, boolean)

-     * @see #isJavaDocVersionAtLeast(float)

+     * @see #isJavaDocVersionAtLeast(JavaVersion)

      */

     private void addArgIfNotEmpty( List<String> arguments, String key, String value, boolean repeatKey,

                                    boolean splitValue, JavaVersion requiredJavaVersion )

@@ -3973,7 +3930,7 @@
      * @param key                 the argument name.

      * @param value               the argument value to be added.

      * @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f

-     * @see #addArgIfNotEmpty(java.util.List, String, String, float, boolean)

+     * @see #addArgIfNotEmpty(List, String, String, JavaVersion, boolean)

      */

     private void addArgIfNotEmpty( List<String> arguments, String key, String value,

                                    JavaVersion requiredJavaVersion )

@@ -3990,8 +3947,8 @@
      * @param value               the argument value to be added.

      * @param requiredJavaVersion the required Java version, for example 1.31f or 1.4f

      * @param repeatKey           repeat or not the key in the command line

-     * @see #addArgIfNotEmpty(java.util.List, String, String)

-     * @see #isJavaDocVersionAtLeast(float)

+     * @see #addArgIfNotEmpty(List, String, String)

+     * @see #isJavaDocVersionAtLeast

      */

     private void addArgIfNotEmpty( List<String> arguments, String key, String value, JavaVersion requiredJavaVersion,

                                    boolean repeatKey )

@@ -4319,7 +4276,7 @@
     /**

      * @param sourcePaths could be null

      * @param files       not null

-     * @return a list files with unnamed package names for files in the sourecPaths

+     * @return a list files with unnamed package names for files in the sourcePaths

      */

     private List<String> getFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files )

     {

@@ -4331,7 +4288,7 @@
      * @param files           not null, containing list of quoted files

      * @param onlyPackageName boolean for only package name

      * @return a list of package names or files with unnamed package names, depending the value of the unnamed flag

-     * @see #getFiles(List)

+     * @see #getFiles

      * @see #getSourcePaths()

      */

     private List<String> getPackageNamesOrFilesWithUnnamedPackages( Collection<String> sourcePaths, List<String> files,

@@ -4409,7 +4366,7 @@
         File optionsFile = new File( javadocOutputDirectory, OPTIONS_FILE_NAME );

 

         StringBuilder options = new StringBuilder();

-        options.append( StringUtils.join( arguments.toArray( new String[arguments.size()] ),

+        options.append( StringUtils.join( arguments.iterator(),

                                           SystemUtils.LINE_SEPARATOR ) );

 

         try

@@ -4439,7 +4396,7 @@
      * @see <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/javadoc/whatsnew-1.4.html#runningjavadoc">

      *      What s New in Javadoc 1.4

      *      </a>

-     * @see #isJavaDocVersionAtLeast(float)

+     * @see #isJavaDocVersionAtLeast(JavaVersion)

      * @see #ARGFILE_FILE_NAME

      * @see #FILES_FILE_NAME

      */

@@ -4647,8 +4604,8 @@
      * Standard Javadoc Options wrapped by this Plugin.

      *

      * @param javadocOutputDirectory not null

-     * @param arguments   not null

-     * @param sourcePaths not null

+     * @param arguments              not null

+     * @param allSourcePaths         not null

      * @throws MavenReportException if any

      * @see <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions">http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#javadocoptions</a>

      */

@@ -4861,10 +4818,7 @@
 

         if ( additionalOptions != null && additionalOptions.length > 0 )

         {

-            for ( String option : additionalOptions )

-            {

-                arguments.add( option );

-            }

+            Collections.addAll( arguments, additionalOptions );

         }

     }

 

@@ -5706,7 +5660,7 @@
      * @return the detected Javadoc links using the Maven conventions for all dependencies defined in the current

      *         project or an empty list.

      * @see #detectLinks

-     * @see #isValidJavadocLink(String)

+     * @see #isValidJavadocLink

      * @since 2.6

      */

     private List<String> getDependenciesLinks()

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
index 3060678..c343a58 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java
@@ -269,14 +269,13 @@
         archiver.setArchiver( jarArchiver );

         archiver.setOutputFile( javadocJar );

 

-        File contentDirectory = javadocFiles;

-        if ( !contentDirectory.exists() )

+        if ( !javadocFiles.exists() )

         {

             getLog().warn( "JAR will be empty - no content was marked for inclusion!" );

         }

         else

         {

-            archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );

+            archiver.getArchiver().addDirectory( javadocFiles, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );

         }

 

         List<Resource> resources = project.getBuild().getResources();

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
index dab71d8..4fba34f 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -133,15 +133,7 @@
         {

             executeReport( locale );

         }

-        catch ( MavenReportException e )

-        {

-            if ( failOnError )

-            {

-                throw e;

-            }

-            getLog().error( "Error while creating javadoc report: " + e.getMessage(), e );

-        }

-        catch ( RuntimeException e )

+        catch ( MavenReportException | RuntimeException e )

         {

             if ( failOnError )

             {

@@ -234,7 +226,7 @@
     {

         boolean canGenerate = false;

 

-        if ( !this.isAggregator() || ( this.isAggregator() && this.project.isExecutionRoot() ) )

+        if ( !this.isAggregator() || this.project.isExecutionRoot() )

         {

             Collection<String> sourcePaths;

             List<String> files;

@@ -289,7 +281,7 @@
     }

 

     /**

-     * @param theDestDir The destiation directory.

+     * @param theDestDir The destination directory.

      */

     public void setDestDir( String theDestDir )

     {

@@ -328,11 +320,7 @@
             Locale locale = Locale.getDefault();

             generate( sink, locale );

         }

-        catch ( MavenReportException e )

-        {

-            failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );

-        }

-        catch ( RuntimeException e )

+        catch ( MavenReportException | RuntimeException e )

         {

             failOnError( "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation", e );

         }

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index 42ee8cf..fded1d3 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -62,16 +62,13 @@
 import org.codehaus.plexus.util.cli.Commandline;

 

 import java.io.BufferedReader;

-import java.io.ByteArrayOutputStream;

 import java.io.File;

 import java.io.FileInputStream;

 import java.io.FileNotFoundException;

 import java.io.FileOutputStream;

 import java.io.IOException;

-import java.io.InputStream;

 import java.io.InputStreamReader;

 import java.io.OutputStream;

-import java.io.OutputStreamWriter;

 import java.io.PrintStream;

 import java.io.UnsupportedEncodingException;

 import java.lang.reflect.Modifier;

@@ -79,6 +76,8 @@
 import java.net.URI;

 import java.net.URL;

 import java.net.URLClassLoader;

+import java.nio.charset.Charset;

+import java.nio.charset.IllegalCharsetNameException;

 import java.util.ArrayList;

 import java.util.Arrays;

 import java.util.Collection;

@@ -111,7 +110,7 @@
     /** Error message when VM could not be started using invoker. */

     protected static final String ERROR_INIT_VM =

         "Error occurred during initialization of VM, try to reduce the Java heap size for the MAVEN_OPTS "

-            + "environnement variable using -Xms:<size> and -Xmx:<size>.";

+            + "environment variable using -Xms:<size> and -Xmx:<size>.";

 

     /**

      * Method that removes the invalid directories in the specified directories. <b>Note</b>: All elements in

@@ -193,21 +192,16 @@
      * Method that gets all the source files to be excluded from the javadoc on the given source paths.

      *

      * @param sourcePaths the path to the source files

-     * @param subpackagesList list of subpackages to be included in the javadoc

      * @param excludedPackages the package names to be excluded in the javadoc

      * @return a List of the source files to be excluded in the generated javadoc

      */

-    protected static List<String> getExcludedNames( Collection<String> sourcePaths, String[] subpackagesList,

-                                                    String[] excludedPackages )

+    protected static List<String> getExcludedNames( Collection<String> sourcePaths, String[] excludedPackages )

     {

         List<String> excludedNames = new ArrayList<>();

         for ( String path : sourcePaths )

         {

-            for ( String aSubpackagesList : subpackagesList )

-            {

-                List<String> excludes = getExcludedPackages( path, excludedPackages );

-                excludedNames.addAll( excludes );

-            }

+            List<String> excludes = getExcludedPackages( path, excludedPackages );

+            excludedNames.addAll( excludes );

         }

 

         return excludedNames;

@@ -295,8 +289,7 @@
             return;

         }

 

-        List<String> excludes = new ArrayList<>();

-        excludes.addAll( Arrays.asList( FileUtils.getDefaultExcludes() ) );

+        List<String> excludes = new ArrayList<>( Arrays.asList( FileUtils.getDefaultExcludes() ) );

 

         if ( StringUtils.isNotEmpty( excludedocfilessubdir ) )

         {

@@ -697,24 +690,14 @@
             return false;

         }

 

-        OutputStream ost = new ByteArrayOutputStream();

-        OutputStreamWriter osw = null;

         try

         {

-            osw = new OutputStreamWriter( ost, charsetName );

-            osw.close();

-            osw = null;

+            return Charset.isSupported( charsetName );

         }

-        catch ( IOException exc )

+        catch ( IllegalCharsetNameException e )

         {

             return false;

         }

-        finally

-        {

-            IOUtil.close( osw );

-        }

-

-        return true;

     }

 

     /**

@@ -828,36 +811,7 @@
             throw new IOException( "The url could not be null." );

         }

 

-        if ( !file.getParentFile().exists() )

-        {

-            file.getParentFile().mkdirs();

-        }

-

-        InputStream in = null;

-        OutputStream out = null;

-        try

-        {

-            in = url.openStream();

-

-            if ( in == null )

-            {

-                throw new IOException( "The resource " + url + " doesn't exists." );

-            }

-

-            out = new FileOutputStream( file );

-

-            IOUtil.copy( in, out );

-

-            out.close();

-            out = null;

-            in.close();

-            in = null;

-        }

-        finally

-        {

-            IOUtil.close( in );

-            IOUtil.close( out );

-        }

+        FileUtils.copyURLToFile( url, file );

     }

 

     /**

@@ -1080,12 +1034,8 @@
         }

 

         List<String> classes = new ArrayList<>();

-        JarInputStream jarStream = null;

-

-        try

+        try ( JarInputStream jarStream = new JarInputStream( new FileInputStream( jarFile ) ) )

         {

-            jarStream = new JarInputStream( new FileInputStream( jarFile ) );

-

             for ( JarEntry jarEntry = jarStream.getNextJarEntry(); jarEntry != null; jarEntry =

                 jarStream.getNextJarEntry() )

             {

@@ -1098,13 +1048,6 @@
 

                 jarStream.closeEntry();

             }

-

-            jarStream.close();

-            jarStream = null;

-        }

-        finally

-        {

-            IOUtil.close( jarStream );

         }

 

         return classes;

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
index 2c13cba..89b9e73 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/ResourcesBundleMojo.java
@@ -130,12 +130,7 @@
             archiver.setDestFile( bundleFile );

             archiver.createArchive();

         }

-        catch ( ArchiverException e )

-        {

-            throw new MojoExecutionException( "Failed to assemble javadoc-resources bundle archive. Reason: "

-                + e.getMessage(), e );

-        }

-        catch ( IOException e )

+        catch ( ArchiverException | IOException e )

         {

             throw new MojoExecutionException( "Failed to assemble javadoc-resources bundle archive. Reason: "

                 + e.getMessage(), e );

diff --git a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
index b4d331f..f028e24 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/resolver/ResourceResolver.java
@@ -227,9 +227,7 @@
             {

                 IOException error =

                     new IOException( "Failed to read javadoc options from: " + optionsFile + "\nReason: "

-                        + e.getMessage() );

-                error.initCause( e );

-                

+                        + e.getMessage(), e );

                 throw error;

             }

             finally

@@ -279,21 +277,14 @@
                 dirs.add( entry.getValue() );

             }

         }

-        catch ( ArtifactResolutionException e )

+        catch ( ArtifactResolutionException | ArtifactNotFoundException e )

         {

             if ( getLogger().isDebugEnabled() )

             {

                 getLogger().debug( e.getMessage(), e );

             }

         }

-        catch ( ArtifactNotFoundException e )

-        {

-            if ( getLogger().isDebugEnabled() )

-            {

-                getLogger().debug( e.getMessage(), e );

-            }

-        }

-        

+

         List<JavadocBundle> result = new ArrayList<>();

 

         for ( String d : dirs )

@@ -311,9 +302,7 @@
                 }

                 catch ( XmlPullParserException e )

                 {

-                    IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage() );

-                    error.initCause( e );

-                    

+                    IOException error = new IOException( "Failed to parse javadoc options: " + e.getMessage(), e );

                     throw error;

                 }

             }

@@ -432,8 +421,7 @@
 

                 unArchiver.extract();

 

-                result.add( new AbstractMap.SimpleEntry<String, String>( a.getDependencyConflictId(),

-                                                                         d.getAbsolutePath() ) );

+                result.add( new AbstractMap.SimpleEntry<>( a.getDependencyConflictId(), d.getAbsolutePath() ) );

             }

             catch ( final NoSuchArchiverException e )

             {

@@ -466,19 +454,13 @@
             if ( config.includeCompileSources() )

             {

                 final List<String> srcRoots = reactorProject.getCompileSourceRoots();

-                for ( final String root : srcRoots )

-                {

-                    dirs.add( root );

-                }

+                dirs.addAll( srcRoots );

             }

 

             if ( config.includeTestSources() )

             {

                 final List<String> srcRoots = reactorProject.getTestCompileSourceRoots();

-                for ( final String root : srcRoots )

-                {

-                    dirs.add( root );

-                }

+                dirs.addAll( srcRoots );

             }

         }

 

diff --git a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
index c530ef2..94ad8f8 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java
@@ -721,18 +721,7 @@
     private static String readFile( File file )

         throws Exception

     {

-        Reader fileReader = null;

-        try

-        {

-            fileReader = ReaderFactory.newReader( file, "UTF-8" );

-            final String content = IOUtil.toString( fileReader );

-            fileReader.close();

-            fileReader = null;

-            return content;

-        }

-        finally

-        {

-            IOUtil.close( fileReader );

-        }

+        String content = FileUtils.fileRead( file, "UTF-8" );

+        return content;

     }

 }

diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
index c4d66b9..0f18b6b 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
@@ -24,7 +24,6 @@
 

 import java.io.File;

 import java.io.IOException;

-import java.io.Reader;

 import java.net.HttpURLConnection;

 import java.net.URL;

 import java.nio.charset.StandardCharsets;

@@ -48,8 +47,6 @@
 import org.apache.maven.settings.Settings;

 import org.codehaus.plexus.languages.java.version.JavaVersion;

 import org.codehaus.plexus.util.FileUtils;

-import org.codehaus.plexus.util.IOUtil;

-import org.codehaus.plexus.util.ReaderFactory;

 import org.codehaus.plexus.util.StringUtils;

 import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;

 

@@ -397,21 +394,10 @@
 

         File options = new File( apidocs, "options" );

         assertTrue( options.isFile() );

-        String contentOptions = null;

-        Reader reader = null;

-        try

-        {

-            reader = ReaderFactory.newPlatformReader( options );

-            contentOptions = IOUtil.toString( reader );

-            reader.close();

-            reader = null;

-        }

-        finally

-        {

-            IOUtil.close( reader );

-        }

 

-        assertTrue( contentOptions != null );

+        String contentOptions = FileUtils.fileRead( options );

+

+        assertNotNull( contentOptions );

         assertTrue( contentOptions.contains( "-link" ) );

         assertTrue( contentOptions.contains( "http://java.sun.com/j2se/" ) );

     }

@@ -760,7 +746,7 @@
         }

         catch ( MojoExecutionException e )

         {

-            assertTrue( "Doesnt handle correctly newline for header or footer parameter", false );

+            fail( "Doesnt handle correctly newline for header or footer parameter" );

         }

 

         assertTrue( true );

@@ -986,7 +972,7 @@
         try

         {

             mojo.execute();

-            assertTrue( "No wrong encoding catch", false );

+            fail( "No wrong encoding catch" );

         }

         catch ( MojoExecutionException e )

         {

@@ -997,7 +983,7 @@
         try

         {

             mojo.execute();

-            assertTrue( "No wrong docencoding catch", false );

+            fail( "No wrong docencoding catch" );

         }

         catch ( MojoExecutionException e )

         {

@@ -1008,7 +994,7 @@
         try

         {

             mojo.execute();

-            assertTrue( "No wrong charset catch", false );

+            fail( "No wrong charset catch" );

         }

         catch ( MojoExecutionException e )

         {

@@ -1021,7 +1007,7 @@
         try

         {

             mojo.execute();

-            assertTrue( "No wrong locale catch", false );

+            fail( "No wrong locale catch" );

         }

         catch ( MojoExecutionException e )

         {

@@ -1038,7 +1024,7 @@
         try

         {

             mojo.execute();

-            assertTrue( "No conflict catch", false );

+            fail( "No conflict catch" );

         }

         catch ( MojoExecutionException e )

         {

@@ -1141,7 +1127,7 @@
         try

         {

             mojo.execute();

-            assertTrue( false );

+            fail();

         }

         catch ( Exception e )

         {

diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
index fa5bfaa..825c2a0 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java
@@ -39,7 +39,6 @@
 import javax.servlet.http.HttpServletResponse;

 

 import org.apache.commons.lang3.builder.EqualsBuilder;

-import org.apache.maven.plugins.javadoc.JavadocUtil;

 import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet;

 import org.apache.maven.settings.Proxy;

 import org.apache.maven.settings.Settings;

@@ -69,7 +68,7 @@
         try

         {

             JavadocUtil.extractJavadocVersion( version );

-            assertTrue( "Not catch null", false );

+            fail( "Not catch null" );

         }

         catch ( IllegalArgumentException e )

         {

@@ -179,7 +178,7 @@
         try

         {

             JavadocUtil.parseJavadocMemory( memory );

-            assertTrue( "Not catch null", false );

+            fail( "Not catch null" );

         }

         catch ( IllegalArgumentException e )

         {

@@ -223,7 +222,7 @@
         try

         {

             JavadocUtil.parseJavadocMemory( memory );

-            assertTrue( "Not catch wrong pattern", false );

+            fail( "Not catch wrong pattern" );

         }

         catch ( IllegalArgumentException e )

         {

@@ -233,7 +232,7 @@
         try

         {

             JavadocUtil.parseJavadocMemory( memory );

-            assertTrue( "Not catch wrong pattern", false );

+            fail( "Not catch wrong pattern" );

         }

         catch ( IllegalArgumentException e )

         {

@@ -751,7 +750,7 @@
     public void testUnifyPathSeparator()

         throws Exception

     {

-        assertEquals( null, JavadocUtil.unifyPathSeparator( null ) );

+        assertNull( JavadocUtil.unifyPathSeparator( null ) );

 

         final String ps = File.pathSeparator;

 

diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
index 0a4f1eb..0f0bc23 100644
--- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
+++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocVersionTest.java
@@ -19,13 +19,12 @@
  * under the License.

  */

 

-import static org.junit.Assert.assertTrue;

 import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertTrue;

 

 import java.util.regex.Matcher;

 import java.util.regex.Pattern;

 

-import org.apache.maven.plugins.javadoc.JavadocVersion;

 import org.junit.Test;

 

 public class JavadocVersionTest

@@ -42,9 +41,9 @@
         assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.5" ) ) < 0 );

         assertTrue( JavadocVersion.parse( "1.8" ).compareTo( JavadocVersion.parse( "9" ) ) < 0 );

 

-        assertTrue( JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4" ) ) == 0 );

-        assertTrue( JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) == 0 );

-        assertTrue( JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "9" ) ) == 0 );

+        assertEquals( 0, JavadocVersion.parse( "1.4" ).compareTo( JavadocVersion.parse( "1.4" ) ) );

+        assertEquals( 0, JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4.2" ) ) );

+        assertEquals( 0, JavadocVersion.parse( "9" ).compareTo( JavadocVersion.parse( "9" ) ) );

 

         assertTrue( JavadocVersion.parse( "1.4.2" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );

         assertTrue( JavadocVersion.parse( "1.5" ).compareTo( JavadocVersion.parse( "1.4" ) ) > 0 );