33import cz .smarteon .loxone .app .MiniserverType ;
44import org .jetbrains .annotations .NotNull ;
55
6+ import java .io .UnsupportedEncodingException ;
67import java .net .URLEncoder ;
7- import java .nio .charset .StandardCharsets ;
88import java .util .function .Function ;
99
1010import static java .util .Objects .requireNonNull ;
@@ -82,7 +82,7 @@ public static EncryptedCommand<Token> getToken(final @NotNull String tokenHash,
8282 final @ NotNull Function <String , String > encryptor ) {
8383 final String cmd = "jdev/sys/gettoken/"
8484 + requireNonNull (tokenHash , "tokenHash can't be null" ) + "/"
85- + requireNonNull (user , "user can't be null" ) + "/"
85+ + requireNonNull (user , "user can't be null" ) + "/" +
8686 + requireNonNull (permissionType , "permissionType can't be null" ).getId () + "/"
8787 + requireNonNull (clientUuid , "clientUuid can't be null" ) + "/"
8888 + requireNonNull (clientInfo , "clientInfo can't be null" );
@@ -105,6 +105,10 @@ public static EncryptedCommand<Token> refreshToken(final String tokenHash, final
105105 }
106106
107107 private static String encodeUrl (String toEncode ) {
108- return URLEncoder .encode (toEncode , StandardCharsets .UTF_8 );
108+ try {
109+ return URLEncoder .encode (toEncode , "UTF-8" );
110+ } catch (UnsupportedEncodingException e ) {
111+ throw new IllegalStateException ("UTF-8 encoding should be present everywhere" , e );
112+ }
109113 }
110114}
0 commit comments