Parameters for connectors - Validation


I'm trying to use a parameter for a REST client, and I can´t find a way to provide the correct value to the conector.
I't seems that it is validating the parameter VALUE against this regular expression:(^[a-zA-Z]+|^\$)[a-zA-Z0-9$]*

this is the stacktrace:

  1. org.bonitasoft.engine.expression.exception.SInvalidExpressionException: PROCESS_DEFINITION_ID=5089973527243206230 | PROCESS_NAME=Actualización de Precios Sitio Web | PROCESS_VERSION=1.2 | PROCESS_INSTANCE_ID=17011 | ROOT_PROCESS_INSTANCE_ID=17011 | FLOW_NODE_DEFINITION_ID=7951134039297032835 | FLOW_NODE_INSTANCE_ID=340053 | FLOW_NODE_NAME=Login Oracle | CONNECTOR_IMPLEMENTATION_CLASS_NAME=Login | CONNECTOR_INSTANCE_ID=340022 | The expression content does not matches with (^[a-zA-Z]+|^\$)[a-zA-Z0-9$]* in expression: SExpressionImpl [name=login_form_port, content=login_form_port, returnType=java.lang.String, dependencies=[], expressionKind=ExpressionKind [interpreter=NONE, type=TYPE_PARAMETER]]
  2. at org.bonitasoft.engine.expression.ParameterExpressionExecutorStrategy.validate(
  3. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.validateExpression(
  4. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(
  5. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(
  6. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(
  7. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(
  8. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(
  9. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(
  10. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(
  11. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.evaluateInputParameters(

is this really the expected behaviour? Should I provide parameter in another way?

From the source code , I got this comment:

  1. @Override
  2. public void validate(final SExpression expression) throws SInvalidExpressionException {
  3. super.validate(expression);
  4. **// $ can be part of variable name**
  5. if (!expression.getContent().matches("(^[a-zA-Z]+|^\\$)[a-zA-Z0-9$]*")) {
  6. throw new SInvalidExpressionException("The expression content does not matches with (^[a-zA-Z]+|^\\$)[a-zA-Z0-9$]* in expression: " + expression,
  7. expression.getName());
  8. }
  10. }

so I understand why there is such validation, but it prevents me from using ":" in a parameter, or use a port number (it should start with a letter).

Thank you


Submitted by Sean McP on Tue, 04/18/2017 - 02:31

A Tip on displaying CODE/LOGS correctly in Posts:

Do not use the Supplied Buttons above, for some reason they refuse to work correctly, and despite bringing it to Bonitasofts attention, it's low priority.

To Show Code/Logs correctly use

< code >
your code/log
< /code >

removing the spaces to allow the showing of code/logs correctly as here:

  1. your code/log

You should still be able to edit your post to ensure the correct formatting of the code to help us understand it easier.

Thanks and regards

1 answer


This is pretty standard practice, not being able to use special characters. You need to encode/decode them accordingly.

See here - the answer with 731 ups...


PS: As this reply answers your question, please mark as resolved.


Submitted by gmoriello on Tue, 04/18/2017 - 04:26

Hi @Seán, thank you for your comment and your answer. This is not an encoding issue, Bonita is expecting that ALL the parameters values are compilant with the java attribute/variable standard, just in case it is used to dinamically create a variable.
Example: I defined a parameter: "endpoint_port" with value "8082". Since the value starts with a number, it's not accepted.

Submitted by Sean McP on Sun, 05/07/2017 - 04:16

what's the actual REST call you're trying to make, passing a parameter as a number is perfectly OK...