Allon Mureinik has uploaded a new change for review.

Change subject: core: broad catch in LdapTemplateWrapperFactory
......................................................................

core: broad catch in LdapTemplateWrapperFactory

Replaced a catch (Exception e) clause with a series of piped catches
that cover all the exceptions that can be thrown in this block.

Besides being a good defensive practice and cleaning up the code, this
patch solves the REC_CATCH_EXCEPTION FindBugs warning for this block.

Change-Id: Iea983982865d740d2ca0a852454931fb0de0ed8c
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LDAPTemplateWrapperFactory.java
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/48/22148/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LDAPTemplateWrapperFactory.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LDAPTemplateWrapperFactory.java
index 0412389..952b317 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LDAPTemplateWrapperFactory.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/LDAPTemplateWrapperFactory.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.core.bll.adbroker;
 
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 
 import org.ovirt.engine.core.utils.log.Log;
@@ -47,7 +48,8 @@
             Constructor<? extends LDAPTemplateWrapper> constructor = 
wrapperClass.getConstructor(
                     LdapContextSource.class, String.class, String.class, 
String.class);
             return constructor.newInstance(contextSource, userName, password, 
domain);
-        } catch (Exception ex) {
+        } catch (IllegalAccessException | IllegalArgumentException | 
InstantiationException |
+                InvocationTargetException | NoSuchMethodException | 
SecurityException e) {
             log.error("Failed to get LDAPTemplateWrapper for security 
authentication "
                     + ldapSecurityAuthentication.toString());
             return null;


-- 
To view, visit http://gerrit.ovirt.org/22148
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea983982865d740d2ca0a852454931fb0de0ed8c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to