You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by re...@apache.org on 2012/05/02 12:10:51 UTC

svn commit: r1332975 - in /incubator/syncope/trunk/core/src: main/java/org/apache/syncope/core/init/ main/java/org/apache/syncope/core/persistence/beans/user/ main/java/org/apache/syncope/core/persistence/dao/impl/ main/java/org/apache/syncope/core/per...

Author: rene
Date: Wed May  2 10:10:50 2012
New Revision: 1332975

URL: http://svn.apache.org/viewvc?rev=1332975&view=rev
Log:
sonar: controlled replacement of catching throwable with catching exception to prevent masking of Errors such as OutOfMemoryError

Modified:
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/JobInstanceLoader.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserSearchDAOImpl.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SchedTaskValidator.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SyncTaskValidator.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/NotificationJob.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/EntitlementUtil.java
    incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java
    incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractTest.java
    incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
    incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java
    incubator/syncope/trunk/core/src/test/notifications/java/org/apache/syncope/core/notification/NotificationTest.java

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentLoader.java Wed May  2 10:10:50 2012
@@ -119,8 +119,8 @@ public class ContentLoader {
             }
 
             LOG.debug("Views created, go for indexes");
-        } catch (Throwable t) {
-            LOG.error("While creating views", t);
+        } catch (Exception e) {
+            LOG.error("While creating views", e);
         }
 
         // 3. Create indexes
@@ -143,8 +143,8 @@ public class ContentLoader {
             }
 
             LOG.debug("Indexes created, go for default content");
-        } catch (Throwable t) {
-            LOG.error("While creating indexes", t);
+        } catch (Exception e) {
+            LOG.error("While creating indexes", e);
         }
 
         try {
@@ -169,8 +169,8 @@ public class ContentLoader {
             SAXParser parser = factory.newSAXParser();
             parser.parse(getClass().getResourceAsStream("/content.xml"), importExport);
             LOG.debug("Default content successfully loaded");
-        } catch (Throwable t) {
-            LOG.error("While loading default content", t);
+        } catch (Exception e) {
+            LOG.error("While loading default content", e);
         }
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/JobInstanceLoader.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/JobInstanceLoader.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/JobInstanceLoader.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/JobInstanceLoader.java Wed May  2 10:10:50 2012
@@ -148,9 +148,9 @@ public class JobInstanceLoader {
             if (StringUtils.isNotBlank(jobActionsClassName)) {
                 try {
                     syncJobActionsClass = Class.forName(jobActionsClassName);
-                } catch (Throwable t) {
+                } catch (Exception e) {
                     LOG.error("Class {} not found, reverting to {}", new Object[] { jobActionsClassName,
-                            syncJobActionsClass.getName(), t });
+                            syncJobActionsClass.getName(), e });
                 }
             }
             SyncJobActions syncJobActions = (SyncJobActions) getBeanFactory().createBean(syncJobActionsClass,

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/user/SyncopeUser.java Wed May  2 10:10:50 2012
@@ -267,8 +267,8 @@ public class SyncopeUser extends Abstrac
         try {
             this.password = encodePassword(password, cipherAlgoritm);
             this.cipherAlgorithm = cipherAlgoritm;
-        } catch (Throwable t) {
-            LOG.error("Could not encode password", t);
+        } catch (Exception e) {
+            LOG.error("Could not encode password", e);
             this.password = null;
         }
     }
@@ -534,8 +534,8 @@ public class SyncopeUser extends Abstrac
                         : passwordHistory.size() - size, passwordHistory.size()).contains(cipherAlgorithm != null
                         ? encodePassword(password, cipherAlgorithm)
                         : password);
-            } catch (Throwable t) {
-                LOG.error("Error evaluating password history", t);
+            } catch (Exception e) {
+                LOG.error("Error evaluating password history", e);
             }
         }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserSearchDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserSearchDAOImpl.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserSearchDAOImpl.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserSearchDAOImpl.java Wed May  2 10:10:50 2012
@@ -133,8 +133,8 @@ public class UserSearchDAOImpl extends A
             } else {
                 try {
                     result = doSearch(adminRoles, searchCondition, page, itemsPerPage);
-                } catch (Throwable t) {
-                    LOG.error("While searching users", t);
+                } catch (Exception e) {
+                    LOG.error("While searching users", e);
                 }
             }
         }

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SchedTaskValidator.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SchedTaskValidator.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SchedTaskValidator.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SchedTaskValidator.java Wed May  2 10:10:50 2012
@@ -41,8 +41,8 @@ public class SchedTaskValidator extends 
         try {
             jobClass = Class.forName(object.getJobClassName());
             isValid = AbstractTaskJob.class.isAssignableFrom(jobClass);
-        } catch (Throwable t) {
-            LOG.error("Invalid Job class specified", t);
+        } catch (Exception e) {
+            LOG.error("Invalid Job class specified", e);
             isValid = false;
         }
         if (jobClass == null || !isValid) {

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SyncTaskValidator.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SyncTaskValidator.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SyncTaskValidator.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/SyncTaskValidator.java Wed May  2 10:10:50 2012
@@ -65,8 +65,8 @@ public class SyncTaskValidator extends A
                     try {
                         syncJobActionsClass = Class.forName(object.getJobActionsClassName());
                         isAssignable = SyncJobActions.class.isAssignableFrom(syncJobActionsClass);
-                    } catch (Throwable t) {
-                        LOG.error("Invalid SyncJobActions specified", t);
+                    } catch (Exception e) {
+                        LOG.error("Invalid SyncJobActions specified", e);
                         isValid = false;
                     }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/ConnectorFacadeProxy.java Wed May  2 10:10:50 2012
@@ -458,9 +458,9 @@ public class ConnectorFacadeProxy {
                     }
                 }
             }
-        } catch (Throwable t) {
-            // catch throwable in order to manage unpredictable behaviors
-            LOG.debug("Unsupported operation {}", t);
+        } catch (Exception e) {
+            // catch exception in order to manage unpredictable behaviors
+            LOG.debug("Unsupported operation {}", e);
         }
 
         return resourceSchemaNames;
@@ -556,8 +556,8 @@ public class ConnectorFacadeProxy {
                 } else {
                     value = values.get(0).toString();
                 }
-            } catch (Throwable t) {
-                LOG.error("Invalid ConnConfProperty specified: {}", property, t);
+            } catch (Exception e) {
+                LOG.error("Invalid ConnConfProperty specified: {}", property, e);
             }
         }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/PropagationManager.java Wed May  2 10:10:50 2012
@@ -456,8 +456,8 @@ public class PropagationManager {
                     }
 
                 }
-            } catch (Throwable t) {
-                LOG.debug("Attribute '{}' processing failed", SchemaMappingUtil.getIntAttrName(mapping), t);
+            } catch (Exception e) {
+                LOG.debug("Attribute '{}' processing failed", SchemaMappingUtil.getIntAttrName(mapping), e);
             }
         }
 
@@ -743,15 +743,15 @@ public class PropagationManager {
                 throw e;
             }
 
-        } catch (Throwable t) {
-            LOG.error("Exception during provision on resource " + task.getResource().getName(), t);
+        } catch (Exception e) {
+            LOG.error("Exception during provision on resource " + task.getResource().getName(), e);
 
-            if (t instanceof ConnectorException && t.getCause() != null) {
-                taskExecutionMessage = t.getCause().getMessage();
+            if (e instanceof ConnectorException && e.getCause() != null) {
+                taskExecutionMessage = e.getCause().getMessage();
             } else {
                 StringWriter exceptionWriter = new StringWriter();
-                exceptionWriter.write(t.getMessage() + "\n\n");
-                t.printStackTrace(new PrintWriter(exceptionWriter));
+                exceptionWriter.write(e.getMessage() + "\n\n");
+                e.printStackTrace(new PrintWriter(exceptionWriter));
                 taskExecutionMessage = exceptionWriter.toString();
             }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java Wed May  2 10:10:50 2012
@@ -214,10 +214,10 @@ public class ConfigurationController ext
             auditManager.audit(Category.configuration, ConfigurationSubCategory.dbExport, Result.success,
                     "Successfully exported database content");
             LOG.debug("Database content successfully exported");
-        } catch (Throwable t) {
+        } catch (Exception e) {
             auditManager.audit(Category.configuration, ConfigurationSubCategory.dbExport, Result.failure,
-                    "Could not export database content", t);
-            LOG.error("While exporting database content", t);
+                    "Could not export database content", e);
+            LOG.error("While exporting database content", e);
         }
     }
 }

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ConnInstanceController.java Wed May  2 10:10:50 2012
@@ -100,15 +100,15 @@ public class ConnInstanceController exte
             connInstance = connInstanceDAO.save(connInstance);
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.success,
                     "Successfully created connector instance: " + connInstance.getDisplayName());
-        } catch (Throwable t) {
+        } catch (Exception e) {
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
-                    "Could not create connector instance: " + connectorTO.getDisplayName(), t);
+                    "Could not create connector instance: " + connectorTO.getDisplayName(), e);
 
             SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
             SyncopeClientException invalidConnInstance = new SyncopeClientException(
                     SyncopeClientExceptionType.InvalidConnInstance);
-            invalidConnInstance.addElement(t.getMessage());
+            invalidConnInstance.addElement(e.getMessage());
 
             scce.addException(invalidConnInstance);
             throw scce;
@@ -131,15 +131,15 @@ public class ConnInstanceController exte
             connInstance = connInstanceDAO.save(connInstance);
             auditManager.audit(Category.connector, ConnectorSubCategory.update, Result.success,
                     "Successfully update connector instance: " + connInstance.getDisplayName());
-        } catch (Throwable t) {
+        } catch (Exception e) {
             auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
-                    "Could not update connector instance: " + connectorTO.getDisplayName(), t);
+                    "Could not update connector instance: " + connectorTO.getDisplayName(), e);
 
             SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
             SyncopeClientException invalidConnInstance = new SyncopeClientException(
                     SyncopeClientExceptionType.InvalidConnInstance);
-            invalidConnInstance.addElement(t.getMessage());
+            invalidConnInstance.addElement(e.getMessage());
 
             scce.addException(invalidConnInstance);
             throw scce;

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/controller/ReportController.java Wed May  2 10:10:50 2012
@@ -335,8 +335,8 @@ public class ReportController extends Ab
             pipeline.execute();
 
             LOG.debug("Result of {} successfully exported as {}", reportExec, format);
-        } catch (Throwable t) {
-            LOG.error("While exporting content", t);
+        } catch (Exception e) {
+            LOG.error("While exporting content", e);
         } finally {
             try {
                 zis.close();

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/NotificationJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/NotificationJob.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/NotificationJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/NotificationJob.java Wed May  2 10:10:50 2012
@@ -179,13 +179,13 @@ public class NotificationJob implements 
 
                     auditManager.audit(Category.notification, NotificationSubCategory.sent, Result.success,
                             "Successfully sent notification to " + to);
-                } catch (Throwable t) {
-                    LOG.error("Could not send e-mail", t);
+                } catch (Exception e) {
+                    LOG.error("Could not send e-mail", e);
 
                     execution.setStatus(Status.NOT_SENT.name());
                     StringWriter exceptionWriter = new StringWriter();
-                    exceptionWriter.write(t.getMessage() + "\n\n");
-                    t.printStackTrace(new PrintWriter(exceptionWriter));
+                    exceptionWriter.write(e.getMessage() + "\n\n");
+                    e.printStackTrace(new PrintWriter(exceptionWriter));
 
                     if (task.getTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) {
 
@@ -193,7 +193,7 @@ public class NotificationJob implements 
                     }
 
                     auditManager.audit(Category.notification, NotificationSubCategory.sent, Result.failure,
-                            "Could not send notification to " + to, t);
+                            "Could not send notification to " + to, e);
                 }
 
                 execution.setEndDate(new Date());

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/scheduling/SyncJob.java Wed May  2 10:10:50 2012
@@ -337,10 +337,10 @@ public class SyncJob extends AbstractTas
                 result.setStatus(Status.SUCCESS);
             } catch (PropagationException e) {
                 LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
-            } catch (Throwable t) {
+            } catch (Exception e) {
                 result.setStatus(Status.FAILURE);
-                result.setMessage(t.getMessage());
-                LOG.error("Could not create user " + delta.getUid().getUidValue(), t);
+                result.setMessage(e.getMessage());
+                LOG.error("Could not create user " + delta.getUid().getUidValue(), e);
             }
         }
 
