Uploaded image for project: 'Maven Javadoc Plugin'
  1. Maven Javadoc Plugin
  2. MJAVADOC-504

NullPointerException in JavadocUtil.getJavaHome() when JAVA_HOME isn't set

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0
    • 3.0.1
    • None
    • None
    • Debian, OpenJDK 8

    Description

      Hi,

      After upgrading to maven-javadoc-plugin I noticed a NullPointerException in JavadocUtil.getJavaHome() when the JAVA_HOME environment variable isn't set:

      java.lang.NullPointerException
          at java.io.File.<init> (File.java:277)
          at org.apache.maven.plugins.javadoc.JavadocUtil.getJavaHome (JavadocUtil.java:1302)
          at org.apache.maven.plugins.javadoc.JavadocUtil.invokeMaven (JavadocUtil.java:941)
          at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.getModulesLinks (AbstractJavadocMojo.java:5640)
          at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.addLinkofflineArguments (AbstractJavadocMojo.java:4046)
          at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.addStandardDocletOptions (AbstractJavadocMojo.java:4936)
          at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.executeReport (AbstractJavadocMojo.java:2074)
          at org.apache.maven.plugins.javadoc.JavadocReport.generate (JavadocReport.java:134)
          at org.apache.maven.plugins.javadoc.JavadocReport.doExecute (JavadocReport.java:329)
          at org.apache.maven.plugins.javadoc.AbstractJavadocMojo.execute (AbstractJavadocMojo.java:1909)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:134)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
          at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:51)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
          at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
          at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
          at org.apache.maven.cli.MavenCli.execute (MavenCli.java:993)
          at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:345)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:191)
          at org.apache.maven.cli.MavenCli.main (MavenCli.java:180)
      

      This error doesn't occur with the version 3.0.0-M1 or when JAVA_HOME is set. It can be reproduced on the byte-buddy project:

      git clone https://github.com/raphw/byte-buddy
      cd byte-buddy
      git checkout byte-buddy-1.7.9
      mvn org.apache.maven.plugins:maven-javadoc-plugin:3.0.0:javadoc
      

      Attachments

        Activity

          People

            rfscholte Robert Scholte
            ebourg Emmanuel Bourg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: