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 Oct 25, 2021
1 parent 1faafc6 commit 06d6494
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 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,12 +42,15 @@ public void writeExternal(ObjectOutput out) throws IOException {

@Override
public boolean verifyDataType(final Object value) {
if ( value instanceof Float ) {
return true;
} else if ( value == null ) {
if (value == null) {
return true;
} else {
return false;
try {
Float.parseFloat(value.toString());
return true;
} catch (NumberFormatException e) {
return false;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ public void writeExternal(ObjectOutput out) throws IOException {

@Override
public boolean verifyDataType(final Object value) {
if ( value instanceof Integer ) {
return true;
} else if ( value == null ) {
if (value == null) {
return true;
} else {
return false;
try {
Integer.parseInt(value.toString());
return true;
} catch (NumberFormatException e) {
return false;
}
}
}

Expand Down Expand Up @@ -74,5 +77,4 @@ public Object valueOf(String value) {
return value;
}
}

}

0 comments on commit 06d6494

Please sign in to comment.