public static UserInfo getUserInfo ( final String userId ) { if ( userId == null ) { throw new IllegalArgumentException ( "null userName" ) ; } try { Class < ? > accessor = Class . forName ( "com.sap.security.um.service.UserManagementAccessor" ) ; if ( accessor != null ) { Object users = MethodUtils . invokeExactStaticMethod ( accessor , "getUserProvider" , null ) ; if ( users != null ) { Object user = MethodUtils . invokeExactMethod ( users , "getUser" , userId ) ; if ( user != null ) { // get user name and email return new User ( userId , ( String ) MethodUtils . invokeExactMethod ( user , "getAttribute" , "firstname" ) , ( String ) MethodUtils . invokeExactMethod ( user , "getAttribute" , "lastname" ) , ( String ) MethodUtils . invokeExactMethod ( user , "getAttribute" , "email" ) ) ; } } } } catch ( ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e ) { log . warn ( e . getMessage ( ) ) ; } return new User ( userId , "" , "" , "" ) ; }
never returns null