Skip to content

Commit 2392c2d

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 1faafc6 commit 2392c2d

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ 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) {
4545
return true;
46+
} else {
47+
return Boolean.parseBoolean(value.toString());
4648
}
47-
return false;
4849
}
4950

5051
@Override

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

Lines changed: 8 additions & 4 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,12 +42,15 @@ public void writeExternal(ObjectOutput out) throws IOException {
4142

4243
@Override
4344
public boolean verifyDataType(final Object value) {
44-
if ( value instanceof Float ) {
45-
return true;
46-
} else if ( value == null ) {
45+
if (value == null) {
4746
return true;
4847
} else {
49-
return false;
48+
try {
49+
Float.parseFloat(value.toString());
50+
return true;
51+
} catch (NumberFormatException e) {
52+
return false;
53+
}
5054
}
5155
}
5256

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ public void writeExternal(ObjectOutput out) throws IOException {
4141

4242
@Override
4343
public boolean verifyDataType(final Object value) {
44-
if ( value instanceof Integer ) {
45-
return true;
46-
} else if ( value == null ) {
44+
if (value == null) {
4745
return true;
4846
} else {
49-
return false;
47+
try {
48+
Integer.parseInt(value.toString());
49+
return true;
50+
} catch (NumberFormatException e) {
51+
return false;
52+
}
5053
}
5154
}
5255

@@ -74,5 +77,4 @@ public Object valueOf(String value) {
7477
return value;
7578
}
7679
}
77-
7880
}

0 commit comments

Comments
 (0)