File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
objectbox-java/src/main/java/io/objectbox/sync Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 11package io .objectbox .sync ;
22
3- import java .io . UnsupportedEncodingException ;
3+ import java .nio . charset . StandardCharsets ;
44import java .util .Arrays ;
55
66import javax .annotation .Nullable ;
@@ -21,16 +21,18 @@ public final class SyncCredentialsToken extends SyncCredentials {
2121 this .token = null ;
2222 }
2323
24- SyncCredentialsToken (CredentialsType type , @ SuppressWarnings ( "NullableProblems" ) byte [] token ) {
24+ SyncCredentialsToken (CredentialsType type , byte [] token ) {
2525 this (type );
26+ // Annotations do not guarantee non-null values
27+ //noinspection ConstantValue
2628 if (token == null || token .length == 0 ) {
2729 throw new IllegalArgumentException ("Token must not be empty" );
2830 }
2931 this .token = token ;
3032 }
3133
3234 SyncCredentialsToken (CredentialsType type , String token ) {
33- this (type , asUtf8Bytes ( token ));
35+ this (type , token . getBytes ( StandardCharsets . UTF_8 ));
3436 }
3537
3638 @ Nullable
@@ -56,12 +58,4 @@ public void clear() {
5658 this .token = null ;
5759 }
5860
59- private static byte [] asUtf8Bytes (String token ) {
60- try {
61- //noinspection CharsetObjectCanBeUsed On Android not available until SDK 19.
62- return token .getBytes ("UTF-8" );
63- } catch (UnsupportedEncodingException e ) {
64- throw new RuntimeException (e );
65- }
66- }
6761}
You can’t perform that action at this time.
0 commit comments