Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBPM-9884 Dont allow to modify process variable of type Integer/Boole… #2013

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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())) {
nmirasch marked this conversation as resolved.
Show resolved Hide resolved
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bxf12315 this unused import needs to be removed

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;
}
}

}