1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 394735: NPE when parallelizationNumber is missing, modified patch from Mohamed Hussein <mohamed_hussein@mentor.com>

This commit is contained in:
Andrew Gvozdev 2012-11-21 10:32:52 -05:00
parent 6012e77cfa
commit 3c6d895d64

View file

@ -632,17 +632,13 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
private int decodeParallelizationNumber(String value) { private int decodeParallelizationNumber(String value) {
int parallelNumber = -1; int parallelNumber = -1;
if (VALUE_OPTIMAL.equals(value)) { if (value == null || VALUE_OPTIMAL.equals(value)) {
parallelNumber = -getOptimalParallelJobNum(); parallelNumber = -getOptimalParallelJobNum();
} else if (VALUE_UNLIMITED.equals(value)) { } else if (VALUE_UNLIMITED.equals(value)) {
parallelNumber = UNLIMITED_JOBS; parallelNumber = UNLIMITED_JOBS;
} else { } else {
try { try {
parallelNumber = Integer.decode(value); parallelNumber = Integer.decode(value);
} catch (NumberFormatException e) {
ManagedBuilderCorePlugin.log(e);
parallelNumber = getOptimalParallelJobNum();
}
if (parallelNumber <= 0) { if (parallelNumber <= 0) {
// compatibility with legacy representation - it was that inconsistent // compatibility with legacy representation - it was that inconsistent
if (isInternalBuilder()) { if (isInternalBuilder()) {
@ -653,6 +649,11 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
parallelNumber = UNLIMITED_JOBS; parallelNumber = UNLIMITED_JOBS;
} }
} }
} catch (NumberFormatException e) {
ManagedBuilderCorePlugin.log(e);
// default to "optimal" if not recognized
parallelNumber = -getOptimalParallelJobNum();
}
} }
return parallelNumber; return parallelNumber;
} }