The method encode(String) from the type URLEncoder is deprecated

Hello,

i use in my rules the URLEncoder, this way

import java.net.URLEncoder

and then for example for a poster image

var String newValueactorposter3 = actor1_movie3_poster.toString
var String newValueactorposter3_encoded = URLEncoder::encode(newValueactorposter3)
var String actorposter_movie3_complete = "http://192.168.0.164:8023/image/" + newValueactorposter3_encoded

but i still get the warning that the URLEncoder is deprecated.

Can me someone say thats the right way`?

THX

That’s really a question about the java version you are using.
Does it work?
Will you be changing the java version anytime soon?
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URLEncoder.html
But this looks easy enough to avoid

1 Like

Java 11 with openhab 3 m3.

I take a Look at the link