summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-08-02 07:08:00 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-02 07:08:00 +0000
commit8f2a4878715e46db24735bb63e14598c5c1e61f8 (patch)
tree743be438548411df5b3b676e3ee0fbb06c4040f4 /bpmn
parent8892816fc723206eaf3ce96228f87838d9528e82 (diff)
parent8186ec2416f3a41cd0d4dc91e357539522d2dd9b (diff)
Merge "Fixed potential crashes due to null object dereference attempts in exception handlers"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java31
1 files changed, 23 insertions, 8 deletions
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
index 2e66493a25..1442099286 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BaseTask.java
@@ -86,8 +86,13 @@ public class BaseTask implements JavaDelegate {
}
return variable;
} else {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "expected a variable name string, got object of type " + o.getClass().getName());
+ } else {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "expected a variable name string, got null object");
+ }
}
}
@@ -114,7 +119,7 @@ public class BaseTask implements JavaDelegate {
return null;
} else {
throw new BadInjectedFieldException(fieldName, getTaskName(),
- "expected a variable name string" + ", got object of type " + o.getClass().getName());
+ "expected a variable name string, got object of type " + o.getClass().getName());
}
}
@@ -133,9 +138,11 @@ public class BaseTask implements JavaDelegate {
Object o = getFieldImpl(expression, execution, fieldName, false);
if (o instanceof String) {
return (String) o;
- } else {
+ } else if (o != null) {
throw new BadInjectedFieldException(fieldName, getTaskName(),
"cannot convert '" + o.toString() + "' to Integer");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
}
}
@@ -189,8 +196,12 @@ public class BaseTask implements JavaDelegate {
try {
return Integer.parseInt(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Integer");
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "cannot convert '" + o.toString() + "' to Integer");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
+ }
}
}
}
@@ -289,8 +300,12 @@ public class BaseTask implements JavaDelegate {
try {
return Long.parseLong(o.toString());
} catch (NumberFormatException e) {
- throw new BadInjectedFieldException(fieldName, getTaskName(),
- "cannot convert '" + o.toString() + "' to Long");
+ if (o != null) {
+ throw new BadInjectedFieldException(fieldName, getTaskName(),
+ "cannot convert '" + o.toString() + "' to Long");
+ } else {
+ throw new MissingInjectedFieldException(fieldName, getTaskName());
+ }
}
}
}