svn commit: r570729 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: datasource/GenericDAO.java jdbc/SQLProcessor.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r570729 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: datasource/GenericDAO.java jdbc/SQLProcessor.java

jonesde
Author: jonesde
Date: Wed Aug 29 03:03:11 2007
New Revision: 570729

URL: http://svn.apache.org/viewvc?rev=570729&view=rev
Log:
A few improvements to make error logs less redundant

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=570729&r1=570728&r2=570729&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Wed Aug 29 03:03:11 2007
@@ -113,7 +113,8 @@
             return singleInsert(entity, modelEntity, modelEntity.getFieldsCopy(), sqlP);
         } catch (GenericEntityException e) {
             sqlP.rollback();
-            throw new GenericEntityException("Exception while inserting the following entity: " + entity.toString(), e);
+            // no need to create nested, just throw original which will have all info: throw new GenericEntityException("Exception while inserting the following entity: " + entity.toString(), e);
+            throw e;
         } finally {
             sqlP.close();
         }
@@ -168,7 +169,7 @@
             entity.synchronizedWithDatasource();
             return retVal;
         } catch (GenericEntityException e) {
-            throw new GenericEntityException("while inserting: " + entity.toString(), e);
+            throw new GenericEntityException("Error while inserting: " + entity.toString(), e);
         } finally {
             sqlP.close();
         }
@@ -212,7 +213,8 @@
             return singleUpdate(entity, modelEntity, fieldsToSave, sqlP);
         } catch (GenericEntityException e) {
             sqlP.rollback();
-            throw new GenericEntityException("Exception while updating the following entity: " + entity.toString(), e);
+            // no need to create nested, just throw original which will have all info: throw new GenericEntityException("Exception while updating the following entity: " + entity.toString(), e);
+            throw e;
         } finally {
             sqlP.close();
         }
@@ -270,7 +272,7 @@
             retVal = sqlP.executeUpdate();
             entity.synchronizedWithDatasource();
         } catch (GenericEntityException e) {
-            throw new GenericEntityException("while updating: " + entity.toString(), e);
+            throw new GenericEntityException("Error while updating: " + entity.toString(), e);
         } finally {
             sqlP.close();
         }
@@ -327,7 +329,7 @@
             while (fi.hasNext()) {
                 ModelField field = (ModelField) fi.next();
                 Object value = fieldsToSet.get(field.getName());
-                SqlJdbcUtil.setValue(sqlP, field, modelEntity.getEntityName(), value, modelFieldTypeReader );
+                SqlJdbcUtil.setValue(sqlP, field, modelEntity.getEntityName(), value, modelFieldTypeReader);
             }
 
             return sqlP.executeUpdate();

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java?rev=570729&r1=570728&r2=570729&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java Wed Aug 29 03:03:11 2007
@@ -444,7 +444,7 @@
             stmt = _connection.createStatement();
             return stmt.executeUpdate(sql);
         } catch (SQLException sqle) {
-            Debug.logError(sqle, "SQLProcessor.executeUpdate(sql) : ERROR : ", module);
+            // passing on this exception as nested, no need to log it here: Debug.logError(sqle, "SQLProcessor.executeUpdate(sql) : ERROR : ", module);
             throw new GenericDataSourceException("SQL Exception while executing the following:" + _sql, sqle);
         } finally {
             if (stmt != null) {