Merge pull request #1142 from madawas/fix-1556

Checking if the user store manager class is a sub class of the default
revert-70aa11f8
Kamidu Sachith Punchihewa 7 years ago committed by GitHub
commit 73e163d341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -222,14 +222,13 @@ public class DeviceMgtAPIUtils {
public static UserStoreCountRetriever getUserStoreCountRetrieverService() public static UserStoreCountRetriever getUserStoreCountRetrieverService()
throws UserStoreCounterException { throws UserStoreCounterException, UserStoreException {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
List<Object> countRetrieverFactories = ctx.getOSGiServices(AbstractCountRetrieverFactory.class, null); List<Object> countRetrieverFactories = ctx.getOSGiServices(AbstractCountRetrieverFactory.class, null);
RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
RealmConfiguration realmConfiguration = realmService.getBootstrapRealmConfiguration(); RealmConfiguration realmConfiguration = realmService.getBootstrapRealmConfiguration();
String userStoreType; String userStoreType;
//Ignoring Sonar warning as getUserStoreClass() returning string name of the class. So cannot use 'instanceof'. if(DeviceMgtAPIUtils.getUserStoreManager() instanceof JDBCUserStoreManager) {
if (JDBCUserStoreManager.class.getName().equals(realmConfiguration.getUserStoreClass())) {
userStoreType = JDBCCountRetrieverFactory.JDBC; userStoreType = JDBCCountRetrieverFactory.JDBC;
} else { } else {
userStoreType = InternalCountRetrieverFactory.INTERNAL; userStoreType = InternalCountRetrieverFactory.INTERNAL;

Loading…
Cancel
Save