Skip to content

Commit

Permalink
JBPM-9884 Dont allow to modify process variable of type Integer/Boole…
Browse files Browse the repository at this point in the history
…an/..etc with invalid values through business-central console.
  • Loading branch information
bxf12315 committed Sep 8, 2021
1 parent ff1a56c commit ceb2789
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public void writeExternal(ObjectOutput out) throws IOException {

@Override
public boolean verifyDataType(final Object value) {
if ( value instanceof Boolean ) {
if (value == null) {
return true;
} else if (value instanceof Boolean || "true".equalsIgnoreCase(value.toString()) || "false".equalsIgnoreCase(value.toString())) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.ObjectInput;
import java.io.ObjectOutput;

import org.apache.commons.lang3.StringUtils;
import org.jbpm.process.core.datatype.DataType;

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

@Override
public boolean verifyDataType(final Object value) {
if ( value instanceof Float ) {
if (value == null) {
return true;
} else if ( value == null ) {
} else if (value instanceof Float || StringUtils.isNumeric(value.toString())) {
return true;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.ObjectOutput;

import org.jbpm.process.core.datatype.DataType;
import org.apache.commons.lang3.StringUtils;

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

@Override
public boolean verifyDataType(final Object value) {
if ( value instanceof Integer ) {
if (value == null) {
return true;
} else if ( value == null ) {
} else if (value instanceof Integer || StringUtils.isNumeric(value.toString())) {
return true;
} else {
return false;
Expand Down Expand Up @@ -75,4 +76,8 @@ public Object valueOf(String value) {
}
}

public static void main(String[] args){
IntegerDataType idt = new IntegerDataType();
idt.verifyDataType("1234567");
}
}

0 comments on commit ceb2789

Please sign in to comment.