[exo-jcr-commits] exo-jcr SVN: r5589 - in core/branches/2.5.x: exo.core.component.database/src/main/java/org/exoplatform/services/database/impl and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Feb 9 03:11:09 EST 2012


Author: andrew.plotnikov
Date: 2012-02-09 03:11:07 -0500 (Thu, 09 Feb 2012)
New Revision: 5589

Modified:
   core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
   core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
   core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
   core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
   core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
   core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
   core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
   core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
   core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
   core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
   core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
   core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2

Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -92,10 +92,6 @@
       {
          return loadUnique(connection, query);
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);
@@ -137,10 +133,6 @@
       {
          loadInstances(connection, loadQuery, list);
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);
@@ -172,10 +164,6 @@
       {
          execute(connection, query, bean);
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);
@@ -204,10 +192,6 @@
       {
          return this.<E> loadDBField(connection, query);
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);
@@ -238,10 +222,6 @@
       {
          execute(connection, template, beans);
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);

Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -120,10 +120,6 @@
          resultSet.close();
          statement.close();
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          dao_.getExoDatasource().closeConnection(connection);
@@ -151,10 +147,6 @@
          statement.close();
          return list;
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          dao_.getExoDatasource().closeConnection(connection);

Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -34,6 +34,7 @@
 import org.exoplatform.services.log.ExoLogger;
 import org.exoplatform.services.log.Log;
 import org.hibernate.HibernateException;
+import org.hibernate.MappingException;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.cfg.Configuration;
@@ -263,14 +264,17 @@
                {
                   Class<?> clazz = ClassLoading.loadClass(annotation, this);
                   conf_.addAnnotatedClass(clazz);
-
                }
             }
          }
-         catch (Exception ex)
+         catch (MappingException ex)
          {
             LOG.error(ex.getLocalizedMessage(), ex);
          }
+         catch (ClassNotFoundException ex)
+         {
+            LOG.error(ex.getLocalizedMessage(), ex);
+         }
       }
    }
 

Modified: core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -122,12 +122,10 @@
          long id = childImpl.getDBObjectId();
          execute(connection, eXoDS_.getQueryBuilder().createInsertQuery(type_, id), childImpl);
          if (broadcast)
+         {
             listenerService_.broadcast("organization.group.postSave", this, childImpl);
+         }
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);

Modified: core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -269,10 +269,6 @@
             listenerService_.broadcast("organization.membership.postDelete", this, membershipImpl);
          return membershipImpl;
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);
@@ -319,10 +315,6 @@
          }
          return list;
       }
-      catch (Exception e)
-      {
-         throw e;
-      }
       finally
       {
          eXoDS_.closeConnection(connection);

Modified: core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -30,6 +30,7 @@
 import java.util.regex.Pattern;
 
 import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
@@ -115,7 +116,7 @@
             return;
          }
       }
-      catch (Exception exp)
+      catch (NamingException exp)
       {
          if (LOG.isTraceEnabled())
          {

Modified: core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -443,7 +443,7 @@
       {
          return ldapService.authenticate(userDN, password);
       }
-      catch (Exception exp)
+      catch (NamingException exp)
       {
          return false;
       }

Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -94,7 +94,7 @@
 
          return DEFAULT_CONCURRENCY_LEVEL;
       }
-      catch (Exception e)
+      catch (NumberFormatException e)
       {
          LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
          return DEFAULT_CONCURRENCY_LEVEL;

Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -82,7 +82,7 @@
 
          return DEFAULT_CONCURRENCY_LEVEL;
       }
-      catch (Exception e)
+      catch (NumberFormatException e)
       {
          LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
          return DEFAULT_CONCURRENCY_LEVEL;

Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -187,13 +187,34 @@
          field.setAccessible(true);
          password = (String)field.get(objectFromCallback);
       }
-      catch (Exception e)
+      catch (IllegalArgumentException e)
       {
          if (LOG.isErrorEnabled())
          {
             LOG.error("Could not get credentials.", e);
          }
       }
+      catch (NoSuchFieldException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get credentials.", e);
+         }
+      }
+      catch (SecurityException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get credentials.", e);
+         }
+      }
+      catch (IllegalAccessException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get credentials.", e);
+         }
+      }
 
       if (username == null || password == null)
       {
@@ -207,19 +228,41 @@
    {
       String username = null;
       Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
       try
       {
          Field field = digestAuthenticatorClazz.getDeclaredField("username");
          field.setAccessible(true);
          username = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
       }
-      catch (Exception e)
+      catch (IllegalArgumentException e)
       {
          if (LOG.isErrorEnabled())
          {
             LOG.error("Could not get username.", e);
          }
       }
+      catch (IllegalAccessException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get username.", e);
+         }
+      }
+      catch (NoSuchFieldException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get username.", e);
+         }
+      }
+      catch (SecurityException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get username.", e);
+         }
+      }
 
       return new UsernameCredential(username);
    }
@@ -229,19 +272,41 @@
    {
       String password = null;
       Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
       try
       {
          Field field = digestAuthenticatorClazz.getDeclaredField("response");
          field.setAccessible(true);
          password = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
       }
-      catch (Exception e)
+      catch (IllegalArgumentException e)
       {
          if (LOG.isErrorEnabled())
          {
             LOG.error("Could not get password.", e);
          }
       }
+      catch (IllegalAccessException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get password.", e);
+         }
+      }
+      catch (NoSuchFieldException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get password.", e);
+         }
+      }
+      catch (SecurityException e)
+      {
+         if (LOG.isErrorEnabled())
+         {
+            LOG.error("Could not get password.", e);
+         }
+      }
 
       return password;
    }

Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -26,6 +26,7 @@
 
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionEvent;
 
@@ -81,10 +82,14 @@
             }
          }
       }
-      catch (Exception e)
+      catch (LoginException e)
       {
          LOG.error("Can't remove conversation state " + httpSession.getId());
       }
+      catch (SecurityException e)
+      {
+         LOG.error("Can't remove conversation state " + httpSession.getId());
+      }
    }
 
 }

Modified: core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java	2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java	2012-02-09 08:11:07 UTC (rev 5589)
@@ -126,10 +126,18 @@
                else
                   LOG.error("XSLT schema not found: " + xsltSchema);
             }
-            catch (Exception e)
+            catch (IllegalArgumentException e)
             {
                LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
             }
+            catch (TransformerException e)
+            {
+               LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+            }
+            catch (NotSupportedIOTypeException e)
+            {
+               LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+            }
          }
       }
    }



More information about the exo-jcr-commits mailing list