Bug 394735: NPE when parallelizationNumber is missing, modified patch from Mohamed Hussein <mohamed_hussein@mentor.com>
Change-Id: I4cb60f33f6fc405ab9110668d30e18bd708532d7
Reviewed-on: https://git.eclipse.org/r/9887
Reviewed-by: Doug Schaefer <dschaefer@qnx.com>
IP-Clean: Doug Schaefer <dschaefer@qnx.com>
Tested-by: Doug Schaefer <dschaefer@qnx.com>
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
index 009f729..d695a83 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
@@ -632,26 +632,27 @@
private int decodeParallelizationNumber(String value) {
int parallelNumber = -1;
- if (VALUE_OPTIMAL.equals(value)) {
+ if (value == null || VALUE_OPTIMAL.equals(value)) {
parallelNumber = -getOptimalParallelJobNum();
} else if (VALUE_UNLIMITED.equals(value)) {
parallelNumber = UNLIMITED_JOBS;
} else {
try {
parallelNumber = Integer.decode(value);
+ if (parallelNumber <= 0) {
+ // compatibility with legacy representation - it was that inconsistent
+ if (isInternalBuilder()) {
+ // "optimal" for Internal Builder
+ parallelNumber = -getOptimalParallelJobNum();
+ } else {
+ // unlimited for External Builder
+ parallelNumber = UNLIMITED_JOBS;
+ }
+ }
} catch (NumberFormatException e) {
ManagedBuilderCorePlugin.log(e);
- parallelNumber = getOptimalParallelJobNum();
- }
- if (parallelNumber <= 0) {
- // compatibility with legacy representation - it was that inconsistent
- if (isInternalBuilder()) {
- // "optimal" for Internal Builder
- parallelNumber = -getOptimalParallelJobNum();
- } else {
- // unlimited for External Builder
- parallelNumber = UNLIMITED_JOBS;
- }
+ // default to "optimal" if not recognized
+ parallelNumber = -getOptimalParallelJobNum();
}
}
return parallelNumber;