2.5.0 Snapshot build 1536 - problems with String methods


(mattnl ) #1

Hi,

I have just installed snapshot build 2.5.0 #1536 and see the following issues:

val String name = triggeringItem.name.toString.substringAfter("gBT")

==> throws the following error:
'substringAfter' is not a member of 'java.lang.String'

postUpdate(wekker_sbmatt_1_Time, alarmTime.toString.left(5))

==> throws the following error:
'left' is not a member of 'java.lang.String'

This used to work without any problems on 2.5.0 Milestone 1.

Possibly a bug or has something changed? Can anybody reproduce this?

Cheers,
Matt


[SOLVED] Sending item.name via Telegram resolves in Error 400 Bad Request from Telegram
(Semperor) #2

Updated to openHAB 2.5.0~S1541-1 (Build #1541) few minutes ago. Now I get:

2019-02-28 22:00:05.493 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'CheckAlarmState': 'left' is not a member of 'java.lang.String'; line 9, column 26, length 55


(Semperor) #3

(mattnl ) #4

Thank you semperor for confirming the issue and fur creating a GitHub issue.


(Lolodomo) #5

Same problem for me using replaceChars with snapshot 1544.


(Semperor) #6

Good news. Kai just made a pr with a fix.


(Semperor) #7

I have updated to the current snapshot and the problem is gone.


(mattnl ) #8

Good that it is working for you. I still see the same problems on snapshot #1549


(Semperor) #9

I’m currently using openHAB 2.5.0~S1548-1 (Build #1548). And the problem is definitely gone in this build #.

@Lolodomo Did the fix from Kai work for you?


(Lolodomo) #10

I did not install a newer version side the last weekend. But I have no doubt it will work for me too.


(Lolodomo) #11

I just installed snapshot 1549 and unfortunately my problem is not resolved:

2019-03-06 07:17:39.295 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Controle par la voix': 'replaceChars' is not a member of 'java.lang.String'; line 745, column 24, length 45

(Semperor) #12

I made a test rule

rule "Testrule"
when
    Time cron "0/15 * * * * ? *"
then
    val String test = "empowering the smart home"
    logInfo("common", "substring = " + test.substring( 5, 10 ) )
    logInfo("common", "indexOf = " + test.indexOf( "power" ) )
    logInfo("common", "replaceChars= " + test.replaceChars( "smart", "smartest" ) )
    logInfo("common", "reverse = " + test.reverse() )
end

with that result:

2019-03-06 08:30:35.814 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'common.rules'
2019-03-06 08:30:47.373 [INFO ] [clipse.smarthome.model.script.common] - substring = ering
2019-03-06 08:30:47.390 [INFO ] [clipse.smarthome.model.script.common] - indexOf = 2
2019-03-06 08:30:47.398 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Testrule': 'replaceChars' is not a member of 'java.lang.String'; line 14, column 46, length 40

I than deleted the replaceChars line and got that:

2019-03-06 08:31:02.041 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'common.rules'
2019-03-06 08:31:15.036 [INFO ] [clipse.smarthome.model.script.common] - substring = ering
2019-03-06 08:31:15.045 [INFO ] [clipse.smarthome.model.script.common] - indexOf = 2
2019-03-06 08:31:15.052 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Testrule': 'reverse' is not a member of 'java.lang.String'; line 15, column 42, length 14

The fix doesn’t work at all. :frowning:


(mattnl ) #13

Thanks guys for confirming this. I started doubting myself already :wink:


(mattnl ) #14

I just installed build #1555 and the problems seem to be resolved in that build.

Thanks to all!


(Semperor) #15

Yep. Can confirm that there are no errors in #1555.


(Lolodomo) #16

I can confirm too using the snapshot 1556.