From 9d0acfc1e94c0f03145cdaac150b4896846c8ae1 Mon Sep 17 00:00:00 2001 From: Greg Domjan Date: Fri, 23 Jul 2021 12:28:21 +1000 Subject: [PATCH 1/2] Add stack trace for generic exception in build threads --- src/main/java/com/github/maven_nar/cpptasks/CCTask.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/maven_nar/cpptasks/CCTask.java b/src/main/java/com/github/maven_nar/cpptasks/CCTask.java index aef21e6fd..d2881b776 100644 --- a/src/main/java/com/github/maven_nar/cpptasks/CCTask.java +++ b/src/main/java/com/github/maven_nar/cpptasks/CCTask.java @@ -994,7 +994,11 @@ private BuildException runTargetPool(final CCTaskProgressMonitor monitor, BuildE if (compileException == null && exception instanceof BuildException) { compileException = (BuildException) exception; } else { - log(cores[j].getName() + " " + exception + " ", Project.MSG_ERR); + log(cores[j].getName() + " " + exception + " ", Project.MSG_ERR); + final StackTraceElement[] stackTrace = exception.getStackTrace(); + for (final StackTraceElement element : stackTrace) { + log(element.toString(),Project.MSG_DEBUG); + } } if (!this.relentless) { cores[j] = null; From 1856ac3562d853270b55fce93d68bab5b8640a50 Mon Sep 17 00:00:00 2001 From: Greg Domjan Date: Fri, 23 Jul 2021 12:29:36 +1000 Subject: [PATCH 2/2] Fix NPE for building resource dryRun command tracking not initialized unclear on assumption of commands being initialized --- .../maven_nar/cpptasks/compiler/CommandLineCompiler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/maven_nar/cpptasks/compiler/CommandLineCompiler.java b/src/main/java/com/github/maven_nar/cpptasks/compiler/CommandLineCompiler.java index 0b17175ba..c1f4f506d 100644 --- a/src/main/java/com/github/maven_nar/cpptasks/compiler/CommandLineCompiler.java +++ b/src/main/java/com/github/maven_nar/cpptasks/compiler/CommandLineCompiler.java @@ -571,7 +571,8 @@ protected int getTotalArgumentLengthForInputFile(final File outputDir, final Str * arguments without actually spawning the compiler */ protected int runCommand(final CCTask task, final File workingDir, final String[] cmdline) throws BuildException { - commands.add(cmdline); + if(commands!=null) + commands.add(cmdline); if (dryRun) return 0; return CUtil.runCommand(task, workingDir, cmdline, this.newEnvironment, this.env); }