diff options
author | rescobar | 2010-09-29 02:23:49 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2010-09-29 02:23:49 +0000 |
commit | 78e6c20da733d3f98d32c1758f5733e0e0bdbf85 (patch) | |
tree | c013fef6bc1454b4f1a735b7d9e124116cfeee18 /plugins | |
parent | 4010b3d96416e375c38aeff87ed5a04a90fd47fb (diff) | |
download | org.eclipse.osee-78e6c20da733d3f98d32c1758f5733e0e0bdbf85.tar.gz org.eclipse.osee-78e6c20da733d3f98d32c1758f5733e0e0bdbf85.tar.xz org.eclipse.osee-78e6c20da733d3f98d32c1758f5733e0e0bdbf85.zip |
bug: Prevent sessionCache exception during dbinit when no tables exist
Diffstat (limited to 'plugins')
2 files changed, 24 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java index d7468cc490b..158c56ae3c4 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/cache/AbstractOseeCache.java @@ -45,11 +45,13 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I private final boolean uniqueName; private boolean ensurePopulatedRanOnce; private long lastLoaded; + private boolean ignoreEnsurePopulateException; protected AbstractOseeCache(OseeCacheEnum cacheId, IOseeDataAccessor<T> dataAccessor, boolean uniqueName) { this.lastLoaded = 0; this.cacheId = cacheId; this.ensurePopulatedRanOnce = false; + this.ignoreEnsurePopulateException = false; this.dataAccessor = dataAccessor; this.uniqueName = uniqueName; } @@ -67,6 +69,14 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I } + public void setIgnoreEnsurePopulateException(boolean isIgnored) { + this.ignoreEnsurePopulateException = isIgnored; + } + + public boolean isEnsurePopulateExceptionIgnored() { + return ignoreEnsurePopulateException; + } + @Override public OseeCacheEnum getCacheId() { return cacheId; @@ -254,7 +264,13 @@ public abstract class AbstractOseeCache<T extends AbstractOseeType> implements I public synchronized void ensurePopulated() throws OseeCoreException { if (!ensurePopulatedRanOnce) { ensurePopulatedRanOnce = true; - reloadCache(); + try { + reloadCache(); + } catch (OseeCoreException ex) { + if (!isEnsurePopulateExceptionIgnored()) { + throw ex; + } + } } } diff --git a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java index 2751c6c10ee..47c7df3378e 100644 --- a/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java +++ b/plugins/org.eclipse.osee.framework.core.server/src/org/eclipse/osee/framework/core/server/internal/session/SessionManagerImpl.java @@ -18,6 +18,7 @@ import java.util.Set; import org.eclipse.osee.framework.core.data.IOseeUserInfo; import org.eclipse.osee.framework.core.data.OseeCredential; import org.eclipse.osee.framework.core.data.OseeSessionGrant; +import org.eclipse.osee.framework.core.data.SystemUser; import org.eclipse.osee.framework.core.enums.StorageState; import org.eclipse.osee.framework.core.exception.OseeCoreException; import org.eclipse.osee.framework.core.server.IAuthenticationManager; @@ -62,6 +63,12 @@ public final class SessionManagerImpl implements ISessionManager { sessionFactory.create(GUID.create(), oseeUserInfo.getUserID(), creationDate, managedByServerId, credential.getVersion(), credential.getClientMachineName(), credential.getClientAddress(), credential.getPort(), creationDate, StorageState.CREATED.name().toLowerCase()); + + if (credential.getUserName().equals(SystemUser.BootStrap.getName())) { + sessionCache.setIgnoreEnsurePopulateException(true); + } else { + sessionCache.setIgnoreEnsurePopulateException(false); + } sessionCache.cache(session); sessionGrant = sessionFactory.createSessionGrant(session, oseeUserInfo); } |