This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MJAVADOC-504
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
The following commit(s) were added to refs/heads/MJAVADOC-504 by this push:
new 6c53ec5 [MJAVADOC-504] NullPointerException in
JavadocUtil.getJavaHome() when JAVA_HOME isn't set
6c53ec5 is described below
commit 6c53ec533486b3955be26cd0605167f27edb0d1b
Author: rfscholte <[email protected]>
AuthorDate: Wed Jan 3 00:25:31 2018 +0100
[MJAVADOC-504] NullPointerException in JavadocUtil.getJavaHome() when
JAVA_HOME isn't set
---
.../apache/maven/plugins/javadoc/JavadocUtil.java | 34 ++++++++++------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
index c2c640c..f575455 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocUtil.java
@@ -1278,9 +1278,22 @@ public class JavadocUtil
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
@@ -1296,24 +1309,7 @@ public class JavadocUtil
if ( javaHome == null || !javaHome.exists() )
{
- try
- {
- String javaHomeValue =
CommandLineUtils.getSystemEnvVars().getProperty( "JAVA_HOME" );
-
- if ( javaHomeValue == null )
- {
- javaHomeValue =
CommandLineUtils.getSystemEnvVars().getProperty( "java.home" );
- }
-
- javaHome = new File( javaHomeValue );
- }
- catch ( IOException e )
- {
- if ( log != null && log.isDebugEnabled() )
- {
- log.debug( "IOException: " + e.getMessage() );
- }
- }
+ javaHome = new File( javaHomeValue );
}
if ( javaHome == null || !javaHome.exists() )
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].