3535import com .backendless .utils .ResponderHelper ;
3636import weborb .types .Types ;
3737
38+ import java .util .Collections ;
3839import java .util .ArrayList ;
3940import java .util .Arrays ;
4041import java .util .HashMap ;
@@ -686,7 +687,9 @@ public List<String> getUserRoles( String userId )
686687 if ( userId == null || userId .isEmpty () )
687688 throw new IllegalArgumentException ( ExceptionMessage .NULL_IDENTITY );
688689
689- return Arrays .asList ( (String []) Invoker .invokeSync ( USER_MANAGER_SERVER_ALIAS , "getUserRoles" , new Object [] { userId } ) );
690+ Object [] objects = Invoker .invokeSync ( USER_MANAGER_SERVER_ALIAS , "getUserRoles" , new Object [] { userId } );
691+
692+ return objects .length == 0 ? Collections .<String >emptyList () : Arrays .asList ( (String []) objects );
690693 }
691694
692695 public void getUserRoles ( final AsyncCallback <List <String >> responder )
@@ -709,7 +712,7 @@ public void handleFault( BackendlessFault fault )
709712 responder .handleFault ( fault );
710713 }
711714 };
712- Invoker .invokeAsync ( USER_MANAGER_SERVER_ALIAS , "getUserRoles" , new Object [] { }, callback );
715+ Invoker .invokeAsync ( USER_MANAGER_SERVER_ALIAS , "getUserRoles" , new Object [] {}, callback );
713716 }
714717 catch ( Throwable e )
715718 {
@@ -725,13 +728,13 @@ public void getUserRoles( String userId, final AsyncCallback<List<String>> respo
725728 if ( userId == null || userId .isEmpty () )
726729 throw new IllegalArgumentException ( ExceptionMessage .NULL_IDENTITY );
727730
728- AsyncCallback <String []> callback = new AsyncCallback <String []>()
731+ AsyncCallback <Object []> callback = new AsyncCallback <Object []>()
729732 {
730733 @ Override
731- public void handleResponse ( String [] response )
734+ public void handleResponse ( Object [] response )
732735 {
733736 if ( responder != null )
734- responder .handleResponse ( Arrays .asList ( response ) );
737+ responder .handleResponse ( response . length == 0 ? Collections .< String > emptyList () : Arrays .asList ( ( String []) response ) );
735738 }
736739
737740 @ Override
0 commit comments