[exo-jcr-commits] exo-jcr SVN: r5487 - in kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services: cache/impl/infinispan/distributed and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Jan 19 14:54:41 EST 2012


Author: nfilotto
Date: 2012-01-19 14:54:39 -0500 (Thu, 19 Jan 2012)
New Revision: 5487

Modified:
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
   kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
Log:
EXOJCR-1682: Sonar violations fixed for these projects

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -62,7 +62,7 @@
    /**
     * Logger.
     */
-   private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.AbstractExoCache");
+   private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.AbstractExoCache"); //NOSONAR
 
    private final AtomicInteger hits = new AtomicInteger(0);
 
@@ -101,7 +101,7 @@
    {
       if (listener == null)
       {
-         throw new NullPointerException();
+         throw new IllegalArgumentException("The listener cannot be null");
       }
       listeners.add(new ListenerContext<K, V>(listener, this));
    }
@@ -225,7 +225,7 @@
    {
       if (key == null)
       {
-         throw new NullPointerException("No null cache key accepted");
+         throw new IllegalArgumentException("No null cache key accepted");
       }
       else if (value == null)
       {
@@ -260,7 +260,7 @@
    {
       if (objs == null)
       {
-         throw new NullPointerException("No null map accepted");
+         throw new IllegalArgumentException("No null map accepted");
       }
       for (Serializable name : objs.keySet())
       {
@@ -290,7 +290,7 @@
                   onPut(entry.getKey(), entry.getValue());
                }
             }
-            catch (Exception e)
+            catch (Exception e) //NOSONAR
             {
                cache.endBatch(false);
                LOG.warn("An error occurs while executing the putMap method", e);
@@ -308,7 +308,7 @@
    {
       if (name == null)
       {
-         throw new NullPointerException("No null cache key accepted");
+         throw new IllegalArgumentException("No null cache key accepted");
       }      
       V result = SecurityHelper.doPrivilegedAction(new PrivilegedAction<V>()
       {
@@ -421,7 +421,7 @@
          {
             context.onExpire(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -441,7 +441,7 @@
          {
             context.onRemove(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -460,7 +460,7 @@
          {
             context.onPut(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -478,7 +478,7 @@
          {
             context.onGet(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -496,7 +496,7 @@
          {
             context.onClearCache();
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -75,7 +75,7 @@
     * The logger
     */
    private static final Log LOG = ExoLogger
-      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.ExoCacheFactoryImpl");
+      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.ExoCacheFactoryImpl");//NOSONAR
 
    /**
     * The initial parameter key that defines the full path of the configuration template
@@ -164,7 +164,7 @@
       this.configManager = configManager;
       if (cacheConfigTemplate == null)
       {
-         throw new RuntimeException("The parameter '" + CACHE_CONFIG_TEMPLATE_KEY + "' must be set");
+         throw new IllegalArgumentException("The parameter '" + CACHE_CONFIG_TEMPLATE_KEY + "' must be set");
       }
       // Initialize the main cache manager
       this.cacheManager = initCacheManager(cacheConfigTemplate);
@@ -191,7 +191,7 @@
                   // Read the configuration file of the cache
                   is = configManager.getInputStream(cacheConfigTemplate);
                }
-               catch (Exception e)
+               catch (Exception e)//NOSONAR
                {
                   throw new ExoCacheInitException("The configuration of the CacheManager cannot be loaded from '"
                      + cacheConfigTemplate + "'", e);
@@ -211,7 +211,7 @@
                   configBuilder = holder.getGlobalConfigurationBuilder();
                   config = holder.getDefaultConfigurationBuilder().build();
                }
-               catch (Exception e)
+               catch (RuntimeException e) //NOSONAR
                {
                   throw new ExoCacheInitException("Cannot parse the configuration '" + cacheConfigTemplate + "'", e);
                }
@@ -221,7 +221,7 @@
                   // Create the CacheManager from the new configuration
                   return new DefaultCacheManager(configBuilder.build(), config);
                }
-               catch (Exception e)
+               catch (RuntimeException e) //NOSONAR
                {
                   throw new ExoCacheInitException(
                      "Cannot initialize the CacheManager corresponding to the configuration '" + cacheConfigTemplate
@@ -235,7 +235,7 @@
          Throwable cause = e.getCause();
          if (cause instanceof ExoCacheInitException)
          {
-            throw (ExoCacheInitException)cause;
+            throw (ExoCacheInitException)cause;//NOSONAR
          }
          else
          {
@@ -362,7 +362,7 @@
                Throwable cause = e.getCause();
                if (cause instanceof Exception)
                {
-                  throw (Exception)cause;
+                  throw (Exception)cause;//NOSONAR
                }
                else
                {
@@ -385,7 +385,7 @@
             // We expect a distributed cache
             if (distributedCacheManager == null)
             {
-               throw new NullPointerException("The DistributedCacheManager has not been defined in the configuration,"
+               throw new IllegalStateException("The DistributedCacheManager has not been defined in the configuration,"
                   + " please configure it at root container level if you want to use a distributed cache.");
             }
             return new DistributedExoCache(ctx, config,
@@ -440,7 +440,7 @@
                   Throwable cause = e.getCause();
                   if (cause instanceof Exception)
                   {
-                     throw (Exception)cause;
+                     throw (Exception)cause;//NOSONAR
                   }
                   else
                   {
@@ -470,7 +470,7 @@
          Set<String> implementations = creator.getExpectedImplementations();
          if (implementations == null)
          {
-            throw new NullPointerException("The set of implementations cannot be null");
+            throw new IllegalArgumentException("The set of implementations cannot be null");
          }
          for (String imp : implementations)
          {

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -77,7 +77,7 @@
     * Logger.
     */
    private static final Log LOG = ExoLogger
-      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedExoCache");
+      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedExoCache");//NOSONAR
 
    public static final String CACHE_NAME = "eXoCache";
 
@@ -136,7 +136,7 @@
    {
       if (listener == null)
       {
-         throw new NullPointerException();
+         throw new IllegalArgumentException("The listener cannot be null");
       }
       List<ListenerContext> lListeners = getListeners(fullName);
       if (lListeners == null)
@@ -364,7 +364,7 @@
    {
       if (key == null)
       {
-         throw new NullPointerException("No null cache key accepted");
+         throw new IllegalArgumentException("No null cache key accepted");
       }
       else if (value == null)
       {
@@ -400,7 +400,7 @@
    {
       if (objs == null)
       {
-         throw new NullPointerException("No null map accepted");
+         throw new IllegalArgumentException("No null map accepted");
       }
       for (Serializable name : objs.keySet())
       {
@@ -430,7 +430,7 @@
                   onPut(entry.getKey(), entry.getValue());
                }
             }
-            catch (Exception e)
+            catch (Exception e)//NOSONAR
             {
                cache.endBatch(false);
                LOG.warn("An error occurs while executing the putMap method", e);
@@ -448,7 +448,7 @@
    {
       if (name == null)
       {
-         throw new NullPointerException("No null cache key accepted");
+         throw new IllegalArgumentException("No null cache key accepted");
       }
       @SuppressWarnings("rawtypes")
       CacheKey key = new CacheKey<Serializable>(fullName, name);
@@ -570,7 +570,7 @@
          {
             context.onExpire(key.getKey(), obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -592,7 +592,7 @@
          {
             context.onRemove(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -624,7 +624,7 @@
          {
             context.onPut(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -646,7 +646,7 @@
          {
             context.onGet(key, obj);
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);
@@ -668,7 +668,7 @@
          {
             context.onClearCache();
          }
-         catch (Exception e)
+         catch (Exception e)//NOSONAR
          {
             if (LOG.isWarnEnabled())
                LOG.warn("Cannot execute the CacheListener properly", e);

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -124,7 +124,7 @@
       {
          return new GenericExoCache(config, cacheGetter.call());
       }
-      catch (Exception e)
+      catch (Exception e)//NOSONAR
       {
          throw new ExoCacheInitException("Cannot create the cache '" + config.getName() + "'", e);
       }

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -65,7 +65,7 @@
     * The logger
     */
    private static final Log LOG = ExoLogger
-      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedCacheManager");
+      .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedCacheManager");//NOSONAR
 
    /**
     * The parameter name corresponding to the infinispan configuration
@@ -188,9 +188,9 @@
             }
          });
       }
-      catch (Exception e)
+      catch (Exception e)//NOSONAR
       {
-         throw new RuntimeException("Could not initialize the cache manager corresponding to the configuration file "
+         throw new IllegalStateException("Could not initialize the cache manager corresponding to the configuration file "
             + configurationFile, e);
       }
    }
@@ -204,7 +204,7 @@
       Cache<K, V> cache = manager.getCache(cacheName, false);
       if (cache == null)
       {
-         throw new NullPointerException("The expected cache named '" + cacheName
+         throw new IllegalArgumentException("The expected cache named '" + cacheName
             + "' has not been defined in the configuration of infinispan as named cache.");
       }
       return cache;

Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java	2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java	2012-01-19 19:54:39 UTC (rev 5487)
@@ -42,7 +42,7 @@
    /**
     * The logger
     */
-   private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");
+   private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");//NOSONAR
 
    private Utils()
    {
@@ -79,7 +79,7 @@
       }
       catch (IOException e)
       {
-         throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename + "'");
+         throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename + "'", e);
       }
       // Remove the property corresponding to the configuration file
       properties.remove(JGroupsTransport.CONFIGURATION_FILE);
@@ -111,7 +111,7 @@
          {
             inputStream.close();
          }
-         catch (Exception e)
+         catch (IOException e)
          {
             LOG.debug("Cannot close stream", e);
          }



More information about the exo-jcr-commits mailing list