@@ -391,10 +391,10 @@ public class SyncJob extends AbstractTas
                     }
                 } catch (PropagationException e) {
                     LOG.error("Could not propagate user " + delta.getUid().getUidValue(), e);
-                } catch (Throwable t) {
+                } catch (Exception e) {
                     result.setStatus(Status.FAILURE);
-                    result.setMessage(t.getMessage());
-                    LOG.error("Could not update user " + delta.getUid().getUidValue(), t);
+                    result.setMessage(e.getMessage());
+                    LOG.error("Could not update user " + delta.getUid().getUidValue(), e);
                 }
 
                 delta = actions.after(delta, userTO, result);
@@ -442,10 +442,10 @@ public class SyncJob extends AbstractTas
 
                     try {
                         wfAdapter.delete(userId);
-                    } catch (Throwable t) {
+                    } catch (Exception e) {
                         result.setStatus(Status.FAILURE);
-                        result.setMessage(t.getMessage());
-                        LOG.error("Could not delete user " + userId, t);
+                        result.setMessage(e.getMessage());
+                        LOG.error("Could not delete user " + userId, e);
                     }
                 }
 
@@ -666,12 +666,12 @@ public class SyncJob extends AbstractTas
                     resource.setSyncToken(connector.getLatestSyncToken());
                     resourceDAO.save(resource);
 
-                } catch (Throwable t) {
-                    throw new JobExecutionException("While updating SyncToken", t);
+                } catch (Exception e) {
+                    throw new JobExecutionException("While updating SyncToken", e);
                 }
             }
