Skip to content

Commit e355785

Browse files
jwgmeligmeylingolamy
authored andcommitted
Allow disabled logging when JAVA_HOME is not known (#52)
1 parent c726899 commit e355785

File tree

1 file changed

+6
-2
lines changed
  • plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac

1 file changed

+6
-2
lines changed

plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ public CompilerResult performCompile( CompilerConfiguration config )
158158
}
159159
catch ( IOException e )
160160
{
161-
getLogger().warn( "Unable to autodetect 'javac' path, using 'javac' from the environment." );
161+
if ( (getLogger() != null ) && getLogger().isWarnEnabled()) {
162+
getLogger().warn( "Unable to autodetect 'javac' path, using 'javac' from the environment." );
163+
}
162164
executable = "javac";
163165
}
164166
}
@@ -590,7 +592,9 @@ CompilerResult compileInProcess( String[] args, CompilerConfiguration config )
590592
final Thread thread = Thread.currentThread();
591593
final ClassLoader contextClassLoader = thread.getContextClassLoader();
592594
thread.setContextClassLoader( javacClass.getClassLoader() );
593-
getLogger().debug( "ttcl changed run compileInProcessWithProperClassloader" );
595+
if ( (getLogger() != null ) && getLogger().isDebugEnabled()) {
596+
getLogger().debug("ttcl changed run compileInProcessWithProperClassloader");
597+
}
594598
try
595599
{
596600
return compileInProcessWithProperClassloader(javacClass, args);

0 commit comments

Comments
 (0)