Yair Zaslavsky has uploaded a new change for review.

Change subject: core: Fix exception handling
......................................................................

core: Fix exception handling

Explicit exception handling should be done

Change-Id: I455378d79e2ee2232f96dc18c10b010f954ca3be
Signed-off-by: Yair Zaslavsky <[email protected]>
---
M 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/BatchProcedureExecutionConnectionCallback.java
1 file changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/19352/1

diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/BatchProcedureExecutionConnectionCallback.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/BatchProcedureExecutionConnectionCallback.java
index 5763700..61d092d 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/BatchProcedureExecutionConnectionCallback.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/BatchProcedureExecutionConnectionCallback.java
@@ -1,5 +1,6 @@
 package org.ovirt.engine.core.dal.dbbroker;
 
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.sql.CallableStatement;
 import java.sql.Connection;
@@ -183,8 +184,13 @@
                         if (method == null)
                             method = value.getClass().getMethod("ordinal");
                         value = method.invoke(value);
-                    } catch (Exception e) {
-                        log.error("Can't map Enum type " + value);
+                    } catch (NoSuchMethodException ex) {
+                        handleMappingException(value, ex);
+                    } catch (InvocationTargetException ex) {
+                        handleMappingException(value, ex);
+
+                    } catch (IllegalAccessException ex) {
+                        handleMappingException(value, ex);
                     }
                 }
 
@@ -219,6 +225,11 @@
         log.debugFormat("Mapped params %s", values.keySet());
     }
 
+    private void handleMappingException(Object value, Exception ex) {
+        log.error("Can't map Enum type " + value + "Exception is: " + 
ex.getMessage());
+        log.debug("", ex);
+    }
+
     private  static class ProcData {
         private String colName;
         private int ordinal;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I455378d79e2ee2232f96dc18c10b010f954ca3be
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to