-        } catch (Throwable t) {
-            throw new JobExecutionException("While syncing on connector", t);
+        } catch (Exception e) {
+            throw new JobExecutionException("While syncing on connector", e);
         }
 
         actions.afterAll(syncTask, results);

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/EntitlementUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/EntitlementUtil.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/EntitlementUtil.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/EntitlementUtil.java Wed May  2 10:10:50 2012
@@ -26,10 +26,14 @@ import org.springframework.security.core
 import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.apache.syncope.core.persistence.beans.Entitlement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class EntitlementUtil {
 
     private static final Pattern ROLE_ENTITLEMENT_NAME_PATTERN = Pattern.compile("^ROLE_([\\d])+");
+    private static final Logger LOG = LoggerFactory.getLogger(EntitlementUtil.class);
+
 
     public static Set<String> getOwnedEntitlementNames() {
         final Set<String> result = new HashSet<String>();
@@ -59,7 +63,8 @@ public class EntitlementUtil {
         if (isRoleEntitlement(entitlementName)) {
             try {
                 result = Long.valueOf(entitlementName.substring(entitlementName.indexOf("_") + 1));
-            } catch (Throwable t) {
+            } catch (Exception e) {
+                LOG.error("unable to parse {} to Long", entitlementName, e);
             }
         }
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ImportExport.java Wed May  2 10:10:50 2012
@@ -86,9 +86,9 @@ public class ImportExport extends Defaul
             Properties dbProps = new Properties();
             dbProps.load(dbPropsStream);
             schema = dbProps.getProperty("database.schema");
-        } catch (Throwable t) {
+        } catch (Exception e) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Could not find persistence.properties", t);
+                LOG.debug("Could not find persistence.properties", e);
             } else {
                 LOG.error("Could not find persistence.properties");
             }

Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractTest.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/AbstractTest.java Wed May  2 10:10:50 2012
@@ -84,8 +84,8 @@ public abstract class AbstractTest {
             props.load(propStream);
             connidSoapVersion = props.getProperty("connid.soap.version");
             bundlesDirectory = props.getProperty("bundles.directory");
-        } catch (Throwable t) {
-            LOG.error("Could not load bundles.properties", t);
+        } catch (Exception e) {
+            LOG.error("Could not load bundles.properties", e);
         }
         assertNotNull(connidSoapVersion);
         assertNotNull(bundlesDirectory);

Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/SchemaTest.java Wed May  2 10:10:50 2012
@@ -104,11 +104,11 @@ public class SchemaTest extends Abstract
         schema.setType(SchemaType.Enum);
         schema.setName("color");
 
-        Throwable ex = null;
+        Exception ex = null;
         try {
             schemaDAO.save(schema);
-        } catch (Throwable t) {
-            ex = t;
+        } catch (Exception e) {
+            ex = e;
         }
         assertNotNull(ex);
 

Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ConnInstanceTestITCase.java Wed May  2 10:10:50 2012
@@ -62,8 +62,8 @@ public class ConnInstanceTestITCase exte
             connidSoapVersion = props.getProperty("connid.soap.version");
             connidDbTableVersion = props.getProperty("connid.db.table.version");
             bundlesDirectory = props.getProperty("bundles.directory");
-        } catch (Throwable t) {
-            LOG.error("Could not load bundles.properties", t);
+        } catch (Exception e) {
+            LOG.error("Could not load bundles.properties", e);
         } finally {
             if (propStream != null) {
                 try {

Modified: incubator/syncope/trunk/core/src/test/notifications/java/org/apache/syncope/core/notification/NotificationTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/notifications/java/org/apache/syncope/core/notification/NotificationTest.java?rev=1332975&r1=1332974&r2=1332975&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/notifications/java/org/apache/syncope/core/notification/NotificationTest.java (original)
+++ incubator/syncope/trunk/core/src/test/notifications/java/org/apache/syncope/core/notification/NotificationTest.java Wed May  2 10:10:50 2012
@@ -235,8 +235,8 @@ public class NotificationTest {
             }
             inbox.close(true);
             store.close();
-        } catch (Throwable t) {
-            LOG.error("Unexpected exception", t);
+        } catch (Exception e) {
+            LOG.error("Unexpected exception", e);
             fail("Unexpected exception while fetching e-mail");
         }
 
@@ -278,8 +278,8 @@ public class NotificationTest {
             SyncopeConf smtpHostConf = confDAO.find("smtp.host");
             smtpHostConf.setValue(smtpHost);
             confDAO.save(smtpHostConf);
-        } catch (Throwable t) {
-            LOG.error("Unexpected exception", t);
+        } catch (Exception e) {
+            LOG.error("Unexpected exception", e);
             fail("Unexpected exception while setting SMTP host");
         }
 
@@ -293,8 +293,8 @@ public class NotificationTest {
 
         try {
             userController.create(new MockHttpServletResponse(), userTO);
-        } catch (Throwable t) {
-            LOG.error("Unexpected exception", t);
+        } catch (Exception e) {
+            LOG.error("Unexpected exception", e);
             fail("Unexpected exception while creating");
         }
 
@@ -320,8 +320,8 @@ public class NotificationTest {
         // 5. execute Notification task and verify e-mail
         try {
             taskController.execute(taskId, false);
-        } catch (Throwable t) {
-            LOG.error("Unexpected exception", t);
+        } catch (Exception e) {
+            LOG.error("Unexpected exception", e);
             fail("Unexpected exception while executing notification task");
         }