Parameters for connectors - Validation

1
0
-1

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(ParameterExpressionExecutorStrategy.java:90)
  3. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.validateExpression(ExpressionServiceImpl.java:107)
  4. at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:81)
  5. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:213)
  6. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:208)
  7. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:208)
  8. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:208)
  9. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:120)
  10. at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
  11. at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.evaluateInputParameters(ConnectorServiceImpl.java:295)

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. }
  9.  
  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
Germán

Comments

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
Seán

1 answer

1
0
-1

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...
http://stackoverflow.com/questions/10786042/java-url-encoding-of-query-s...

regards
Seán

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

Comments

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.
Regards

Notifications