Skip to content

Commit 71b0594

Browse files
author
carlos
committed
[PLX-314] Improve error message on unknown errors
1 parent f8a7f76 commit 71b0594

File tree

1 file changed

+10
-3
lines changed
  • plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac

1 file changed

+10
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,16 @@ List compileOutOfProcess( File workingDirectory, String executable, String[] arg
339339

340340
if ( returnCode != 0 && messages.isEmpty() )
341341
{
342-
// TODO: exception?
343-
messages.add( new CompilerError( "Failure executing javac, but could not parse the error:" + EOL +
344-
err.getOutput(), true ) );
342+
if ( err.getOutput().length() == 0 )
343+
{
344+
throw new CompilerException( "Unknown error trying to execute the external compiler: " + EOL
345+
+ cli.toString() );
346+
}
347+
else
348+
{
349+
messages.add( new CompilerError( "Failure executing javac, but could not parse the error:" + EOL
350+
+ err.getOutput(), true ) );
351+
}
345352
}
346353

347354
return messages;

0 commit comments

Comments
 (0)