[AIRAVATA-2421] Add null check before clearing EntityManagerFactory cache
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/f1f3712c Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/f1f3712c Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/f1f3712c Branch: refs/heads/keycloak-prod-migration Commit: f1f3712c870559effc5212ad46d5f596cb79f0da Parents: 0d93a45 Author: Gourav Shenoy <[email protected]> Authored: Fri Jun 30 12:19:00 2017 -0400 Committer: Gourav Shenoy <[email protected]> Committed: Fri Jun 30 12:19:00 2017 -0400 ---------------------------------------------------------------------- .../registry/core/app/catalog/util/AppCatalogJPAUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/f1f3712c/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java index fc413ec..01f9bbc 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java @@ -69,7 +69,9 @@ public class AppCatalogJPAUtils { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties); } // clear cache at entitymangerfactory level - factory.getCache().evictAll(); + if (factory.getCache() != null) { + factory.getCache().evictAll(); + } appCatEntityManager = factory.createEntityManager(); return appCatEntityManager; }
