diff -Nru maven-javadoc-plugin-3.0.0/CONTRIBUTING.md maven-javadoc-plugin-3.0.1/CONTRIBUTING.md --- maven-javadoc-plugin-3.0.0/CONTRIBUTING.md 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/CONTRIBUTING.md 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,91 @@ + +Contributing to Apache Maven JavaDoc Plugin +====================== + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Some of the ideas are documented in the [Maven Wiki][maven-wiki] +which might be interesting to read and for further discussion. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list](https://maven.apache.org/mail-lists.html) first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MJAVADOC-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven JavaDoc JIRA project page](https://issues.apache.org/jira/projects/MJAVADOC/) ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[dev-ml-list]: https://maven.apache.org/mail-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index diff -Nru maven-javadoc-plugin-3.0.0/debian/changelog maven-javadoc-plugin-3.0.1/debian/changelog --- maven-javadoc-plugin-3.0.0/debian/changelog 2018-04-08 21:17:47.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/changelog 2019-02-19 11:24:11.000000000 +0000 @@ -1,3 +1,42 @@ +maven-javadoc-plugin (3.0.1-3~18.04.1) bionic; urgency=medium + + * Backport from Disco. + * Fix FTBFS for multiple packages caused by OpenJDK 11 javadoc. (LP: #1814133) + + -- Tiago Stürmer Daitx Tue, 19 Feb 2019 11:24:11 +0000 + +maven-javadoc-plugin (3.0.1-3) unstable; urgency=medium + + * Team upload. + * Add default-detectJavaApiLink-to-false.patch (Closes: #919798) + This addresses FTBFS bugs for multiple javadoc packages that + build-depend on maven. Also see: + - https://github.com/oracle/opengrok/issues/2629 + - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919831 + Thank you to Markus Koschany for identifying a work-around. + + -- tony mancill Sun, 17 Feb 2019 10:36:03 -0800 + +maven-javadoc-plugin (3.0.1-2) unstable; urgency=medium + + * Team upload. + * Add patch for uncaught IOException FTBFS (Closes: #914411) + * Bump Standards-Version to 4.2.1 + * Update Homepage and Source URLs to use https + + -- tony mancill Sat, 24 Nov 2018 10:17:09 -0800 + +maven-javadoc-plugin (3.0.1-1) unstable; urgency=medium + + * Team upload. + * New upstream release + - Refreshed the patches + * Standards-Version updated to 4.1.5 + * Use salsa.debian.org Vcs-* URLs + * Track and download the new releases from GitHub + + -- Emmanuel Bourg Mon, 30 Jul 2018 10:59:33 +0200 + maven-javadoc-plugin (3.0.0-4) unstable; urgency=medium * Team upload. diff -Nru maven-javadoc-plugin-3.0.0/debian/control maven-javadoc-plugin-3.0.1/debian/control --- maven-javadoc-plugin-3.0.0/debian/control 2018-04-08 21:17:26.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/control 2019-02-17 18:36:03.000000000 +0000 @@ -24,10 +24,10 @@ libplexus-languages-java, libqdox2-java, maven-debian-helper (>> 0.4) -Standards-Version: 4.1.4 -Vcs-Git: https://anonscm.debian.org/git/pkg-java/maven-javadoc-plugin.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/maven-javadoc-plugin.git -Homepage: http://maven.apache.org/plugins/maven-javadoc-plugin/ +Standards-Version: 4.2.1 +Vcs-Git: https://salsa.debian.org/java-team/maven-javadoc-plugin.git +Vcs-Browser: https://salsa.debian.org/java-team/maven-javadoc-plugin +Homepage: https://maven.apache.org/plugins/maven-javadoc-plugin/ Package: libmaven-javadoc-plugin-java Architecture: all diff -Nru maven-javadoc-plugin-3.0.0/debian/copyright maven-javadoc-plugin-3.0.1/debian/copyright --- maven-javadoc-plugin-3.0.0/debian/copyright 2018-01-05 17:30:48.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/copyright 2019-02-17 18:36:03.000000000 +0000 @@ -1,17 +1,19 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Maven Javadoc Plugin Upstream-Contact: Apache Maven team -Source: http://maven.apache.org +Source: https://maven.apache.org/plugins/maven-javadoc-plugin/ +Files-Excluded: *.jar Files: * -Copyright: 2001-2016, The Apache Software Foundation +Copyright: 2001-2018, The Apache Software Foundation License: Apache-2.0 Files: debian/* Copyright: 2009, Ludovic Claude 2010, Torsten Werner 2011, Miguel Landaeta - 2013-2016, Emmanuel Bourg + 2013-2018, Emmanuel Bourg + 2018, tony mancill License: GPL-3+ License: GPL-3+ diff -Nru maven-javadoc-plugin-3.0.0/debian/orig-tar.sh maven-javadoc-plugin-3.0.1/debian/orig-tar.sh --- maven-javadoc-plugin-3.0.0/debian/orig-tar.sh 2017-12-10 00:14:33.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/orig-tar.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -#!/bin/sh -e - -VERSION=$2 -TAR=../maven-javadoc-plugin_$VERSION.orig.tar.xz -DIR=maven-javadoc-plugin-$VERSION -TAG=$(echo "maven-javadoc-plugin-$VERSION" | sed -re's/~(alpha|beta)/-\1-/') - -svn export http://svn.apache.org/repos/asf/maven/plugins/tags/${TAG} $DIR -XZ_OPT=--best tar -c -J -f $TAR --exclude '*.jar' --exclude '*.class' $DIR -rm -rf $DIR ../$TAG - -# move to directory 'tarballs' -if [ -r .svn/deb-layout ]; then - . .svn/deb-layout - mv $TAR $origDir && echo "moved $TAR to $origDir" -fi diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/default-detectJavaApiLink-to-false.patch maven-javadoc-plugin-3.0.1/debian/patches/default-detectJavaApiLink-to-false.patch --- maven-javadoc-plugin-3.0.0/debian/patches/default-detectJavaApiLink-to-false.patch 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/default-detectJavaApiLink-to-false.patch 2019-02-17 18:36:03.000000000 +0000 @@ -0,0 +1,26 @@ +Description: set detectJavaApiLink default value to false +Author: tony mancill +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919798 +Comment: Also see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919831 +Forwarded: not-needed + +--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java ++++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +@@ -587,7 +587,7 @@ + *
+ * See + * Javadoc +- * for the default values. ++ * for the default values. For Debian, the default value is false. See Debian bug 919798. + *
+ * + * @see #links +@@ -595,7 +595,7 @@ + * @see #DEFAULT_JAVA_API_LINKS + * @since 2.6 + */ +- @Parameter( property = "detectJavaApiLink", defaultValue = "true" ) ++ @Parameter( property = "detectJavaApiLink", defaultValue = "false" ) + private boolean detectJavaApiLink; + + /** diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/fix-unmappable-characters.patch maven-javadoc-plugin-3.0.1/debian/patches/fix-unmappable-characters.patch --- maven-javadoc-plugin-3.0.0/debian/patches/fix-unmappable-characters.patch 2017-12-11 14:29:45.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/fix-unmappable-characters.patch 2019-02-17 18:36:03.000000000 +0000 @@ -3,12 +3,12 @@ Forwarded: not-needed --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java -@@ -573,7 +573,7 @@ +@@ -569,7 +569,7 @@ * * - * IBM 1.5 (French JVM) -- * javadoc version complète de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a" -+ * javadoc version complete de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a" + * IBM 1.5 (French JVM) +- * javadoc version complète de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a" ++ * javadoc version complete de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a" * * - * FreeBSD 1.5 + * FreeBSD 1.5 diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/ignore-source-errors.patch maven-javadoc-plugin-3.0.1/debian/patches/ignore-source-errors.patch --- maven-javadoc-plugin-3.0.0/debian/patches/ignore-source-errors.patch 2018-04-08 21:10:09.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/ignore-source-errors.patch 2019-02-17 18:36:03.000000000 +0000 @@ -3,13 +3,13 @@ Forwarded: no --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java -@@ -4856,6 +4856,13 @@ +@@ -4859,6 +4859,13 @@ arguments.add( option ); } } + + // ignore source errors when using the default doclet with Java 9 -+ if ( doclet == null && SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_9) && !arguments.contains( "--ignore-source-errors" ) ) ++ if ( doclet == null && org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast( org.apache.commons.lang3.JavaVersion.JAVA_9 ) && !arguments.contains( "--ignore-source-errors" ) ) + { + getLog().info("Adding the --ignore-source-errors option"); + arguments.add( "--ignore-source-errors" ); diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/MJAVADOC-504.patch maven-javadoc-plugin-3.0.1/debian/patches/MJAVADOC-504.patch --- maven-javadoc-plugin-3.0.0/debian/patches/MJAVADOC-504.patch 2018-01-05 17:29:20.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/MJAVADOC-504.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -Description: Fixes the NullPointerException in JavadocUtil.getJavaHome() when JAVA_HOME isn't set -Origin: upstream, https://github.com/apache/maven-javadoc-plugin/commit/6c53ec5 -Bug: https://issues.apache.org/jira/browse/MJAVADOC-504 ---- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java -+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java -@@ -1278,10 +1278,22 @@ - private static File getJavaHome( Log log ) - { - File javaHome = null; -+ -+ String javaHomeValue = null; -+ try -+ { -+ javaHomeValue = CommandLineUtils.getSystemEnvVars().getProperty( "JAVA_HOME" ); -+ } -+ catch ( IOException e ) -+ { -+ if ( log != null && log.isDebugEnabled() ) -+ { -+ log.debug( "IOException: " + e.getMessage() ); -+ } -+ } - - // if maven.home is set, we can assume JAVA_HOME must be used for testing -- -- if ( System.getProperty( "maven.home" ) == null ) -+ if ( System.getProperty( "maven.home" ) == null || javaHomeValue == null ) - { - // JEP220 (Java9) restructured the JRE/JDK runtime image - if ( ( SystemUtils.IS_OS_MAC_OSX -@@ -1297,17 +1309,7 @@ - - if ( javaHome == null || !javaHome.exists() ) - { -- try -- { -- javaHome = new File( CommandLineUtils.getSystemEnvVars().getProperty( "JAVA_HOME" ) ); -- } -- catch ( IOException e ) -- { -- if ( log != null && log.isDebugEnabled() ) -- { -- log.debug( "IOException: " + e.getMessage() ); -- } -- } -+ javaHome = new File( javaHomeValue ); - } - - if ( javaHome == null || !javaHome.exists() ) diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/openjdk-9-javadoc-path.patch maven-javadoc-plugin-3.0.1/debian/patches/openjdk-9-javadoc-path.patch --- maven-javadoc-plugin-3.0.0/debian/patches/openjdk-9-javadoc-path.patch 2018-04-08 21:13:15.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/openjdk-9-javadoc-path.patch 2019-02-17 18:36:03.000000000 +0000 @@ -1,11 +1,11 @@ --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java -@@ -3699,6 +3699,12 @@ +@@ -3702,6 +3702,12 @@ { javadocExe = new File( SystemUtils.getJavaHome() + File.separator + "bin", javadocCommand ); } + // On Java 9, this has moved to: /usr/lib/jvm/java-9-openjdk-amd64/bin/javadoc -+ else if ( SystemUtils.isJavaVersionAtLeast( JavaVersion.JAVA_9 ) ) ++ else if ( org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast( org.apache.commons.lang3.JavaVersion.JAVA_9 ) ) + { + javadocExe = + new File( SystemUtils.getJavaHome() + File.separator + "bin", javadocCommand ); diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/plexus-component-metadata-plugin-version.patch maven-javadoc-plugin-3.0.1/debian/patches/plexus-component-metadata-plugin-version.patch --- maven-javadoc-plugin-3.0.0/debian/patches/plexus-component-metadata-plugin-version.patch 2017-12-11 14:29:51.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/plexus-component-metadata-plugin-version.patch 2019-02-17 18:36:03.000000000 +0000 @@ -5,7 +5,7 @@ --- a/pom.xml +++ b/pom.xml -@@ -382,7 +382,7 @@ +@@ -391,7 +391,7 @@ org.codehaus.plexus plexus-component-metadata diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/plexus-utils2-compatibility.patch maven-javadoc-plugin-3.0.1/debian/patches/plexus-utils2-compatibility.patch --- maven-javadoc-plugin-3.0.0/debian/patches/plexus-utils2-compatibility.patch 2017-12-11 14:29:43.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/plexus-utils2-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -Description: FileUtils.fileWrite(File, String, String) was introduced in - plexus-utils 2.0.6 but this version isn't available in Debian yet. So we fall - back to FileUtils.fileWrite(String, String, String) -Author: Emmanuel Bourg -Forwarded: not-needed ---- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java -+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java -@@ -5374,7 +5374,7 @@ - StringUtils.replaceOnce( fileContents, "function loadFrames() {", fixData ); - if ( !patchedFileContents.equals( fileContents ) ) - { -- FileUtils.fileWrite( file, outputEncoding, patchedFileContents ); -+ FileUtils.fileWrite( file.getAbsolutePath(), outputEncoding, patchedFileContents ); - patched++; - } - } diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/plexus-utils.patch maven-javadoc-plugin-3.0.1/debian/patches/plexus-utils.patch --- maven-javadoc-plugin-3.0.0/debian/patches/plexus-utils.patch 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/plexus-utils.patch 2019-02-17 18:36:03.000000000 +0000 @@ -0,0 +1,35 @@ +--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java ++++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java +@@ -1178,14 +1178,24 @@ + InvocationOutputHandler outputHandler = new PrintStreamHandler( ps, false ); + request.setOutputHandler( outputHandler ); + +- outputHandler.consumeLine( "Invoking Maven for the goals: " + goals + " with " +- + ( properties == null ? "no properties" : "properties=" + properties ) ); +- outputHandler.consumeLine( "" ); +- outputHandler.consumeLine( "M2_HOME=" + getMavenHome( log ) ); +- outputHandler.consumeLine( "MAVEN_OPTS=" + getMavenOpts( log ) ); +- outputHandler.consumeLine( "JAVA_HOME=" + getJavaHome( log ) ); +- outputHandler.consumeLine( "JAVA_OPTS=" + getJavaOpts( log ) ); +- outputHandler.consumeLine( "" ); ++ try ++ { ++ outputHandler.consumeLine( "Invoking Maven for the goals: " + goals + " with " ++ + ( properties == null ? "no properties" : "properties=" + properties ) ); ++ outputHandler.consumeLine( "" ); ++ outputHandler.consumeLine( "M2_HOME=" + getMavenHome( log ) ); ++ outputHandler.consumeLine( "MAVEN_OPTS=" + getMavenOpts( log ) ); ++ outputHandler.consumeLine( "JAVA_HOME=" + getJavaHome( log ) ); ++ outputHandler.consumeLine( "JAVA_OPTS=" + getJavaOpts( log ) ); ++ outputHandler.consumeLine( "" ); ++ } ++ catch ( IOException e ) ++ { ++ if ( log != null && log.isDebugEnabled() ) ++ { ++ log.debug( "IOException: " + e.getMessage() ); ++ } ++ } + + try + { diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/reproducible-footer.patch maven-javadoc-plugin-3.0.1/debian/patches/reproducible-footer.patch --- maven-javadoc-plugin-3.0.0/debian/patches/reproducible-footer.patch 2017-12-11 14:29:47.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/reproducible-footer.patch 2019-02-17 18:36:03.000000000 +0000 @@ -3,7 +3,7 @@ Forwarded: no --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java -@@ -2818,6 +2818,20 @@ +@@ -2821,6 +2821,20 @@ private String getBottomText() { int currentYear = Calendar.getInstance().get( Calendar.YEAR ); diff -Nru maven-javadoc-plugin-3.0.0/debian/patches/series maven-javadoc-plugin-3.0.1/debian/patches/series --- maven-javadoc-plugin-3.0.0/debian/patches/series 2018-03-28 13:08:56.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/patches/series 2019-02-19 11:24:11.000000000 +0000 @@ -1,7 +1,7 @@ -plexus-utils2-compatibility.patch fix-unmappable-characters.patch reproducible-footer.patch openjdk-9-javadoc-path.patch plexus-component-metadata-plugin-version.patch -MJAVADOC-504.patch ignore-source-errors.patch +#plexus-utils.patch +default-detectJavaApiLink-to-false.patch diff -Nru maven-javadoc-plugin-3.0.0/debian/watch maven-javadoc-plugin-3.0.1/debian/watch --- maven-javadoc-plugin-3.0.0/debian/watch 2017-12-10 00:14:33.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/debian/watch 2019-02-17 18:36:03.000000000 +0000 @@ -1,4 +1,3 @@ -version=3 -opts="uversionmangle=s/-(alpha|beta|M)-?/~$1/" \ - http://svn.apache.org/repos/asf/maven/plugins/tags/ \ - maven-javadoc-plugin-(\d.*)/ debian debian/orig-tar.sh +version=4 +opts="repack,compression=xz,uversionmangle=s/-(alpha|beta|M)-/~$1/" \ +https://github.com/apache/maven-javadoc-plugin/tags .*/maven-javadoc-plugin-([\d\.]+).tar.gz diff -Nru maven-javadoc-plugin-3.0.0/.gitignore maven-javadoc-plugin-3.0.1/.gitignore --- maven-javadoc-plugin-3.0.0/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/.gitignore 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,17 @@ +target/ +.project +.classpath +.settings/ +.svn/ +bin/ +# Intellij +*.ipr +*.iml +.idea +out/ +.DS_Store +/bootstrap +/dependencies.xml +.java-version +/javadoc-options-javadoc-resources.xml +.checkstyle diff -Nru maven-javadoc-plugin-3.0.0/Jenkinsfile maven-javadoc-plugin-3.0.1/Jenkinsfile --- maven-javadoc-plugin-3.0.0/Jenkinsfile 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/Jenkinsfile 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,20 @@ +/** + * 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. + */ + +asfMavenTlpStdBuild(jdk:[7,8,9]) diff -Nru maven-javadoc-plugin-3.0.0/pom.xml maven-javadoc-plugin-3.0.1/pom.xml --- maven-javadoc-plugin-3.0.0/pom.xml 2017-12-03 19:33:02.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/pom.xml 2018-05-25 09:10:44.000000000 +0000 @@ -25,12 +25,12 @@ org.apache.maven.plugins maven-plugins - 30 + 31 ../../pom/maven/maven-plugins/pom.xml maven-javadoc-plugin - 3.0.0 + 3.0.1 maven-plugin Apache Maven Javadoc Plugin @@ -45,14 +45,19 @@ - scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-javadoc-plugin-3.0.0 - scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-javadoc-plugin-3.0.0 - http://svn.apache.org/viewvc/maven/plugins/tags/maven-javadoc-plugin-3.0.0 + scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git + scm:git:https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git + https://github.com/apache/maven-javadoc-plugin/tree/${project.scm.tag} + maven-javadoc-plugin-3.0.1 jira https://issues.apache.org/jira/browse/MJAVADOC + + Jenkins + https://builds.apache.org/job/maven-box/job/maven-javadoc-plugin/ + apache.website @@ -163,12 +168,12 @@ org.apache.maven maven-archiver - 3.1.1 + 3.2.0 org.apache.maven.shared maven-invoker - 2.2 + 3.0.0 org.apache.maven.shared @@ -229,12 +234,12 @@ org.codehaus.plexus plexus-java - 0.9.5 + 0.9.8 org.codehaus.plexus plexus-archiver - 3.4 + 3.6.0 org.codehaus.plexus @@ -244,12 +249,16 @@ org.codehaus.plexus plexus-interactivity-api - 1.0-alpha-4 + 1.0-alpha-6 plexus plexus-utils + + org.codehaus.plexus + plexus-component-api + @@ -396,6 +405,7 @@ org.apache.maven.plugins maven-surefire-plugin + 2.21.0 @@ -403,6 +413,9 @@ ${maven.home} + + true + @@ -431,6 +444,9 @@ ${mrm.3rdparty.url} + + true + diff -Nru maven-javadoc-plugin-3.0.0/README.md maven-javadoc-plugin-3.0.1/README.md --- maven-javadoc-plugin-3.0.0/README.md 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/README.md 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,99 @@ + +Contributing to Apache Maven JavaDoc Plugin +====================== + +[![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] +[![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-javadoc-plugin.svg?label=Maven%20Central)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.plugins%22%20AND%20a%3A%22maven-javadoc-plugin%22) +[![Jenkins Status](https://img.shields.io/jenkins/s/https/builds.apache.org/job/maven-box/job/maven-javadoc-plugin/job/master.svg?style=flat-square)][build] +[![Jenkins tests](https://img.shields.io/jenkins/t/https/builds.apache.org/job/maven-box/job/maven-javadoc-plugin/job/master.svg?style=flat-square)][test-results] + +You have found a bug or you have an idea for a cool new feature? Contributing +code is a great way to give something back to the open source community. Before +you dig right into the code, there are a few guidelines that we need +contributors to follow so that we can have a chance of keeping on top of +things. + +Some of the ideas are documented in the [Maven Wiki][maven-wiki] +which might be interesting to read and for further discussion. + +Getting Started +--------------- + ++ Make sure you have a [JIRA account](https://issues.apache.org/jira/). ++ Make sure you have a [GitHub account](https://github.com/signup/free). ++ If you're planning to implement a new feature, it makes sense to discuss your changes + on the [dev list](https://maven.apache.org/mail-lists.html) first. + This way you can make sure you're not wasting your time on something that isn't + considered to be in Apache Maven's scope. ++ Submit a ticket for your issue, assuming one does not already exist. + + Clearly describe the issue, including steps to reproduce when it is a bug. + + Make sure you fill in the earliest version that you know has the issue. ++ Fork the repository on GitHub. + +Making and Submitting Changes +-------------- + +We accept Pull Requests via GitHub. The [developer mailing list][dev-ml-list] is the +main channel of communication for contributors. +There are some guidelines which will make applying PRs easier for us: ++ Create a topic branch from where you want to base your work (this is usually the master branch). + Push your changes to a topic branch in your fork of the repository. ++ Make commits of logical units. ++ Respect the original code style: by using the same [codestyle][code-style], + patches should only highlight the actual difference, not being disturbed by any formatting issues: + + Only use spaces for indentation. + + Create minimal diffs - disable on save actions like reformat source code or organize imports. + If you feel the source code should be reformatted, create a separate PR for this change. + + Check for unnecessary whitespace with `git diff --check` before committing. ++ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue. +``` +[MJAVADOC-XXX] - Subject of the JIRA Ticket + Optional supplemental description. +``` ++ Make sure you have added the necessary tests (JUnit/IT) for your changes. ++ Run all the tests with `mvn -Prun-its verify` to assure nothing else was accidentally broken. ++ Submit a pull request to the repository in the Apache organization. ++ Update your JIRA ticket and include a link to the pull request in the ticket. + +If you plan to contribute on a regular basis, please consider filing a [contributor license agreement][cla]. + +Making Trivial Changes +---------------------- + +For changes of a trivial nature to comments and documentation, it is not always +necessary to create a new ticket in JIRA. In this case, it is appropriate to +start the first line of a commit with '(doc)' instead of a ticket number. + +Additional Resources +-------------------- + ++ [Contributing patches](https://maven.apache.org/guides/development/guide-maven-development.html#Creating_and_submitting_a_patch) ++ [Apache Maven JavaDoc JIRA project page](https://issues.apache.org/jira/projects/MJAVADOC/) ++ [Contributor License Agreement][cla] ++ [General GitHub documentation](https://help.github.com/) ++ [GitHub pull request documentation](https://help.github.com/send-pull-requests/) ++ [Apache Maven Twitter Account](https://twitter.com/ASFMavenProject) ++ #Maven IRC channel on freenode.org + +[license]: https://www.apache.org/licenses/LICENSE-2.0 +[dev-ml-list]: https://maven.apache.org/mail-lists.html +[code-style]: https://maven.apache.org/developers/conventions/code.html +[cla]: https://www.apache.org/licenses/#clas +[maven-wiki]: https://cwiki.apache.org/confluence/display/MAVEN/Index +[test-results]: https://builds.apache.org/job/maven-box/job/maven-javadoc-plugin/job/master/lastCompletedBuild/testReport/ +[build]: https://builds.apache.org/job/maven-box/job/maven-javadoc-plugin/job/master/ diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/detectLinks/pom.xml maven-javadoc-plugin-3.0.1/src/it/projects/detectLinks/pom.xml --- maven-javadoc-plugin-3.0.0/src/it/projects/detectLinks/pom.xml 2017-11-04 11:01:38.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/detectLinks/pom.xml 2018-05-25 09:10:44.000000000 +0000 @@ -53,8 +53,9 @@ org.apache.maven - maven-script-marmalade - 2.0-beta-2 + maven-script + 2.2.1 + pom diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/detectLinks/verify.bsh maven-javadoc-plugin-3.0.1/src/it/projects/detectLinks/verify.bsh --- maven-javadoc-plugin-3.0.0/src/it/projects/detectLinks/verify.bsh 2017-11-04 11:01:38.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/detectLinks/verify.bsh 2018-05-25 09:10:44.000000000 +0000 @@ -69,7 +69,7 @@ System.err.println( "-link not added: " + options1 ); return false; } - if ( !contentOptions1.substring( link1 ).contains( "http://commons.apache.org/lang/apidocs" ) ) + if ( !contentOptions1.substring( link1 ).contains( "commons.apache.org" ) ) { System.err.println( "link for commons-lang not added: " + options1 ); if ( !log.contains( "Error fetching link: http://commons.apache.org/lang/apidocs" ) ) @@ -77,7 +77,7 @@ return false; } } - if ( !contentOptions1.substring( link1 ).contains( "http://junit.org/apidocs" ) ) + if ( !contentOptions1.substring( link1 ).contains( "junit.org" ) ) { System.err.println( "link for junit not added: " + options1 ); if ( !log.contains( "Error fetching link: http://junit.org/apidocs" ) ) @@ -108,7 +108,7 @@ System.err.println( "-link not added: " + options2 ); return false; } - if ( !contentOptions2.substring( link2 ).contains( "http://commons.apache.org/lang/apidocs" ) ) + if ( !contentOptions2.substring( link2 ).contains( "commons.apache.org" ) ) { System.err.println( "link for commons-lang not added: " + options2 ); if ( !log.contains( "Error fetching link: http://commons.apache.org/lang/apidocs" ) ) @@ -116,7 +116,7 @@ return false; } } - if ( !contentOptions2.substring( link2 ).contains( "http://junit.org/apidocs" ) ) + if ( !contentOptions2.substring( link2 ).contains( "junit.org" ) ) { System.err.println( "link for junit not added: " + options2 ); if ( !log.contains( "Error fetching link: http://junit.org/apidocs" ) ) diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-325/verify.bsh maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-325/verify.bsh --- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-325/verify.bsh 2017-11-04 11:01:38.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-325/verify.bsh 2018-05-25 09:10:44.000000000 +0000 @@ -30,7 +30,7 @@ } String optionsContent = FileUtils.fileRead( optionsFile ); -String javaApiLink = "'http://docs.oracle.com/javase/1,5,0/docs/api'"; +String javaApiLink = "'https://docs.oracle.com/javase/1.5.0/docs/api'"; if ( !optionsContent.contains( javaApiLink ) ) { diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/invoker.properties maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/invoker.properties --- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/invoker.properties 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/invoker.properties 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,21 @@ +# 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. + +invoker.goals=clean javadoc:javadoc + +# slf4j javadoc is hosted on https site with a "let's encrypt" certificate, signed by IdenTrust only trusted since 8u101 (JDK-8154757) +invoker.java.version = 1.8.0.101+ diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/pom.xml maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/pom.xml --- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/pom.xml 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,61 @@ + + + + + + + 4.0.0 + + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc-427 + 1.0-SNAPSHOT + jar + https://issues.apache.org/jira/browse/MJAVADOC-427 + Tests that the plugin follows redirects + + UTF-8 + + + + + + org.slf4j + slf4j-api + 1.7.12 + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + @pom.version@ + + true + + + + + + + diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/src/main/java/mjavadoc427/App.java maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/src/main/java/mjavadoc427/App.java --- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/src/main/java/mjavadoc427/App.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/src/main/java/mjavadoc427/App.java 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,35 @@ +package mjavadoc427; + +/* + * 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. + */ + +import org.slf4j.LoggerFactory; + +/** + * Link to slf4j {@link LoggerFactory}. + */ +public class App +{ + + public LoggerFactory getLoggerFactory() + { + return null; + } + +} diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/verify.groovy maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/verify.groovy --- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-427/verify.groovy 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-427/verify.groovy 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,26 @@ +/* + * 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. + */ + +def file = new File( basedir, 'target/site/apidocs/mjavadoc427/App.html' ); + +assert file.exists() + +// assert that javadoc of class correctly contains link, just like method details +assert file.text =~ /Link to slf4j LoggerFactory<\/code><\/a>/ +assert file.text =~ /
public.*?LoggerFactory<\/a>.*?getLoggerFactory.*?\(\)<\/pre>/
diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/invoker.properties maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/invoker.properties
--- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/invoker.properties	1970-01-01 00:00:00.000000000 +0000
+++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/invoker.properties	2018-05-25 09:10:44.000000000 +0000
@@ -0,0 +1,19 @@
+# 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.
+
+invoker.goals=clean javadoc:javadoc
+invoker.buildResult = failure
diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/pom.xml maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/pom.xml
--- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/pom.xml	1970-01-01 00:00:00.000000000 +0000
+++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/pom.xml	2018-05-25 09:10:44.000000000 +0000
@@ -0,0 +1,49 @@
+
+
+
+
+
+  4.0.0
+
+  org.apache.maven.plugins.maven-javadoc-plugin.it
+  mjavadoc-508
+  1.0-SNAPSHOT
+
+  
+    UTF-8
+  
+
+  
+    
+      
+        
+          org.apache.maven.plugins
+          maven-javadoc-plugin
+          @pom.version@
+          
+            true
+            true
+          
+        
+      
+    
+  
+
+
diff -Nru maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/src/main/java/foo/bar/ALotOfLinkTags.java maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/src/main/java/foo/bar/ALotOfLinkTags.java
--- maven-javadoc-plugin-3.0.0/src/it/projects/MJAVADOC-508/src/main/java/foo/bar/ALotOfLinkTags.java	1970-01-01 00:00:00.000000000 +0000
+++ maven-javadoc-plugin-3.0.1/src/it/projects/MJAVADOC-508/src/main/java/foo/bar/ALotOfLinkTags.java	2018-05-25 09:10:44.000000000 +0000
@@ -0,0 +1,37 @@
+package foo.bar;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.*;
+
+public class ALotOfLinkTags
+    implements Serializable
+{
+    public int field; // intentionally not marked @serial to cause a javadoc warning
+
+    /**
+     */
+    public boolean aMethod( String[] args )
+    {
+        return true;
+    }
+}
diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java
--- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java	2017-08-12 13:15:49.000000000 +0000
+++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java	2018-05-25 09:10:44.000000000 +0000
@@ -86,7 +86,7 @@
 
 /**
  * Abstract class to fix Javadoc documentation and tags in source files.
- * 
+ *
* See
Where Tags * Can Be Used. * @@ -3681,7 +3681,7 @@ */ private List unknownsTags; - public JavaEntityTags( JavaAnnotatedElement entity, boolean isJavaMethod ) + JavaEntityTags( JavaAnnotatedElement entity, boolean isJavaMethod ) { this.entity = entity; this.isJavaMethod = isJavaMethod; diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java 2017-12-03 16:02:59.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java 2018-05-25 09:10:44.000000000 +0000 @@ -19,49 +19,7 @@ * under the License. */ -import static org.apache.maven.plugins.javadoc.JavadocUtil.isEmpty; -import static org.apache.maven.plugins.javadoc.JavadocUtil.isNotEmpty; -import static org.apache.maven.plugins.javadoc.JavadocUtil.toList; -import static org.apache.maven.plugins.javadoc.JavadocUtil.toRelative; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Writer; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.apache.commons.lang3.ClassUtils; -import org.apache.commons.lang3.JavaVersion; -import org.apache.commons.lang3.SystemUtils; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; import org.apache.maven.artifact.handler.ArtifactHandler; @@ -126,6 +84,7 @@ import org.codehaus.plexus.languages.java.jpms.LocationManager; import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest; import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult; +import org.codehaus.plexus.languages.java.version.JavaVersion; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; @@ -137,6 +96,46 @@ import org.codehaus.plexus.util.cli.Commandline; import org.codehaus.plexus.util.xml.Xpp3Dom; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Writer; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static org.apache.maven.plugins.javadoc.JavadocUtil.toRelative; +import static org.apache.maven.plugins.javadoc.JavadocUtil.toList; +import static org.apache.maven.plugins.javadoc.JavadocUtil.isEmpty; +import static org.apache.maven.plugins.javadoc.JavadocUtil.isNotEmpty; + /** * Base class with majority of Javadoc functionalities. * @@ -256,7 +255,7 @@ * * @since 2.1 */ - private static final JavadocVersion SINCE_JAVADOC_1_4 = JavadocVersion.parse( "1.4" ); + private static final JavaVersion SINCE_JAVADOC_1_4 = JavaVersion.parse( "1.4" ); /** * For Javadoc options appears since Java 1.4.2. @@ -266,7 +265,7 @@ * * @since 2.1 */ - private static final JavadocVersion SINCE_JAVADOC_1_4_2 = JavadocVersion.parse( "1.4.2" ); + private static final JavaVersion SINCE_JAVADOC_1_4_2 = JavaVersion.parse( "1.4.2" ); /** * For Javadoc options appears since Java 5.0. @@ -276,7 +275,7 @@ * * @since 2.1 */ - private static final JavadocVersion SINCE_JAVADOC_1_5 = JavadocVersion.parse( "1.5" ); + private static final JavaVersion SINCE_JAVADOC_1_5 = JavaVersion.parse( "1.5" ); /** * For Javadoc options appears since Java 6.0. @@ -285,7 +284,7 @@ * * @since 2.4 */ - private static final JavadocVersion SINCE_JAVADOC_1_6 = JavadocVersion.parse( "1.6" ); + private static final JavaVersion SINCE_JAVADOC_1_6 = JavaVersion.parse( "1.6" ); /** * For Javadoc options appears since Java 8.0. @@ -294,13 +293,12 @@ * * @since 3.0.0 */ - private static final JavadocVersion SINCE_JAVADOC_1_8 = JavadocVersion.parse( "1.8" ); + private static final JavaVersion SINCE_JAVADOC_1_8 = JavaVersion.parse( "1.8" ); /** * */ - // JAVA_VERSION can have -ea suffix, which is not supported (yet) - private static final JavadocVersion JAVA_VERSION = JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ); + private static final JavaVersion JAVA_VERSION = JavaVersion.JAVA_SPECIFICATION_VERSION; // ---------------------------------------------------------------------- // Mojo components @@ -490,7 +488,7 @@ /** * Version of the Javadoc Tool executable to use. */ - private JavadocVersion javadocRuntimeVersion; + private JavaVersion javadocRuntimeVersion; /** * Specifies whether the Javadoc generation should be skipped. @@ -508,11 +506,20 @@ @Parameter( property = "maven.javadoc.failOnError", defaultValue = "true" ) protected boolean failOnError; + + /** + * Specifies if the build will fail if there are warning during javadoc execution or not. + * + * @since 3.0.1 + */ + @Parameter( property = "maven.javadoc.failOnWarnings", defaultValue = "false" ) + protected boolean failOnWarnings; + /** * Specifies to use the * * options provided by the Standard Doclet for a custom doclet. - *
+ *
* Example: *
      * <docletArtifacts>
@@ -1121,7 +1128,7 @@
 
     /**
      * Creates links to existing javadoc-generated documentation of external referenced classes.
-     * 
+ *
* Notes: *
    *
  1. only used if {@link #isOffline} is set to false.
  2. @@ -1281,9 +1288,8 @@ /** * Omits the class/interface hierarchy pages from the generated docs. - *
    - * See notree. - *
    + *
    + * @see notree option */ @Parameter( property = "notree", defaultValue = "false" ) private boolean notree; @@ -1307,18 +1313,16 @@ *
    * Note: if {@link #detectOfflineLinks} is defined, the offline links between the project modules are * automatically added if the goal is calling in a non-aggregator way. - *
    - * See Javadoc. - *
    + *
    + * @see Javadoc. */ @Parameter( property = "offlineLinks" ) private OfflineLink[] offlineLinks; /** * Specifies the destination directory where javadoc saves the generated HTML files. - *
    - * See d. - *
    + *
    + * @see d option */ @Parameter( property = "destDir", alias = "destDir", defaultValue = "${project.build.directory}/apidocs", required = true ) @@ -1339,8 +1343,7 @@ /** * Generates compile-time warnings for missing serial tags. *
    - * See serialwarn - *
    + * @see serialwarn option */ @Parameter( property = "serialwarn", defaultValue = "false" ) private boolean serialwarn; @@ -2223,7 +2226,7 @@ * * @return a Collection of the project absolute source paths as String * @throws MavenReportException {@link MavenReportException} - * @see JavadocUtil#pruneDirs(MavenProject, List) + * @see JavadocUtil#pruneDirs(MavenProject, Collection) */ protected Map> getSourcePaths() throws MavenReportException @@ -2325,7 +2328,7 @@ /** * Override this method to customize the configuration for resolving dependency sources. The default * behavior enables the resolution of -sources jar files. - * @param config {@linke SourceResolverConfig} + * @param config {@link SourceResolverConfig} * @return {@link SourceResolverConfig} */ protected SourceResolverConfig configureDependencySourceResolution( final SourceResolverConfig config ) @@ -2685,7 +2688,7 @@ /** * @param dependency {@link Dependency} * @return {@link Artifact} - * @throws MavenReportException + * @throws MavenReportException when artifact could not be resolved */ public Artifact resolveDependency( Dependency dependency ) throws MavenReportException @@ -3154,7 +3157,7 @@ links.addAll( getDependenciesLinks() ); - return links; + return followLinks( links ); } private Set collectGroups() @@ -3680,7 +3683,7 @@ } // For Apple's JDK 1.6.x (and older?) on Mac OSX // CHECKSTYLE_OFF: MagicNumber - else if ( SystemUtils.IS_OS_MAC_OSX && !SystemUtils.isJavaVersionAtLeast( JavaVersion.JAVA_1_7 ) ) + else if ( SystemUtils.IS_OS_MAC_OSX && !JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "1.7" ) ) // CHECKSTYLE_ON: MagicNumber { javadocExe = new File( SystemUtils.getJavaHome() + File.separator + "bin", javadocCommand ); @@ -3731,7 +3734,7 @@ private void setFJavadocVersion( File jExecutable ) throws MavenReportException { - JavadocVersion jVersion; + JavaVersion jVersion; try { jVersion = JavadocUtil.getJavadocVersion( jExecutable ); @@ -3768,14 +3771,14 @@ { try { - javadocRuntimeVersion = JavadocVersion.parse( javadocVersion ); + javadocRuntimeVersion = JavaVersion.parse( javadocVersion ); } catch ( NumberFormatException e ) { throw new MavenReportException( "Unable to parse javadoc version: " + e.getMessage(), e ); } - if ( javadocRuntimeVersion != jVersion && getLog().isWarnEnabled() ) + if ( javadocRuntimeVersion.compareTo( jVersion ) != 0 && getLog().isWarnEnabled() ) { getLog().warn( "Are you sure about the parameter? It seems to be " + jVersion ); } @@ -3793,7 +3796,7 @@ * @return true if the javadoc version is equal or greater than the * required version */ - private boolean isJavaDocVersionAtLeast( JavadocVersion requiredVersion ) + private boolean isJavaDocVersionAtLeast( JavaVersion requiredVersion ) { return JAVA_VERSION.compareTo( requiredVersion ) >= 0; } @@ -3825,7 +3828,7 @@ * @see #addArgIf(java.util.List, boolean, String) * @see #isJavaDocVersionAtLeast(float) */ - private void addArgIf( List arguments, boolean b, String value, JavadocVersion requiredJavaVersion ) + private void addArgIf( List arguments, boolean b, String value, JavaVersion requiredJavaVersion ) { if ( b ) { @@ -3876,7 +3879,7 @@ * @see #isJavaDocVersionAtLeast(float) */ private void addArgIfNotEmpty( List arguments, String key, String value, boolean repeatKey, - boolean splitValue, JavadocVersion requiredJavaVersion ) + boolean splitValue, JavaVersion requiredJavaVersion ) { if ( StringUtils.isNotEmpty( value ) ) { @@ -3969,7 +3972,7 @@ * @see #addArgIfNotEmpty(java.util.List, String, String, float, boolean) */ private void addArgIfNotEmpty( List arguments, String key, String value, - JavadocVersion requiredJavaVersion ) + JavaVersion requiredJavaVersion ) { addArgIfNotEmpty( arguments, key, value, requiredJavaVersion, false ); } @@ -3986,7 +3989,7 @@ * @see #addArgIfNotEmpty(java.util.List, String, String) * @see #isJavaDocVersionAtLeast(float) */ - private void addArgIfNotEmpty( List arguments, String key, String value, JavadocVersion requiredJavaVersion, + private void addArgIfNotEmpty( List arguments, String key, String value, JavaVersion requiredJavaVersion, boolean repeatKey ) { if ( StringUtils.isNotEmpty( value ) ) @@ -5321,6 +5324,11 @@ getLog().warn( current ); } } + + if ( StringUtils.isNotEmpty( err.getOutput() ) && failOnWarnings ) + { + throw new MavenReportException( "Project contains Javadoc Warnings" ); + } } /** @@ -5739,13 +5747,13 @@ } final String pluginId = "org.apache.maven.plugins:maven-compiler-plugin"; - JavadocVersion sourceVersion = javadocRuntimeVersion; + JavaVersion sourceVersion = javadocRuntimeVersion; String sourceConfigured = getPluginParameter( project, pluginId, "source" ); if ( sourceConfigured != null ) { try { - sourceVersion = JavadocVersion.parse( sourceConfigured ); + sourceVersion = JavaVersion.parse( sourceConfigured ); } catch ( NumberFormatException e ) { @@ -5825,6 +5833,31 @@ } /** + * Follows all of the given links, and returns their last redirect locations. Ordering is kept. + * This is necessary because javadoc tool doesn't follow links, see JDK-8190312 (MJAVADOC-427, MJAVADOC-487) + * + * @param links Links to follow. + * @return Last redirect location of all the links. + */ + private Set followLinks( Set links ) + { + Set redirectLinks = new LinkedHashSet<>( links.size() ); + for ( String link : links ) + { + try + { + redirectLinks.add( JavadocUtil.getRedirectUrl( new URI( link ).toURL(), settings ).toString() ); + } + catch ( Exception e ) + { + // only print in debug, it should have been logged already in warn/error because link isn't valid + getLog().debug( "Could not follow " + link + ". Reason: " + e.getMessage() ); + } + } + return redirectLinks; + } + + /** * @param link not null * @param detecting true if the link is generated by * detectLinks, or false otherwise diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java 2017-11-25 20:05:42.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java 2018-05-25 09:10:44.000000000 +0000 @@ -168,9 +168,9 @@ /** * {@inheritDoc} * - *
    + *
    * The logic is the following: - * + *
    * * * diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java 2017-12-02 13:36:33.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java 2018-05-25 09:10:44.000000000 +0000 @@ -19,7 +19,6 @@ * under the License. */ -import org.apache.commons.lang3.SystemUtils; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; @@ -29,6 +28,7 @@ import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.params.ClientPNames; +import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.conn.params.ConnRoutePNames; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.conn.PoolingClientConnectionManager; @@ -48,6 +48,7 @@ import org.apache.maven.shared.invoker.PrintStreamHandler; import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.proxy.ProxyUtils; +import org.codehaus.plexus.languages.java.version.JavaVersion; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; @@ -72,6 +73,7 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.Modifier; import java.net.SocketTimeoutException; +import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -106,12 +108,11 @@ /** 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: and -Xmx:."; + + "environnement variable using -Xms: and -Xmx:."; /** - * Method that removes the invalid directories in the specified directories. - * Note: All elements in dirs could be an absolute or relative against the project's base - * directory String path. + * Method that removes the invalid directories in the specified directories. Note: All elements in + * dirs could be an absolute or relative against the project's base directory String path. * * @param project the current Maven project not null * @param dirs the collection of String directories path that will be validated. @@ -143,8 +144,8 @@ } /** - * Method that removes the invalid files in the specified files. - * Note: All elements in files should be an absolute String path. + * Method that removes the invalid files in the specified files. Note: All elements in files + * should be an absolute String path. * * @param files the list of String files paths that will be validated. * @return a List of valid File objects. @@ -159,13 +160,14 @@ pruned.add( f ); } } - + return pruned; } /** - * Determine whether a file should be excluded from the provided list of paths, based on whether - * it exists and is already present in the list. + * Determine whether a file should be excluded from the provided list of paths, based on whether it exists and is + * already present in the list. + * * @param f The files. * @param pruned The list of pruned files.. * @return true if the file could be pruned false otherwise. @@ -180,16 +182,15 @@ return false; } } - + return true; } /** - * Method that gets all the source files to be excluded from the javadoc on the given - * source paths. + * 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 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 */ @@ -210,9 +211,8 @@ } /** - * Convenience method to wrap an argument value in single quotes (i.e. '). Intended for values - * which may contain whitespaces. - *
    + * Convenience method to wrap an argument value in single quotes (i.e. '). Intended for values which + * may contain whitespaces.
    * To prevent javadoc error, the line separator (i.e. \n) are skipped. * * @param value the argument value. @@ -238,8 +238,8 @@ } /** - * Convenience method to format a path argument so that it is properly interpreted by the javadoc tool. Intended - * for path values which may contain whitespaces. + * Convenience method to format a path argument so that it is properly interpreted by the javadoc tool. Intended for + * path values which may contain whitespaces. * * @param value the argument value. * @return path argument with quote @@ -275,8 +275,8 @@ } /** - * Convenience method that copy all doc-files directories from javadocDir - * to the outputDirectory. + * Convenience method that copy all doc-files directories from javadocDir to the + * outputDirectory. * * @param outputDirectory the output directory * @param javadocDir the javadoc directory @@ -315,8 +315,8 @@ FileUtils.mkdir( docFileOutput.getAbsolutePath() ); FileUtils.copyDirectoryStructure( new File( javadocDir, docFile ), docFileOutput ); List files = - FileUtils.getFileAndDirectoryNames( docFileOutput, StringUtils.join( excludes.iterator(), "," ), - null, true, true, true, true ); + FileUtils.getFileAndDirectoryNames( docFileOutput, StringUtils.join( excludes.iterator(), "," ), null, + true, true, true, true ); for ( String filename : files ) { File file = new File( filename ); @@ -334,11 +334,10 @@ } /** - * Method that gets the files or classes that would be included in the javadocs using the subpackages - * parameter. + * Method that gets the files or classes that would be included in the javadocs using the subpackages parameter. * * @param sourceDirectory the directory where the source files are located - * @param fileList the list of all files found in the sourceDirectory + * @param fileList the list of all files found in the sourceDirectory * @param excludePackages package names to be excluded in the javadoc * @return a StringBuilder that contains the appended file names of the files to be included in the javadoc */ @@ -409,10 +408,10 @@ } /** - * Method that gets the complete package names (including subpackages) of the packages that were defined - * in the excludePackageNames parameter. + * Method that gets the complete package names (including subpackages) of the packages that were defined in the + * excludePackageNames parameter. * - * @param sourceDirectory the directory where the source files are located + * @param sourceDirectory the directory where the source files are located * @param excludePackagenames package names to be excluded in the javadoc * @return a List of the packagenames to be excluded */ @@ -465,10 +464,8 @@ * @param sourceFileIncludes files to include. * @param sourceFileExcludes files to exclude. */ - protected static void addFilesFromSource( List files, File sourceDirectory, - List sourceFileIncludes, - List sourceFileExcludes, - String[] excludePackages ) + protected static void addFilesFromSource( List files, File sourceDirectory, List sourceFileIncludes, + List sourceFileExcludes, String[] excludePackages ) { DirectoryScanner ds = new DirectoryScanner(); if ( sourceFileIncludes == null ) @@ -490,8 +487,7 @@ pathList[x] = new File( sourceDirectory, fileList[x] ).getAbsolutePath(); } - - if ( pathList.length != 0 ) + if ( pathList.length != 0 ) { List tmpFiles = getIncludedFiles( sourceDirectory, pathList, excludePackages ); files.addAll( tmpFiles ); @@ -500,8 +496,9 @@ /** * Call the Javadoc tool and parse its output to find its version, i.e.: + * *
    -     * javadoc.exe(or .sh) -J-version
    +     * javadoc.exe( or.sh ) - J - version
          * 
    * * @param javadocExe not null file @@ -512,7 +509,7 @@ * @throws PatternSyntaxException if the output contains a syntax error in the regular-expression pattern. * @see #extractJavadocVersion(String) */ - protected static JavadocVersion getJavadocVersion( File javadocExe ) + protected static JavaVersion getJavadocVersion( File javadocExe ) throws IOException, CommandLineException, IllegalArgumentException { if ( ( javadocExe == null ) || ( !javadocExe.exists() ) || ( !javadocExe.isFile() ) ) @@ -525,8 +522,8 @@ cmd.setWorkingDirectory( javadocExe.getParentFile() ); cmd.createArg().setValue( "-J-version" ); - CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer(); - CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer(); + CommandLineUtils.StringStreamConsumer out = new JavadocOutputStreamConsumer(); + CommandLineUtils.StringStreamConsumer err = new JavadocOutputStreamConsumer(); int exitCode = CommandLineUtils.executeCommandLine( cmd, out, err ); @@ -540,55 +537,54 @@ if ( StringUtils.isNotEmpty( err.getOutput() ) ) { - return JavadocVersion.parse( extractJavadocVersion( err.getOutput() ) ); + return JavaVersion.parse( extractJavadocVersion( err.getOutput() ) ); } else if ( StringUtils.isNotEmpty( out.getOutput() ) ) { - return JavadocVersion.parse( extractJavadocVersion( out.getOutput() ) ); + return JavaVersion.parse( extractJavadocVersion( out.getOutput() ) ); } throw new IllegalArgumentException( "No output found from the command line 'javadoc -J-version'" ); } /** - * Parse the output for 'javadoc -J-version' and return the javadoc version recognized. - *
    + * Parse the output for 'javadoc -J-version' and return the javadoc version recognized.
    * Here are some output for 'javadoc -J-version' depending the JDK used: - *
    isAggregator
    + *
    * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * *
    JDKOutput for 'javadoc -J-version'JDKOutput for 'javadoc -J-version'
    Sun 1.4java full version "1.4.2_12-b03"Sun 1.4java full version "1.4.2_12-b03"
    Sun 1.5java full version "1.5.0_07-164"Sun 1.5java full version "1.5.0_07-164"
    IBM 1.4javadoc full version "J2RE 1.4.2 IBM Windows 32 build cn1420-20040626"IBM 1.4javadoc full version "J2RE 1.4.2 IBM Windows 32 build cn1420-20040626"
    IBM 1.5 (French JVM)javadoc version complète de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a"IBM 1.5 (French JVM)javadoc version complète de "J2RE 1.5.0 IBM Windows 32 build pwi32pdev-20070426a"
    FreeBSD 1.5java full version "diablo-1.5.0-b01"FreeBSD 1.5java full version "diablo-1.5.0-b01"
    BEA jrockit 1.5java full version "1.5.0_11-b03"BEA jrockit 1.5java full version "1.5.0_11-b03"
    * * @param output for 'javadoc -J-version' * @return the version of the javadoc for the output, only digits and dots * @throws PatternSyntaxException if the output doesn't match with the output pattern - * (?s).*?[^a-zA-Z]([0-9]+\\.?[0-9]*)(\\.([0-9]+))?.*. + * (?s).*?[^a-zA-Z]([0-9]+\\.?[0-9]*)(\\.([0-9]+))?.*. * @throws IllegalArgumentException if the output is null */ protected static String extractJavadocVersion( String output ) @@ -612,32 +608,31 @@ } /** - * Parse a memory string which be used in the JVM arguments -Xms or -Xmx. - *
    + * Parse a memory string which be used in the JVM arguments -Xms or -Xmx.
    * Here are some supported memory string depending the JDK used: - * + *
    * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * *
    JDKMemory argument support for -Xms or -XmxJDKMemory argument support for -Xms or -Xmx
    SUN1024k | 128m | 1g | 1tSUN1024k | 128m | 1g | 1t
    IBM1024k | 1024b | 128m | 128mb | 1g | 1gbIBM1024k | 1024b | 128m | 128mb | 1g | 1gb
    BEA1024k | 1024kb | 128m | 128mb | 1g | 1gbBEA1024k | 1024kb | 128m | 128mb | 1g | 1gb
    * * @param memory the memory to be parsed, not null. - * @return the memory parsed with a supported unit. If no unit specified in the memory parameter, - * the default unit is m. The units g | gb or t | tb will be converted - * in m. + * @return the memory parsed with a supported unit. If no unit specified in the memory parameter, the + * default unit is m. The units g | gb or t | tb will be converted in + * m. * @throws IllegalArgumentException if the memory parameter is null or doesn't match any pattern. */ protected static String parseJavadocMemory( String memory ) @@ -720,8 +715,8 @@ } /** - * For security reasons, if an active proxy is defined and needs an authentication by - * username/password, hide the proxy password in the command line. + * For security reasons, if an active proxy is defined and needs an authentication by username/password, hide the + * proxy password in the command line. * * @param cmdLine a command line, not null * @param settings the user settings @@ -755,16 +750,15 @@ } /** - * Auto-detect the class names of the implementation of com.sun.tools.doclets.Taglet class from a - * given jar file. - *
    + * Auto-detect the class names of the implementation of com.sun.tools.doclets.Taglet class from a given + * jar file.
    * Note: JAVA_HOME/lib/tools.jar is a requirement to find * com.sun.tools.doclets.Taglet class. * * @param jarFile not null * @return the list of com.sun.tools.doclets.Taglet class names from a given jarFile. - * @throws IOException if jarFile is invalid or not found, or if the JAVA_HOME/lib/tools.jar - * is not found. + * @throws IOException if jarFile is invalid or not found, or if the JAVA_HOME/lib/tools.jar is not + * found. * @throws ClassNotFoundException if any * @throws NoClassDefFoundError if any */ @@ -788,8 +782,8 @@ List tagletClasses = new ArrayList<>(); Class tagletClass; - - try + + try { tagletClass = cl.loadClass( "com.sun.tools.doclets.Taglet" ); } @@ -797,7 +791,7 @@ { tagletClass = cl.loadClass( "jdk.javadoc.doclet.Taglet" ); } - + for ( String s : classes ) { Class c = cl.loadClass( s ); @@ -864,9 +858,8 @@ } /** - * Invoke Maven for the given project file with a list of goals and properties, the output will be in the - * invokerlog file. - *
    + * Invoke Maven for the given project file with a list of goals and properties, the output will be in the invokerlog + * file.
    * Note: the Maven Home should be defined in the maven.home Java system property or defined in * M2_HOME system env variables. * @@ -904,9 +897,8 @@ String mavenHome = getMavenHome( log ); if ( StringUtils.isEmpty( mavenHome ) ) { - String msg = - "Could NOT invoke Maven because no Maven Home is defined. You need to have set the M2_HOME " - + "system env variable or a maven.home Java system properties."; + String msg = "Could NOT invoke Maven because no Maven Home is defined. You need to have set the M2_HOME " + + "system env variable or a maven.home Java system properties."; if ( log != null ) { log.error( msg ); @@ -956,9 +948,8 @@ String invokerLogContent = readFile( invokerLog, "UTF-8" ); // see DefaultMaven - if ( invokerLogContent != null - && ( !invokerLogContent.contains( "Scanning for projects..." ) - || invokerLogContent.contains( OutOfMemoryError.class.getName() ) ) ) + if ( invokerLogContent != null && ( !invokerLogContent.contains( "Scanning for projects..." ) + || invokerLogContent.contains( OutOfMemoryError.class.getName() ) ) ) { if ( log != null ) { @@ -978,9 +969,8 @@ String invokerLogContent = readFile( invokerLog, "UTF-8" ); // see DefaultMaven - if ( invokerLogContent != null - && ( !invokerLogContent.contains( "Scanning for projects..." ) - || invokerLogContent.contains( OutOfMemoryError.class.getName() ) ) ) + if ( invokerLogContent != null && ( !invokerLogContent.contains( "Scanning for projects..." ) + || invokerLogContent.contains( OutOfMemoryError.class.getName() ) ) ) { throw new MavenInvocationException( ERROR_INIT_VM ); } @@ -1012,8 +1002,8 @@ } /** - * Split the given path with colon and semi-colon, to support Solaris and Windows path. - * Examples: + * Split the given path with colon and semi-colon, to support Solaris and Windows path. Examples: + * *
          * splitPath( "/home:/tmp" )     = ["/home", "/tmp"]
          * splitPath( "/home;/tmp" )     = ["/home", "/tmp"]
    @@ -1021,8 +1011,8 @@
          * splitPath( "C:/home;C:/tmp" ) = ["C:/home", "C:/tmp"]
          * 
    * - * @param path which can contain multiple paths separated with a colon (:) or a - * semi-colon (;), platform independent. Could be null. + * @param path which can contain multiple paths separated with a colon (:) or a semi-colon + * (;), platform independent. Could be null. * @return the path splitted by colon or semi-colon or null if path was null. * @since 2.6.1 */ @@ -1044,17 +1034,17 @@ } /** - * Unify the given path with the current System path separator, to be platform independent. - * Examples: + * Unify the given path with the current System path separator, to be platform independent. Examples: + * *
          * unifyPathSeparator( "/home:/tmp" ) = "/home:/tmp" (Solaris box)
          * unifyPathSeparator( "/home:/tmp" ) = "/home;/tmp" (Windows box)
          * 
    * - * @param path which can contain multiple paths by separating them with a colon (:) or a - * semi-colon (;), platform independent. Could be null. + * @param path which can contain multiple paths by separating them with a colon (:) or a semi-colon + * (;), platform independent. Could be null. * @return the same path but separated with the current System path separator or null if path was - * null. + * null. * @since 2.6.1 * @see #splitPath(String) * @see File#pathSeparator @@ -1093,8 +1083,8 @@ { jarStream = new JarInputStream( new FileInputStream( jarFile ) ); - for ( JarEntry jarEntry = jarStream.getNextJarEntry(); jarEntry != null; - jarEntry = jarStream.getNextJarEntry() ) + for ( JarEntry jarEntry = jarStream.getNextJarEntry(); jarEntry != null; jarEntry = + jarStream.getNextJarEntry() ) { if ( jarEntry.getName().toLowerCase( Locale.ENGLISH ).endsWith( ".class" ) ) { @@ -1146,7 +1136,7 @@ { if ( !invokerLog.exists() ) { - //noinspection ResultOfMethodCallIgnored + // noinspection ResultOfMethodCallIgnored invokerLog.getParentFile().mkdirs(); } os = new FileOutputStream( invokerLog ); @@ -1209,8 +1199,8 @@ /** * @param log a logger could be null - * @return the Maven home defined in the maven.home system property or defined - * in M2_HOME system env variables or null if never set. + * @return the Maven home defined in the maven.home system property or defined in M2_HOME + * system env variables or null if never set. * @since 2.6 */ private static String getMavenHome( Log log ) @@ -1236,9 +1226,8 @@ { if ( log != null && log.isErrorEnabled() ) { - log - .error( "Cannot find Maven application directory. Either specify \'maven.home\' system property, or " - + "M2_HOME environment variable." ); + log.error( "Cannot find Maven application directory. Either specify \'maven.home\' system property, or " + + "M2_HOME environment variable." ); } } @@ -1270,44 +1259,45 @@ /** * @param log a logger could be null - * @return the JAVA_HOME from System.getProperty( "java.home" ) - * By default, System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME - * should be in the JDK_HOME + * @return the JAVA_HOME from System.getProperty( "java.home" ) By default, + * System.getProperty( "java.home" ) = JRE_HOME and JRE_HOME should be in the + * JDK_HOME * @since 2.6 */ private static File getJavaHome( Log log ) { File javaHome = null; + String javaHomeValue = null; + try + { + javaHomeValue = CommandLineUtils.getSystemEnvVars().getProperty( "JAVA_HOME" ); + } + catch ( IOException e ) + { + if ( log != null && log.isDebugEnabled() ) + { + log.debug( "IOException: " + e.getMessage() ); + } + } + // if maven.home is set, we can assume JAVA_HOME must be used for testing - - if ( System.getProperty( "maven.home" ) == null ) + if ( System.getProperty( "maven.home" ) == null || javaHomeValue == null ) { // JEP220 (Java9) restructured the JRE/JDK runtime image - if ( ( SystemUtils.IS_OS_MAC_OSX - || JavadocVersion.parse( SystemUtils.JAVA_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) ) + if ( SystemUtils.IS_OS_MAC_OSX || JavaVersion.JAVA_VERSION.isAtLeast( "9" ) ) { javaHome = SystemUtils.getJavaHome(); } else { javaHome = new File( SystemUtils.getJavaHome(), ".." ); - } + } } if ( javaHome == null || !javaHome.exists() ) { - try - { - javaHome = new File( CommandLineUtils.getSystemEnvVars().getProperty( "JAVA_HOME" ) ); - } - catch ( IOException e ) - { - if ( log != null && log.isDebugEnabled() ) - { - log.debug( "IOException: " + e.getMessage() ); - } - } + javaHome = new File( javaHomeValue ); } if ( javaHome == null || !javaHome.exists() ) @@ -1346,14 +1336,11 @@ } /** - * A Path tokenizer takes a path and returns the components that make up - * that path. - * - * The path can use path separators of either ':' or ';' and file separators - * of either '/' or '\'. + * A Path tokenizer takes a path and returns the components that make up that path. The path can use path separators + * of either ':' or ';' and file separators of either '/' or '\'. * - * @version revision 439418 taken on 2009-09-12 from Ant Project - * (see http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/PathTokenizer.java) + * @version revision 439418 taken on 2009-09-12 from Ant Project (see + * http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/ant/PathTokenizer.java) */ private static class PathTokenizer { @@ -1363,21 +1350,18 @@ private StringTokenizer tokenizer; /** - * A String which stores any path components which have been read ahead - * due to DOS filesystem compensation. + * A String which stores any path components which have been read ahead due to DOS filesystem compensation. */ private String lookahead = null; /** - * A boolean that determines if we are running on Novell NetWare, which - * exhibits slightly different path name characteristics (multi-character - * volume / drive names) + * A boolean that determines if we are running on Novell NetWare, which exhibits slightly different path name + * characteristics (multi-character volume / drive names) */ private boolean onNetWare = Os.isFamily( "netware" ); /** - * Flag to indicate whether or not we are running on a platform with a - * DOS style filesystem + * Flag to indicate whether or not we are running on a platform with a DOS style filesystem */ private boolean dosStyleFilesystem; @@ -1386,7 +1370,7 @@ * * @param path The path to tokenize. Must not be null. */ - public PathTokenizer( String path ) + PathTokenizer( String path ) { if ( onNetWare ) { @@ -1404,12 +1388,11 @@ } /** - * Tests if there are more path elements available from this tokenizer's - * path. If this method returns true, then a subsequent call - * to nextToken will successfully return a token. + * Tests if there are more path elements available from this tokenizer's path. If this method returns + * true, then a subsequent call to nextToken will successfully return a token. * - * @return true if and only if there is at least one token - * in the string after the current position; false otherwise. + * @return true if and only if there is at least one token in the string after the current + * position; false otherwise. */ public boolean hasMoreTokens() { @@ -1421,9 +1404,7 @@ * Returns the next path element from this tokenizer. * * @return the next path element from this tokenizer. - * - * @exception NoSuchElementException if there are no more elements in this - * tokenizer's path. + * @exception NoSuchElementException if there are no more elements in this tokenizer's path. */ public String nextToken() throws NoSuchElementException @@ -1510,19 +1491,38 @@ return token; } } - + + /** + * Ignores line like 'Picked up JAVA_TOOL_OPTIONS: ...' as can happen on CI servers. + * + * @author Robert Scholte + * @since 3.0.1 + */ + private static class JavadocOutputStreamConsumer + extends CommandLineUtils.StringStreamConsumer + { + @Override + public void consumeLine( String line ) + { + if ( !line.startsWith( "Picked up " ) ) + { + super.consumeLine( line ); + } + } + } + static List toList( String src ) { return toList( src, null, null ); } - + static List toList( String src, String elementPrefix, String elementSuffix ) { if ( StringUtils.isEmpty( src ) ) { return null; } - + List result = new ArrayList<>(); StringTokenizer st = new StringTokenizer( src, "[,:;]" ); @@ -1534,46 +1534,46 @@ { sb.append( elementPrefix ); } - + sb.append( st.nextToken() ); - + if ( StringUtils.isNotEmpty( elementSuffix ) ) { sb.append( elementSuffix ); } - + result.add( sb.toString() ); } - + return result; } - + static List toList( T[] multiple ) { return toList( null, multiple ); } - + static List toList( T single, T[] multiple ) { if ( single == null && ( multiple == null || multiple.length < 1 ) ) { return null; } - + List result = new ArrayList<>(); if ( single != null ) { result.add( single ); } - + if ( multiple != null && multiple.length > 0 ) { result.addAll( Arrays.asList( multiple ) ); } - + return result; } - + // TODO: move to plexus-utils or use something appropriate from there public static String toRelative( File basedir, String absolutePath ) { @@ -1601,17 +1601,21 @@ return relative; } - + /** * Convenience method to determine that a collection is not empty or null. + * @param collection the collection to verify + * @return {@code true} if not {@code null} and not empty, otherwise {@code false} */ public static boolean isNotEmpty( final Collection collection ) { return collection != null && !collection.isEmpty(); } - + /** * Convenience method to determine that a collection is empty or null. + * @param collection the collection to verify + * @return {@code true} if {@code null} or empty, otherwise {@code false} */ public static boolean isEmpty( final Collection collection ) { @@ -1619,20 +1623,59 @@ } /** + * Execute an Http request at the given URL, follows redirects, and returns the last redirect locations. For URLs + * that aren't http/https, this does nothing and simply returns the given URL unchanged. + * + * @param url URL. + * @param settings Maven settings. + * @return Last redirect location. + * @throws IOException if there was an error during the Http request. + */ + protected static URL getRedirectUrl( URL url, Settings settings ) + throws IOException + { + String protocol = url.getProtocol(); + if ( !"http".equals( protocol ) && !"https".equals( protocol ) ) + { + return url; + } + HttpClient httpClient = null; + try + { + httpClient = createHttpClient( settings, url ); + HttpClientContext httpContext = HttpClientContext.create(); + HttpGet httpMethod = new HttpGet( url.toString() ); + HttpResponse response = httpClient.execute( httpMethod, httpContext ); + int status = response.getStatusLine().getStatusCode(); + if ( status != HttpStatus.SC_OK ) + { + throw new FileNotFoundException( "Unexpected HTTP status code " + status + " getting resource " + + url.toExternalForm() + "." ); + } + + List redirects = httpContext.getRedirectLocations(); + return redirects.isEmpty() ? url : redirects.get( redirects.size() - 1 ).toURL(); + } + finally + { + if ( httpClient != null ) + { + httpClient.getConnectionManager().shutdown(); + } + } + } + + /** * Validates an URL to point to a valid package-list resource. * * @param url The URL to validate. * @param settings The user settings used to configure the connection to the URL or {@code null}. * @param validateContent true to validate the content of the package-list resource; - * false to only check the existence of the package-list resource. - * + * false to only check the existence of the package-list resource. * @return true if url points to a valid package-list resource; - * false else. - * + * false else. * @throws IOException if reading the resource fails. - * * @see #createHttpClient(org.apache.maven.settings.Settings, java.net.URL) - * * @since 2.8 */ protected static boolean isValidPackageList( URL url, Settings settings, boolean validateContent ) @@ -1674,8 +1717,8 @@ int status = response.getStatusLine().getStatusCode(); if ( status != HttpStatus.SC_OK ) { - throw new FileNotFoundException( - "Unexpected HTTP status code " + status + " getting resource " + url.toExternalForm() + "." ); + throw new FileNotFoundException( "Unexpected HTTP status code " + status + " getting resource " + + url.toExternalForm() + "." ); } // Intentionally using the platform default encoding here since this is what Javadoc uses internally. @@ -1758,9 +1801,7 @@ * * @param settings The settings to use for setting up the client or {@code null}. * @param url The {@code URL} to use for setting up the client or {@code null}. - * * @return A new {@code HttpClient} instance. - * * @see #DEFAULT_TIMEOUT * @since 2.8 */ @@ -1783,7 +1824,7 @@ proxyInfo.setNonProxyHosts( activeProxy.getNonProxyHosts() ); if ( StringUtils.isNotEmpty( activeProxy.getHost() ) - && ( url == null || !ProxyUtils.validateNonProxyHosts( proxyInfo, url.getHost() ) ) ) + && ( url == null || !ProxyUtils.validateNonProxyHosts( proxyInfo, url.getHost() ) ) ) { HttpHost proxy = new HttpHost( activeProxy.getHost(), activeProxy.getPort() ); httpClient.getParams().setParameter( ConnRoutePNames.DEFAULT_PROXY, proxy ); diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocVersion.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocVersion.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/JavadocVersion.java 2017-07-12 19:59:51.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/JavadocVersion.java 2018-05-25 09:10:44.000000000 +0000 @@ -30,7 +30,9 @@ * * @author Robert Scholte * @since 3.0.0 + * @deprecated Use {@link org.codehaus.plexus.languages.java.version.JavaVersion} instead */ +@Deprecated public class JavadocVersion implements Comparable { private String rawVersion; diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/resolver/SourceResolverConfig.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/resolver/SourceResolverConfig.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/resolver/SourceResolverConfig.java 2017-07-12 22:30:43.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/resolver/SourceResolverConfig.java 2018-05-25 09:10:44.000000000 +0000 @@ -47,7 +47,7 @@ /** * @param project {@link MavenProject} - * @param buoildingRequest {@link ProjectBuildingRequest} + * @param buildingRequest {@link ProjectBuildingRequest} * @param outputBasedir The output base directory. */ public SourceResolverConfig( final MavenProject project, final ProjectBuildingRequest buildingRequest, @@ -59,7 +59,7 @@ } /** - * @param filter {@link ArtifactFilter} + * @param filter {@link AndFilter} * @return {@link SourceResolverConfig} */ public SourceResolverConfig withFilter( final AndFilter filter ) @@ -131,7 +131,7 @@ } /** - * @return {@link TransformableFilter} + * @return {@link AndFilter} */ public AndFilter filter() { diff -Nru maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/SystemUtils.java maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/SystemUtils.java --- maven-javadoc-plugin-3.0.0/src/main/java/org/apache/maven/plugins/javadoc/SystemUtils.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/java/org/apache/maven/plugins/javadoc/SystemUtils.java 2018-05-25 09:10:44.000000000 +0000 @@ -0,0 +1,181 @@ +package org.apache.maven.plugins.javadoc; + +/* + * 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. + */ + +import java.io.File; + +/** + * Contains several OS-specific methods from Commons-Lang3's SystemUtils. We don't want to use that class because it + * uses enums for Java versions, which implies that with every new Java version a new commons-lang3 is required. + * + * @author Robert Scholte + * @since 3.0.1 + */ +class SystemUtils +{ + /** + *

    + * The {@code os.name} System Property. Operating system name. + *

    + *

    + * Defaults to {@code null} if the runtime does not have security access to read this property or the property does + * not exist. + *

    + *

    + * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or + * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of + * sync with that System property. + *

    + * + * @since Java 1.1 + */ + public static final String OS_NAME = getSystemProperty( "os.name" ); + + /** + * The prefix String for all Windows OS. + */ + private static final String OS_NAME_WINDOWS_PREFIX = "Windows"; + + /** + *

    + * Is {@code true} if this is AIX. + *

    + *

    + * The field will return {@code false} if {@code OS_NAME} is {@code null}. + *

    + */ + public static final boolean IS_OS_AIX = getOSMatchesName( "AIX" ); + + /** + *

    + * Is {@code true} if this is Mac. + *

    + *

    + * The field will return {@code false} if {@code OS_NAME} is {@code null}. + *

    + */ + public static final boolean IS_OS_MAC_OSX = getOSMatchesName( "Mac OS X" ); + + /** + *

    + * Is {@code true} if this is Windows. + *

    + *

    + * The field will return {@code false} if {@code OS_NAME} is {@code null}. + *

    + */ + public static final boolean IS_OS_WINDOWS = getOSMatchesName( OS_NAME_WINDOWS_PREFIX ); + + /** + * The System property key for the Java home directory. + */ + private static final String JAVA_HOME_KEY = "java.home"; + + /** + *

    + * The {@code line.separator} System Property. Line separator ("\n" on UNIX). + *

    + *

    + * Defaults to {@code null} if the runtime does not have security access to read this property or the property does + * not exist. + *

    + *

    + * This value is initialized when the class is loaded. If {@link System#setProperty(String,String)} or + * {@link System#setProperties(java.util.Properties)} is called after this class is loaded, the value will be out of + * sync with that System property. + *

    + * + * @since Java 1.1 + */ + public static final String LINE_SEPARATOR = getSystemProperty( "line.separator" ); + + /** + * Decides if the operating system matches. + * + * @param osNamePrefix the prefix for the os name + * @return true if matches, or false if not or can't determine + */ + private static boolean getOSMatchesName( final String osNamePrefix ) + { + return isOSNameMatch( OS_NAME, osNamePrefix ); + } + + /** + * Decides if the operating system matches. + *

    + * This method is package private instead of private to support unit test invocation. + *

    + * + * @param osName the actual OS name + * @param osNamePrefix the prefix for the expected OS name + * @return true if matches, or false if not or can't determine + */ + static boolean isOSNameMatch( final String osName, final String osNamePrefix ) + { + if ( osName == null ) + { + return false; + } + return osName.startsWith( osNamePrefix ); + } + + /** + *

    + * Gets the Java home directory as a {@code File}. + *

    + * + * @return a directory + * @throws SecurityException if a security manager exists and its {@code checkPropertyAccess} method doesn't allow + * access to the specified system property. + * @see System#getProperty(String) + * @since 2.1 + */ + public static File getJavaHome() + { + return new File( System.getProperty( JAVA_HOME_KEY ) ); + } + + /** + *

    + * Gets a System property, defaulting to {@code null} if the property cannot be read. + *

    + *

    + * If a {@code SecurityException} is caught, the return value is {@code null} and a message is written to + * {@code System.err}. + *

    + * + * @param property the system property name + * @return the system property value or {@code null} if a security problem occurs + */ + private static String getSystemProperty( final String property ) + { + try + { + return System.getProperty( property ); + } + catch ( final SecurityException ex ) + { + // we are not allowed to look at this property + System.err.println( "Caught a SecurityException reading the system property '" + property + + "'; the SystemUtils property value will default to null." ); + return null; + } + } +} diff -Nru maven-javadoc-plugin-3.0.0/src/main/mdo/javadocOptions.mdo maven-javadoc-plugin-3.0.1/src/main/mdo/javadocOptions.mdo --- maven-javadoc-plugin-3.0.0/src/main/mdo/javadocOptions.mdo 2017-07-12 19:59:51.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/main/mdo/javadocOptions.mdo 2018-05-25 09:10:44.000000000 +0000 @@ -19,9 +19,9 @@ under the License. --> - javadocoptions diff -Nru maven-javadoc-plugin-3.0.0/src/site/xdoc/download.xml.vm maven-javadoc-plugin-3.0.1/src/site/xdoc/download.xml.vm --- maven-javadoc-plugin-3.0.0/src/site/xdoc/download.xml.vm 2015-06-19 22:37:34.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/site/xdoc/download.xml.vm 2018-05-25 09:10:44.000000000 +0000 @@ -108,7 +108,7 @@ ${project.name} ${project.version} (Source zip) maven/plugins/${project.artifactId}-${project.version}-source-release.zip - maven/plugins/${project.artifactId}-${project.version}-source-release.zip.md5 + maven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha1 maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc diff -Nru maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java --- maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java 2017-12-03 16:02:59.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java 2018-05-25 09:10:44.000000000 +0000 @@ -28,12 +28,12 @@ import java.util.List; import java.util.Properties; -import org.apache.commons.lang3.SystemUtils; import org.apache.maven.plugin.logging.Log; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.plugins.javadoc.AbstractFixJavadocMojo.JavaEntityTags; import org.apache.maven.shared.invoker.MavenInvocationException; +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; @@ -150,7 +150,7 @@ { // Should be an assumption, but not supported by TestCase // Java 5 not supported by Java9 anymore - if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "9" ) ) { return; } @@ -464,9 +464,6 @@ assertTrue( withoutEmptyJavadocLines.endsWith( "any" ) ); } - /** - * @throws Throwable if any - */ public void testJavadocCommentJdk5() throws Exception { @@ -649,11 +646,9 @@ invokerDir.mkdirs(); File invokerLogFile = FileUtils.createTempFile( "FixJavadocMojoTest", ".txt", invokerDir ); - JavadocVersion JAVA_9 = JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ); - Properties properties = new Properties(); - if( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JAVA_9 ) >= 0 ) + if( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "9" ) ) { properties.put( "maven.compiler.source", "1.6" ); properties.put( "maven.compiler.target", "1.6" ); diff -Nru maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java --- maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java 2017-12-03 16:02:59.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocJarTest.java 2018-05-25 09:10:44.000000000 +0000 @@ -33,10 +33,8 @@ import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.plugins.javadoc.AbstractJavadocMojo; -import org.apache.maven.plugins.javadoc.JavadocJar; -import org.apache.maven.plugins.javadoc.JavadocVersion; import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.languages.java.version.JavaVersion; import org.codehaus.plexus.util.FileUtils; /** @@ -96,12 +94,12 @@ } assertTrue( set.contains( "stylesheet.css" ) ); - JavadocVersion javadocVersion = (JavadocVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" ); - if ( javadocVersion.compareTo( JavadocVersion.parse( "1.7" ) ) < 0 ) + JavaVersion javadocVersion = (JavaVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" ); + if ( javadocVersion.isBefore( "1.7" ) ) { assertTrue( set.contains( "resources/inherit.gif" ) ); } - else if ( javadocVersion.compareTo( JavadocVersion.parse( "1.8" ) ) < 0 ) + else if ( javadocVersion.isBefore( "1.8" ) ) { assertTrue( set.contains( "resources/background.gif" ) /* JDK7 */); } diff -Nru maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java --- maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java 2017-12-03 16:02:59.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java 2018-05-25 09:10:44.000000000 +0000 @@ -27,11 +27,12 @@ import java.io.FileReader; import java.io.IOException; import java.io.Reader; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.SystemUtils; import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.LegacySupport; @@ -45,6 +46,7 @@ import org.apache.maven.repository.internal.MavenRepositorySystemSession; import org.apache.maven.settings.Proxy; 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; @@ -228,7 +230,15 @@ File generatedFile = new File( apidocs, "def/configuration/App.html" ); assertTrue( generatedFile.exists() ); - assertTrue( FileUtils.fileRead( generatedFile, "UTF-8" ).contains( "/docs/api/java/lang/Object.html" ) ); + + // only test when URL can be reached + String url = JavadocReport.DEFAULT_JAVA_API_LINKS.getProperty( "api_9" ); + HttpURLConnection connection = (HttpURLConnection) new URL( url ).openConnection(); + connection.setRequestMethod( "HEAD" ); + if ( connection.getResponseCode() == 200 ) + { + assertTrue( FileUtils.fileRead( generatedFile, "UTF-8" ).contains( "/docs/api/java/lang/Object.html" ) ); + } assertTrue( new File( apidocs, "def/configuration/AppSample.html" ).exists() ); assertTrue( new File( apidocs, "def/configuration/package-frame.html" ).exists() ); @@ -305,7 +315,7 @@ { // Should be an assumption, but not supported by TestCase // Seems like a bug in Javadoc 9 - if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) == 0 ) + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.compareTo( JavaVersion.parse( "9" ) ) == 0 ) { return; } @@ -568,7 +578,7 @@ { // Should be an assumption, but not supported by TestCase // Java 5 not supported by Java9 anymore - if ( JavadocVersion.parse( SystemUtils.JAVA_SPECIFICATION_VERSION ).compareTo( JavadocVersion.parse( "9" ) ) >= 0 ) + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isAtLeast( "9" ) ) { return; } @@ -650,11 +660,12 @@ content = readFile( app ); assertTrue( content.contains( "\"Maven\"" ) ); - JavadocVersion javadocVersion = (JavadocVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" ); - if( javadocVersion.compareTo( JavadocVersion.parse( "1.8" ) ) >= 0 && javadocVersion.compareTo( JavadocVersion.parse( "10" ) ) < 0) + JavaVersion javadocVersion = (JavaVersion) getVariableValueFromObject( mojo, "javadocRuntimeVersion" ); + if( javadocVersion.isAtLeast( "1.8" ) && javadocVersion.isBefore( "10" ) ) { // https://bugs.openjdk.java.net/browse/JDK-8032205 - assertTrue( "This bug appeared in JDK8 and was planned to be fixed in JDK9, see JDK-8032205", + assertTrue( "Javadoc runtime version: " + javadocVersion + + "\nThis bug appeared in JDK8 and was planned to be fixed in JDK9, see JDK-8032205", new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); } else diff -Nru maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java --- maven-javadoc-plugin-3.0.0/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java 2017-11-24 14:19:34.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java 2018-05-25 09:10:44.000000000 +0000 @@ -22,7 +22,9 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.OutputStream; import java.net.SocketTimeoutException; +import java.net.URI; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -32,6 +34,10 @@ import java.util.Set; import java.util.regex.PatternSyntaxException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +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; @@ -39,6 +45,10 @@ import org.apache.maven.settings.Settings; import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.util.FileUtils; +import org.mortbay.jetty.Server; +import org.mortbay.jetty.handler.AbstractHandler; +import org.mortbay.jetty.handler.MovedContextHandler; +import org.mortbay.util.ByteArrayISO8859Writer; /** * @author Vincent Siveton @@ -507,6 +517,65 @@ } } + public void testGetRedirectUrlNotHttp() + throws Exception + { + URL url = new URI( "ftp://some.where" ).toURL(); + assertEquals( url.toString(), JavadocUtil.getRedirectUrl( url, new Settings() ).toString() ); + + url = new URI( "file://some/where" ).toURL(); + assertEquals( url.toString(), JavadocUtil.getRedirectUrl( url, new Settings() ).toString() ); + } + + /** + * Tests a redirect from localhost:port1 to localhost:port2 + */ + public void testGetRedirectUrl() + throws Exception + { + Server server = null, redirectServer = null; + try + { + redirectServer = new Server( 0 ); + redirectServer.addHandler( new AbstractHandler() + { + @Override + public void handle( String target, HttpServletRequest request, HttpServletResponse response, + int dispatch ) + throws IOException, ServletException + { + response.setStatus( HttpServletResponse.SC_OK ); + ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer( 100 ); + writer.write( "Hello world" ); + writer.flush(); + response.setContentLength( writer.size() ); + OutputStream out = response.getOutputStream(); + writer.writeTo( out ); + out.close(); + writer.close(); + } + } ); + redirectServer.start(); + + server = new Server( 0 ); + MovedContextHandler handler = new MovedContextHandler(); + int redirectPort = redirectServer.getConnectors()[0].getLocalPort(); + handler.setNewContextURL( "http://localhost:" + redirectPort ); + server.addHandler( handler ); + server.start(); + + URL url = new URI( "http://localhost:" + server.getConnectors()[0].getLocalPort() ).toURL(); + URL redirectUrl = JavadocUtil.getRedirectUrl( url, new Settings() ); + + assertTrue( redirectUrl.toString().startsWith( "http://localhost:" + redirectPort ) ); + } + finally + { + stopSilently( server ); + stopSilently( redirectServer ); + } + } + /** * Method to test copyJavadocResources() * @@ -626,4 +695,19 @@ assertEquals( path1 + ps + path2 + ps + path1 + ps + path2, JavadocUtil.unifyPathSeparator( path1 + ";" + path2 + ":" + path1 + ":" + path2 ) ); } + + private void stopSilently( Server server ) + { + try + { + if ( server != null ) + { + server.stop(); + } + } + catch ( Exception e ) + { + // ignored + } + } } diff -Nru maven-javadoc-plugin-3.0.0/src/test/resources/unit/docfiles-with-java-test/src/main/test/App.java maven-javadoc-plugin-3.0.1/src/test/resources/unit/docfiles-with-java-test/src/main/test/App.java --- maven-javadoc-plugin-3.0.0/src/test/resources/unit/docfiles-with-java-test/src/main/test/App.java 2009-08-19 12:40:14.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/resources/unit/docfiles-with-java-test/src/main/test/App.java 2018-05-25 09:10:44.000000000 +0000 @@ -21,7 +21,7 @@ /** * @author Vincent Siveton - * @version $Id: App.java 805778 2009-08-19 12:40:14Z vsiveton $ + * @version $Id$ */ public class App { diff -Nru maven-javadoc-plugin-3.0.0/src/test/resources/unit/docfiles-with-java-test/src/main/test/doc-files/App.java maven-javadoc-plugin-3.0.1/src/test/resources/unit/docfiles-with-java-test/src/main/test/doc-files/App.java --- maven-javadoc-plugin-3.0.0/src/test/resources/unit/docfiles-with-java-test/src/main/test/doc-files/App.java 2009-08-19 12:40:14.000000000 +0000 +++ maven-javadoc-plugin-3.0.1/src/test/resources/unit/docfiles-with-java-test/src/main/test/doc-files/App.java 2018-05-25 09:10:44.000000000 +0000 @@ -21,7 +21,7 @@ /** * @author Vincent Siveton - * @version $Id: App.java 805778 2009-08-19 12:40:14Z vsiveton $ + * @version $Id$ */ public class App {