Skip to content

Commit ceb2789

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 ceb2789

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ 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 == null) {
45+
return true;
46+
} else if (value instanceof Boolean || "true".equalsIgnoreCase(value.toString()) || "false".equalsIgnoreCase(value.toString())) {
4547
return true;
4648
}
4749
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 == null) {
4546
return true;
46-
} else if ( value == null ) {
47+
} else if (value instanceof Float || StringUtils.isNumeric(value.toString())) {
4748
return true;
4849
} else {
4950
return false;

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

Lines changed: 7 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 == null) {
4546
return true;
46-
} else if ( value == null ) {
47+
} else if (value instanceof Integer || StringUtils.isNumeric(value.toString())) {
4748
return true;
4849
} else {
4950
return false;
@@ -75,4 +76,8 @@ public Object valueOf(String value) {
7576
}
7677
}
7778

79+
public static void main(String[] args){
80+
IntegerDataType idt = new IntegerDataType();
81+
idt.verifyDataType("1234567");
82+
}
7883
}

0 commit comments

Comments
 (0)