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 d941bfa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ 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) {
return true;
} else {
return Boolean.parseBoolean(value.toString());
}
return false;
}

@Override
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 d941bfa

Please sign in to comment.