What's wrong with this rule? no viable alternative at input 'case'

OH 2.1 reports an error on the rule below:
` Configuration model ‘kodi.rules’ has errors, therefore ignoring it: [7,3]: no viable alternative at input ‘case’ [10,8]: no viable alternative at input ‘default’

This rule worked as a charm in OH2.0, can’t get it to work… Help is appreciated


rule "Kodi Movie"
        Item pi2mediatype received update
        switch (pi2mediatype.state) {
                case "episode",
                case "movie" : {
                case default : {
                        sendCommand(KamerScene, KamerScene.state)


I would guess the message is complaining about no action for that case. Is a comma really appropriate there? I think I have seen
case “episode” : break
for a do-nothing case

A comma is used to define “fall through” (as described here: https://eclipse.org/xtend/documentation/203_xtend_expressions.html)

You might be right that this is no longer valid, but that would different from 2.0…

First try a toString on the state pasted to the switch to rule out a type conversion problem.

Next try without the parens around the argument to the switch. I don’t have them on mine and they seem to work.

As far as I know a fall through like that should work.

I put it to rest for some time… compared this to all my other rules and solved it by changing:

                case default : {
                        sendCommand(KamerScene, KamerScene.state)

To (removing the case)

                default : {
                        sendCommand(KamerScene, KamerScene.state)

Then the rule is accepted without errors but does not work… Once it hits the default case it says:
2017-07-12 22:14:00.595 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Kodi Movie': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.String) on instance: null

I am getting a bit annoyed that I have to do work to make a previously working rule work, because I upgraded…
Did I miss an announcement when upgrading? Did it mention rules might need to be changed?

Have you been able to solve this issue?