[exo-jcr-commits] exo-jcr SVN: r5603 - in kernel/branches/2.4.x: exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Feb 10 09:00:34 EST 2012


Author: andrew.plotnikov
Date: 2012-02-10 09:00:29 -0500 (Fri, 10 Feb 2012)
New Revision: 5603

Modified:
   kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
   kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
   kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/ManagedDataSource.java
   kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/net/impl/NetServiceImpl.java
   kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java
   kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
   kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
   kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
   kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ExoWurflSource.java
   kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
   kernel/branches/2.4.x/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntConfig.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2

Modified: kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -175,13 +175,6 @@
    @Override
    public ExoCacheConfig clone() throws CloneNotSupportedException
    {
-      try
-      {
-         return (ExoCacheConfig)super.clone();
-      }
-      catch (Exception e)
-      {
-         throw new AssertionError();
-      }
+      return (ExoCacheConfig)super.clone();
    }
 }

Modified: kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -222,13 +222,27 @@
          {
             cache = task.get();
          }
-         catch (Exception e)
+         catch (CancellationException e)
          {
             if (LOG.isTraceEnabled())
             {
                LOG.trace("An exception occurred: " + e.getMessage());
             }
          }
+         catch (InterruptedException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
+         catch (ExecutionException e)
+         {
+            if (LOG.isTraceEnabled())
+            {
+               LOG.trace("An exception occurred: " + e.getMessage());
+            }
+         }
          if (cache != null)
          {
             caches.add(cache);            
@@ -284,11 +298,31 @@
                final Class<?> clazz = ClassLoading.loadClass(config.getImplementation(), this);
                return (ExoCache)clazz.newInstance();
             }
-            catch (Exception e)
+            catch (ExceptionInInitializerError e)
             {
                throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
                   + config.getImplementation(), e);
             }
+            catch (SecurityException e)
+            {
+               throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
+                  + config.getImplementation(), e);
+            }
+            catch (ClassNotFoundException e)
+            {
+               throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
+                  + config.getImplementation(), e);
+            }
+            catch (InstantiationException e)
+            {
+               throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
+                  + config.getImplementation(), e);
+            }
+            catch (IllegalAccessException e)
+            {
+               throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
+                  + config.getImplementation(), e);
+            }
          }
       }
    }

Modified: kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/ManagedDataSource.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/ManagedDataSource.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/ManagedDataSource.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -27,6 +27,7 @@
 
 import javax.sql.DataSource;
 import javax.transaction.Status;
