mismatched input 'modify' in rule

210 views
Skip to first unread message

Nir Aviry

unread,
Feb 19, 2018, 5:38:30 AM2/19/18
to openremot...@googlegroups.com
Hi.

After al long time I have started migrating to version 2.5 / 2.6.
Installed Java 1.8 and migrated my 100 devices and many panels.
The migration causes many issues with rules but this one I really do not understand.
I got the following error:

ERROR 2018-02-19 12:19:34,414 : Rule definition 'modeler_rules_wt.drl' could not be deployed. See errors below.

ERROR [main]: Rule definition 'modeler_rules_wt.drl' could not be deployed. See errors below.

ERROR 2018-02-19 12:19:34,414 : [ERR 102] Line 263:4 mismatched input 'modify' in rule "5_Panel_Water_Activated_Manually_60_Minutes"

ERROR [main]: [ERR 102] Line 263:4 mismatched input 'modify' in rule "5_Panel_Water_Activated_Manually_60_Minutes"

ERROR 2018-02-19 12:19:34,415 : Parser returned a null Package

ERROR [main]: Parser returned a null Package

INFO 2018-02-19 12:19:37,047 : Added rule definition 'modeler_rules.drl' to knowledge.


Here is the rule after replacing the "modify" with "update" operation:


rule "5_Panel_Water_Activated_Manually_60_Minutes"  
no-loop true
duration 1500
when
    $wt_timer : Water_Tank_Timer()
    eval ($wt_timer.getTime_running() == 0)
    eval ( $wt_timer.getLock_handler() == 0 )
    Switch ( source == "V_Water_Tank_60M (Sensor)", value == "ON" )
    eval ( $wt_timer.getProc_id() == 99 )
then    
/*    
    $wt_factors.setTime_running(1);
    $wt_factors.setLock_handler(1);
    $wt_factors.setProc_id(0);
    update ( $wt_timer );
    modify($wt_timer)
    {
        setTime_running(1);
    }
    modify($wt_timer)
    {
        setLock_handler(1);
    }
    modify($wt_timer)
    {
        setProc_id(0);
    }
 */
    System.out.println ( _TimeStamp()+ ":  #5 Water Tank 60 Minutes button was turned ON  !! ");


The error remains the same as is I did not put it in remark.
As you can see although there is an error, the rule runs as I get tall initialisation messages.

I manipulate the rules directly on the controller itself (editing the rule file and re-run the OR).
I use MACOS 10.13.4 in a MACMini
I rebooted the MAC, I have opened a new terminal yet nothing helps.
I have seen this in version 2.5 as well where only boot brings the new rules properly but here I edit the file itself in the rules folder.

Hope someone can help.

Nir Aviry

unread,
Feb 19, 2018, 10:36:13 AM2/19/18
to OpenRemote
After further checking it looks like a bug in OR, at leat under MACOS.
The error above OR Drools reports about refers to a code that is remarked. No such code is in my rules.
Line number are wrong in this error.
If I split the rules into 2 drl file and rename the 2nd one to .ddd for instance, the Drools still reads this file.
It happened in 2.5 and 2.6 Beta 3 so it is out there for some time.

בתאריך יום שני, 19 בפברואר 2018 בשעה 12:38:30 UTC+2, מאת Nir Aviry:

Michal Rutka

unread,
Feb 20, 2018, 10:26:00 AM2/20/18
to OpenRemote
It is very hard to diagnose the problem this way. What you should try to do is to cleanup all rules and try to narrow down it to the one which compiles at 2.1 and fails here.
Remove all unused rule files, perhaps just renaming their extension does not work. It is possible that errors from one rule file propagate on other files and give rubbish error messages, typical if you forget somewhere a closing bracket, quote, etc. 

Nir Aviry

unread,
Feb 23, 2018, 2:57:50 PM2/23/18
to OpenRemote
 Michal.

I am aware of the situation. I have tested the same thing on Raspberry Pi 2 and the errors are the same.
It is not a matter of MAC OS.
Furthermore, it is not stable. I had a situation were I have a rule that when enabled caused the error but than after a few tries, that last rule that was working before the faulty one is now causing an error. 
I also found an error that concerns Java 8 (DateTimeReformatter). I have read that in Java 8 there is a change in Classes.
At this point I get a constant EOF error on the last line of the rule file no matter which rule is disabled.
Besides this using old MAC mini is very good as it runs nice as a server.

If you are familiar with all the class changes I will send the import list of the JAVA.

Thanks. 

בתאריך יום שלישי, 20 בפברואר 2018 בשעה 17:26:00 UTC+2, מאת Michal Rutka:
Reply all
Reply to author
Forward
0 new messages