Clear stored application name cache before updating application name
@@ -160,7 +160,9 @@ public class CacheBackedApplicationDAO extends AbstractApplicationDAOImpl {
public void updateApplication(ServiceProvider serviceProvider, String tenantDomain) throws
IdentityApplicationManagementException {
+ String storedAppName = appDAO.getApplicationName(serviceProvider.getApplicationID());
clearAllAppCache(serviceProvider, tenantDomain);
+ clearAppCacheByName(storedAppName, tenantDomain);
appDAO.updateApplication(serviceProvider, tenantDomain);
}
@@ -352,4 +354,18 @@ public class CacheBackedApplicationDAO extends AbstractApplicationDAOImpl {
ApplicationMgtUtil.endTenantFlow();
}
}
+
+ private void clearAppCacheByName(String storedAppName, String tenantDomain) throws
+ IdentityApplicationManagementException {
+
+ try {
+ ApplicationMgtUtil.startTenantFlow(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
+ IdentityServiceProviderCacheKey cacheKey = new IdentityServiceProviderCacheKey(
+ storedAppName, tenantDomain);
+ appCacheByName.clearCacheEntry(cacheKey);
+ } finally {
+ ApplicationMgtUtil.endTenantFlow();
+ }
+
+ }
}