+import javax.transaction.SystemException;
 import javax.transaction.TransactionManager;
 
 /**
@@ -145,7 +146,7 @@
       {
          return tm != null && tm.getStatus() != Status.STATUS_NO_TRANSACTION;
       }
-      catch (Exception e)
+      catch (SystemException e)
       {
          LOG.warn("We cannot know if a global tx is active", e);
       }

Modified: kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/net/impl/NetServiceImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/net/impl/NetServiceImpl.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/net/impl/NetServiceImpl.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -22,6 +22,7 @@
 import org.exoplatform.services.net.NetService;
 
 import java.net.Socket;
+import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 
 /**
@@ -47,7 +48,7 @@
          });
          endTime = System.currentTimeMillis();
       }
-      catch (Exception e)
+      catch (PrivilegedActionException e)
       {
          // e.printStackTrace() ;
          return -1;

Modified: kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -106,7 +106,7 @@
       {
          scheduler_.shutdown();
       }
-      catch (Exception ex)
+      catch (SchedulerException ex)
       {
          log.warn("Could not shutdown the scheduler", ex);
       }

Modified: kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/ExoCacheFactoryImpl.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -242,7 +242,7 @@
             }
          };
       }
-      catch (Exception e)
+      catch (IllegalArgumentException e)
       {
          LOG.error("Could not create the JMX Manager", e);
       }

Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -36,6 +36,7 @@
 import org.exoplatform.services.log.Log;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.PrivilegedAction;
@@ -354,7 +355,7 @@
       {
          SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
          {
-            public Void run() throws Exception
+            public Void run() throws IOException
             {
                url.openStream().close();
                return null;
@@ -362,7 +363,7 @@
          });
          return true;
       }
-      catch (Exception e)
+      catch (IOException e)
       {
          return false;
       }

Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/management/ManageableContainer.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -46,6 +46,7 @@
 import java.util.Set;
 
 import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 /**
@@ -201,7 +202,7 @@
                   {
                      this.objectName = JMX.createObjectName("exo", props);
                   }
-                  catch (Exception e)
+                  catch (MalformedObjectNameException e)
                   {
                      LOG.error("Could not create the object name", e);
                   }

Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ExoWurflSource.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ExoWurflSource.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/container/util/ExoWurflSource.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -21,6 +21,7 @@
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 //import net.sourceforge.wurfl.wurflapi.WurflSource;
@@ -41,7 +42,7 @@
       {
          return wurflUrl.openStream();
       }
-      catch (Exception e)
+      catch (IOException e)
       {
          LOG.error(e.getLocalizedMessage(), e);
          return null;

Modified: kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.container/src/main/java/org/exoplatform/management/jmx/impl/JMXManagementProvider.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -32,11 +32,14 @@
 import java.util.Map;
 
 import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
 import javax.management.MBeanRegistrationException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
+import javax.management.RuntimeOperationsException;
+import javax.management.modelmbean.InvalidTargetObjectTypeException;
 import javax.management.modelmbean.ModelMBeanInfo;
 
 /**
@@ -73,11 +76,41 @@
          ModelMBeanInfo info = infoBuilder.build();
          mbean = new ExoModelMBean(context, context.getResource(), info);
       }
-      catch (Exception e)
+      catch (IllegalArgumentException e)
       {
-         LOG.warn("Could not create the ExoModelMBean for the class " + 
-                  (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())), e);
+         LOG.warn(
+            "Could not create the ExoModelMBean for the class "
+               + (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())),
+            e);
       }
+      catch (RuntimeOperationsException e)
+      {
+         LOG.warn(
+            "Could not create the ExoModelMBean for the class "
+               + (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())),
+            e);
+      }
+      catch (InstanceNotFoundException e)
+      {
+         LOG.warn(
+            "Could not create the ExoModelMBean for the class "
+               + (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())),
+            e);
+      }
+      catch (MBeanException e)
+      {
+         LOG.warn(
+            "Could not create the ExoModelMBean for the class "
+               + (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())),
+            e);
+      }
+      catch (InvalidTargetObjectTypeException e)
+      {
+         LOG.warn(
+            "Could not create the ExoModelMBean for the class "
+               + (context == null ? null : (context.getResource() == null ? null : context.getResource().getClass())),
+            e);
+      }
 
       //
       if (mbean != null)
@@ -166,7 +199,7 @@
                   }
                });
             }
-            catch (Exception e)
+            catch (PrivilegedActionException e)
             {
                throw new RuntimeException("Failed to unregister MBean '" + name + " due to " + e.getMessage(), e);
             }
@@ -182,7 +215,7 @@
                }
             });
          }
-         catch (Exception e)
+         catch (PrivilegedActionException e)
          {
             throw new RuntimeException("Failed to register MBean '" + name + " due to " + e.getMessage(), e);
          }

Modified: kernel/branches/2.4.x/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntConfig.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntConfig.java	2012-02-10 13:04:52 UTC (rev 5602)
+++ kernel/branches/2.4.x/exo.kernel.mc-integration/exo.kernel.mc-int/src/main/java/org/exoplatform/container/mc/impl/MCIntConfig.java	2012-02-10 14:00:29 UTC (rev 5603)
@@ -26,6 +26,7 @@
 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.xb.binding.JBossXBException;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
 import org.jboss.xb.binding.resolver.MutableSchemaResolver;
@@ -233,7 +234,7 @@
       {
          deployment = (KernelDeployment) unmarshaller.unmarshal(url.toString(), resolver);
       }
-      catch (Exception e)
+      catch (JBossXBException e)
       {
          throw new RuntimeException("Failed to parse xml " + url, e);
       }



More information about the exo-jcr-commits mailing list