Source:
public String[] getHybridRoleListOfUser(String userName, String filter) throws UserStoreException { String getRoleListOfUserSQLConfig = realmConfig.getRealmProperty(HybridJDBCConstants.GET_ROLE_LIST_OF_USER); String sqlStmt = HybridJDBCConstants.GET_ROLE_LIST_OF_USER_SQL; if(getRoleListOfUserSQLConfig!=null && !getRoleListOfUserSQLConfig.equals("")){ sqlStmt = getRoleListOfUserSQLConfig; } Connection dbConnection = null; try { userName = UserCoreUtil.addDomainToName(userName, getMyDomainName()); String domain = UserCoreUtil.extractDomainFromName(userName); dbConnection = getDBConnection(); if (domain!=null){ domain = domain.toUpperCase(); } String[] roles = DatabaseUtil.getStringValuesFromDatabase(dbConnection, sqlStmt, UserCoreUtil.removeDomainFromName(userName), tenantId, tenantId, tenantId, domain); if (!CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equals(userName)) { if (roles == null || roles.length == 0) { return new String[] { realmConfig.getEveryOneRoleName() }; } List<String> allRoles = new ArrayList<String>(); boolean isEveryone = false; for (String role : roles) { role = UserCoreConstants.INTERNAL_DOMAIN + CarbonConstants.DOMAIN_SEPARATOR + role; if (role.equals(realmConfig.getEveryOneRoleName())) { isEveryone = true; } allRoles.add(role); } if (!isEveryone) { allRoles.add(realmConfig.getEveryOneRoleName()); } return allRoles.toArray(new String[allRoles.size()]); } else { return roles; } } catch (SQLException e) { String errorMessage = "Error occurred while getting Hybrid role list of user : "+userName; throw new UserStoreException(errorMessage, e); } finally { DatabaseUtil.closeAllConnections(dbConnection); } }

Target:
public String[] getHybridRoleListOfUser(String userName, String filter) throws UserStoreException { String getRoleListOfUserSQLConfig = realmConfig.getRealmProperty(HybridJDBCConstants.GET_ROLE_LIST_OF_USER); String sqlStmt = HybridJDBCConstants.GET_ROLE_LIST_OF_USER_SQL; if(getRoleListOfUserSQLConfig!=null && !getRoleListOfUserSQLConfig.equals("")){ sqlStmt = getRoleListOfUserSQLConfig; } Connection dbConnection = null; try { userName = UserCoreUtil.addDomainToName(userName, getMyDomainName()); String domain = UserCoreUtil.extractDomainFromName(userName); dbConnection = getDBConnection(); if (domain!=null){ domain = domain.toUpperCase(); } String[] roles = DatabaseUtil.getStringValuesFromDatabase(dbConnection, sqlStmt, UserCoreUtil.removeDomainFromName(userName), tenantId, tenantId, tenantId, domain); if (!CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equals(userName)) { if (roles == null || roles.length == 0) { return new String[] { realmConfig.getEveryOneRoleName() }; } List<String> allRoles = new ArrayList<String>(); boolean isEveryone = false; for (String role : roles) { role = UserCoreConstants.INTERNAL_DOMAIN + CarbonConstants.DOMAIN_SEPARATOR + role; if (role.equals(realmConfig.getEveryOneRoleName())) { isEveryone = true; } allRoles.add(role); } if (!isEveryone) { allRoles.add(realmConfig.getEveryOneRoleName()); } return allRoles.toArray(new String[allRoles.size()]); } else { return roles; } } catch (SQLException e) { String errorMessage = "Error occurred while getting Hybrid role list of user : " + userName; if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } finally { DatabaseUtil.closeAllConnections(dbConnection); } }