Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 16710 invoked by uid 500); 8 Mar 2001 15:37:20 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 16656 invoked by uid 1152); 8 Mar 2001 15:37:15 -0000 Date: 8 Mar 2001 15:37:14 -0000 Message-ID: <20010308153714.16603.qmail@apache.org> From: bloritsch@apache.org To: xml-cocoon-cvs@apache.org Subject: cvs commit: xml-cocoon/src/org/apache/cocoon/acting DatabaseUpdateAction.java DatabaseDeleteAction.java DatabaseAddAction.java bloritsch 01/03/08 07:37:13 Modified: src/org/apache/cocoon/acting Tag: xml-cocoon2 DatabaseUpdateAction.java DatabaseDeleteAction.java DatabaseAddAction.java Log: Make the database actions easier to debug. When Exceptions are thrown, we pass the value of the current column we are processing. Revision Changes Path No revision No revision 1.1.2.11 +5 -3 xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseUpdateAction.java Index: DatabaseUpdateAction.java =================================================================== RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseUpdateAction.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- DatabaseUpdateAction.java 2001/03/02 20:26:34 1.1.2.10 +++ DatabaseUpdateAction.java 2001/03/08 15:37:04 1.1.2.11 @@ -40,7 +40,7 @@ * only one table at a time to update. * * @author Berin Loritsch - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/02 20:26:34 $ + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/08 15:37:04 $ */ public class DatabaseUpdateAction extends AbstractDatabaseAction { private static final Map updateStatements = new HashMap(); @@ -53,6 +53,7 @@ public Map act(EntityResolver resolver, Map objectModel, String source, Parameters param) throws Exception { DataSourceComponent datasource = null; Connection conn = null; + int currentIndex = 0; try { Configuration conf = this.getConfiguration(param.getParameter("form-descriptor", null)); @@ -66,7 +67,7 @@ Iterator keys = conf.getChild("table").getChild("keys").getChildren("key"); Iterator values = conf.getChild("table").getChild("values").getChildren("value"); - int currentIndex = 1; + currentIndex = 1; for (int i = currentIndex; values.hasNext(); i++) { Configuration itemConf = (Configuration) values.next(); @@ -77,6 +78,7 @@ for (int i = currentIndex + 1; keys.hasNext(); i++) { Configuration itemConf = (Configuration) keys.next(); this.setColumn(statement, i, request, itemConf); + currentIndex = i; } statement.execute(); @@ -87,7 +89,7 @@ conn.rollback(); } - throw new ProcessingException("Could not update record", e); + throw new ProcessingException("Could not update record :position = " + currentIndex, e); } finally { if (conn != null) { try { 1.1.2.7 +6 -4 xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseDeleteAction.java Index: DatabaseDeleteAction.java =================================================================== RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseDeleteAction.java,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -r1.1.2.6 -r1.1.2.7 --- DatabaseDeleteAction.java 2001/03/02 20:26:31 1.1.2.6 +++ DatabaseDeleteAction.java 2001/03/08 15:37:06 1.1.2.7 @@ -43,7 +43,7 @@ * the keys. * * @author Berin Loritsch - * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/03/02 20:26:31 $ + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/03/08 15:37:06 $ */ public final class DatabaseDeleteAction extends AbstractDatabaseAction { private static final Map deleteStatements = new HashMap(); @@ -56,6 +56,7 @@ public final Map act(EntityResolver resolver, Map objectModel, String source, Parameters param) throws Exception { DataSourceComponent datasource = null; Connection conn = null; + int currentIndex = 0; try { Configuration conf = this.getConfiguration(param.getParameter("form-descriptor", null)); @@ -69,9 +70,9 @@ Iterator keys = conf.getChild("table").getChild("keys").getChildren("key"); - for (int i = 1; keys.hasNext(); i++) { + for (currentIndex = 1; keys.hasNext(); currentIndex++) { Configuration itemConf = (Configuration) keys.next(); - this.setColumn(statement, i, request, itemConf); + this.setColumn(statement, currentIndex, request, itemConf); } statement.execute(); @@ -81,7 +82,8 @@ if (conn != null) { conn.rollback(); } - throw new ProcessingException("Could not delete record", e); + + throw new ProcessingException("Could not delete record :position = " + currentIndex, e); } finally { if (conn != null) { try { 1.1.2.11 +5 -3 xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java Index: DatabaseAddAction.java =================================================================== RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/DatabaseAddAction.java,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -r1.1.2.10 -r1.1.2.11 --- DatabaseAddAction.java 2001/03/07 22:18:34 1.1.2.10 +++ DatabaseAddAction.java 2001/03/08 15:37:08 1.1.2.11 @@ -40,7 +40,7 @@ * only one table at a time to update. * * @author Berin Loritsch - * @version CVS $Revision: 1.1.2.10 $ $Date: 2001/03/07 22:18:34 $ + * @version CVS $Revision: 1.1.2.11 $ $Date: 2001/03/08 15:37:08 $ */ public class DatabaseAddAction extends AbstractDatabaseAction { private static final Map addStatements = new HashMap(); @@ -54,6 +54,7 @@ public Map act(EntityResolver resolver, Map objectModel, String source, Parameters param) throws Exception { DataSourceComponent datasource = null; Connection conn = null; + int currentIndex = 0; try { Configuration conf = this.getConfiguration(param.getParameter("form-descriptor", null)); @@ -67,7 +68,7 @@ Iterator keys = conf.getChild("table").getChild("keys").getChildren("key"); Iterator values = conf.getChild("table").getChild("values").getChildren("value"); - int currentIndex = 1; + currentIndex = 1; while (keys.hasNext()) { Configuration key = (Configuration) keys.next(); @@ -99,7 +100,8 @@ if (conn != null) { conn.rollback(); } - throw new ProcessingException("Could not add record", e); + + throw new ProcessingException("Could not add record :position = " + currentIndex, e); } finally { if (conn != null) { try { ---------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: cocoon-cvs-help@xml.apache.org