Sentry expression Evaluation affected by line endings in model (CRLF vs LF)

I have a Case instance where I can see human tasks A, B, C and D using the Flowable UI admin UI while looking at the Case Instance. Task A is a Task that was guarded by a sentry and therefore wasn’t enable immediately when the instance started, however, later on when the sentry condition evaluated to true it activated.

When I execute the caseInstanceIdWithChildren query passing in the case instance ID it only returns tasks B, C and D. The one difference with Task A, aside form the sentry, is that it is not within a stage in the case model while the other tasks are.

I’ve tracked it down to the fact that tasks B,C and D all have entries in the ACT_RU_ENTITYLINK table while Task A does not. I don’t think this is expected. Is anyone aware of any issues with the entityLink service which may prevent a link from getting saved?

Starting in 6.4.2 I’ve explicitly enabled EntityLinks in our engine config in order to ensure tasks from sub-processes called from Case models would get returned when we queried for them. This particular query used to return all 4 tasks as well as any tasks from sub-processes in 6.4.2 but I only just noticed since upgrading to 6.7.2 that task A is no longer coming back. For reference, this is the setting I’m referring to (on a side note, can this be controlled via an application.yml/properties variable in 6.7.2 or do I need to continue using the code approach?)

    public SpringProcessEngineConfiguration processEngineConfiguration() {
        SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
        return processEngineConfiguration;
    public SpringCmmnEngineConfiguration cmmnEngineConfiguration() {
		SpringCmmnEngineConfiguration cmmnEngineConfiguration = new SpringCmmnEngineConfiguration();

        return cmmnEngineConfiguration;

In order to try and isolate and reproduce the problem I’ve tried a unit test where I start a simple case model which has one human task in the main model and one within a stage and assert that I have two tasks. Starting the case instance directly in the unit test is successful, however, if I start an instance of the case model using the rest api the method returns no tasks which I’m assuming is because the standalone REST instance does not have the EnableEntityLinks set to true.

    void taskQueryTest() {
    	// testStages model was deployed manually to the Flowable engine
    	TaskInfoQueryWrapper taskInfoQueryWrapper;
        CaseInstance caseInstance = cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("testStages")
     	TaskQuery taskQuery = cmmnTaskService.createTaskQuery();
		taskInfoQueryWrapper = new TaskInfoQueryWrapper(taskQuery);
		long numRecords = taskInfoQueryWrapper.getTaskInfoQuery().count();

I think I may have answered my own question in my statement

The original problem I was having was that the sentry wasn’t evaluating to true and activating human task A so I used the REST api to update the variables referenced in the sentry. Identity links are not enabled on the backend REST API so although I was able to trigger the sentry and activate the human task, the entity link didn’t get registered and the task did not return in the caseInstanceIdWithChildren query. #facepalm

Back to figuring out why the sentry didn’t fire correctly in the first place

It turns out that the model which contained the sentry was using LF line endings and that resulted in the expression being interpreted incorrectly. When I changed the line endings in the file to CRLFs everything worked as expected. I was able to confirm with unit tests on my specific model and LFs would cause my tests to fail. I could also see in the Flowable debug logs the the Evaluation of the sentry wasn’t evaluating the correct expression when LFs were used. With LFs this is what I saw in the logs

Evaluation of sentry if condition e } for PlanItemInstance with id: ..., name: Submit, definitionId: Submit, state: available results in 'e }'"

versus CRLFs which results in the correct expression (variable names changed)

"Evaluation of sentry if condition ${var:get(myJSONvar).CHECK_YN == false && var
:get(regularCaseVar) == true } .....

Interestingly enough, when it failed it looks like it’s picking up the tail end of my expression e } rather than true }

I’m planning to create a simple model and unit test to see if I can recreate the problem but wanted to see if this might be an issue? It would seem to me that line endings shouldn’t affect the evaluation of expressions.