directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-core git commit: FC-226 - ehcache masking security exceptions
Date Sun, 17 Sep 2017 14:54:56 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/master eba2fc093 -> 6cc69e939


FC-226 - ehcache masking security exceptions


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/6cc69e93
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/6cc69e93
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/6cc69e93

Branch: refs/heads/master
Commit: 6cc69e939181750473118a902f2531fbf6bcda4b
Parents: eba2fc0
Author: Shawn McKinney <smckinney@apache.org>
Authored: Fri Sep 15 08:47:29 2017 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Fri Sep 15 08:47:29 2017 -0500

----------------------------------------------------------------------
 .../fortress/core/util/cache/CacheMgr.java      | 31 ++++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/6cc69e93/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
index c253617..6b38bc1 100644
--- a/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/cache/CacheMgr.java
@@ -52,37 +52,50 @@ public final class CacheMgr
      */
     public static CacheMgr getInstance()
     {
-        if( sINSTANCE == null)
+        try
         {
-            synchronized (CacheMgr.class)
+            if( sINSTANCE == null)
             {
-                if( sINSTANCE == null){
-        	        sINSTANCE = new CacheMgr();
+                synchronized (CacheMgr.class)
+                {
+                    if( sINSTANCE == null){
+                        sINSTANCE = new CacheMgr();
+                    }
                 }
             }
         }
+        catch (Exception e)
+        {
+            String error = "CacheMgr.getInstance caught Exception=" + e.getMessage();
+            LOG.error( error );
+            throw new CfgRuntimeException( GlobalErrIds.FT_CACHE_NOT_CONFIGURED, error, e
);
+        }
         return sINSTANCE;
     }
     
     private void init()
     {
-        // Use default name of 'ehache.xml':
+        // Use default name of 'ehcache.xml':
         String cacheConfig = Config.getInstance().getProperty( EHCACHE_CONFIG_FILE, "ehcache.xml"
);
         try
         {
-            // This static block performs the following:
             // 1. Construct an instance of Ehcache's CacheManager object.
             // 2. Requires location of ehcache's config file as parameter.
-            // 3. The CacheManager reference then gets passed to constructor of self.
-            // 4. Store the reference of self as a static member variable of this class.
+            // 3. The CacheManager reference then gets stored as member variable of this
class instance.
             mEhCacheImpl = new CacheManager( ClassUtil.resourceAsStream( cacheConfig ) );
         }
         catch(CfgException ce)
         {
             // The ehcache file cannot be located on this program's classpath.  Ehcache is
required, throw runtime exception.
-            LOG.error( "CfgException caught in static initializer=" + ce.getMessage());
+            LOG.error( "CfgException caught  initializing cacher=" + ce.getMessage());
             throw new CfgRuntimeException( GlobalErrIds.FT_CACHE_NOT_CONFIGURED, cacheConfig,
ce );
         }
+        catch(Exception e)
+        {
+            String error = "CacheMgr.init caught Exception=" + e.getMessage();
+            LOG.error( error );
+            throw new CfgRuntimeException( GlobalErrIds.FT_CACHE_NOT_CONFIGURED, error, e
);
+        }
     }
 
     /**


Mime
View raw message