Skip to content

Commit c3d9c29

Browse files
committed
JBPM-9884 Dont allow to modify process variable of type Integer/Boolean/..etc with invalid values through business-central console.
1 parent ff1a56c commit c3d9c29

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/BooleanDataType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public void writeExternal(ObjectOutput out) throws IOException {
4141

4242
@Override
4343
public boolean verifyDataType(final Object value) {
44-
if ( value instanceof Boolean ) {
44+
if (value instanceof Boolean || "true".equalsIgnoreCase(value.toString()) || "false".equalsIgnoreCase(value.toString())) {
4545
return true;
4646
}
4747
return false;

jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/FloatDataType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.ObjectInput;
2121
import java.io.ObjectOutput;
2222

23+
import org.apache.commons.lang3.StringUtils;
2324
import org.jbpm.process.core.datatype.DataType;
2425

2526
/**
@@ -41,9 +42,9 @@ public void writeExternal(ObjectOutput out) throws IOException {
4142

4243
@Override
4344
public boolean verifyDataType(final Object value) {
44-
if ( value instanceof Float ) {
45+
if (value instanceof Float || StringUtils.isNumeric(value.toString())) {
4546
return true;
46-
} else if ( value == null ) {
47+
} else if (value == null) {
4748
return true;
4849
} else {
4950
return false;

jbpm-flow/src/main/java/org/jbpm/process/core/datatype/impl/type/IntegerDataType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.io.ObjectOutput;
2222

2323
import org.jbpm.process.core.datatype.DataType;
24+
import org.apache.commons.lang3.StringUtils;
2425

2526
/**
2627
* Representation of an integer datatype.
@@ -41,9 +42,9 @@ public void writeExternal(ObjectOutput out) throws IOException {
4142

4243
@Override
4344
public boolean verifyDataType(final Object value) {
44-
if ( value instanceof Integer ) {
45+
if (value instanceof Integer || StringUtils.isNumeric(value.toString())) {
4546
return true;
46-
} else if ( value == null ) {
47+
} else if (value == null) {
4748
return true;
4849
} else {
4950
return false;

jbpm-flow/src/main/java/org/jbpm/process/instance/context/variable/VariableScopeInstance.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public void setVariable(String name, Object value) {
104104
return;
105105
}
106106
}
107+
107108
// check if variable that is being set is readonly and has already been set
108109
if (oldValue != null && !oldValue.equals(value) && getVariableScope().isReadOnly(name)) {
109110
throw new VariableViolationException(getProcessInstance().getId(), name, "Variable '" + name + "' is already set and is marked as read only");

0 commit comments

Comments
 (0)