Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 96482 invoked from network); 17 Oct 2007 00:21:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2007 00:21:40 -0000 Received: (qmail 77072 invoked by uid 500); 17 Oct 2007 00:21:27 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 77043 invoked by uid 500); 17 Oct 2007 00:21:27 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 77031 invoked by uid 99); 17 Oct 2007 00:21:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Oct 2007 17:21:27 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 00:21:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7AF9E1A9832; Tue, 16 Oct 2007 17:21:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r585297 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java Date: Wed, 17 Oct 2007 00:21:09 -0000 To: derby-commits@db.apache.org From: myrnavl@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071017002110.7AF9E1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: myrnavl Date: Tue Oct 16 17:21:09 2007 New Revision: 585297 URL: http://svn.apache.org/viewvc?rev=585297&view=rev Log: DERBY-2979; fix IllegalArgumentException in system test mailjdbc. Patch contributed by Manjula Kutty Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java?rev=585297&r1=585296&r2=585297&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/mailjdbc/utils/DbTasks.java Tue Oct 16 17:21:09 2007 @@ -193,7 +193,11 @@ } } try { - int attach_id = Rn.nextInt(count - 1); + int attach_id = 0; + if((count - 1) <= 0) + attach_id = 0; + else + attach_id = Rn.nextInt(count - 1); ResultSet rs = stmt .executeQuery("select attachment from REFRESH.attach where id = " + attach_id); @@ -261,6 +265,8 @@ // Delete done by the user. Thre user will mark the mails to be deleted // and then int id_count = 0; + int id = 0; + int for_id = 0; try { saveAutoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); @@ -272,12 +278,18 @@ if (rs.next()) id_count = rs.getInt(1); short to_delete = 1; - int id = Rn.nextInt(id_count - 1); + if((id_count -1) <= 0 ) + id = id_count; + else + id = Rn.nextInt(id_count - 1); long s_update = System.currentTimeMillis(); int delete_count = 0; for (int i = 0; i < id; i++) { updateUser.setShort(1, to_delete); - int for_id = Rn.nextInt(id_count - 1); + if((id_count -1) <= 0 ) + for_id = id_count; + else + for_id = Rn.nextInt(id_count - 1); updateUser.setInt(2, for_id); int del = updateUser.executeUpdate(); delete_count = delete_count + del; @@ -375,9 +387,13 @@ MailJdbc.logAct.logMsg(LogFile.INFO + thread_name + " : " + "no message in the REFRESH.INBOX to move"); else { + int message_id = 0; int count = rs.getInt(1); int folder_id = Rn.nextInt(5 - 1); - int message_id = Rn.nextInt(count - 1); + if (count == 0) + message_id = 0; + else + message_id = Rn.nextInt(count - 1); moveToFolder.setInt(1, folder_id); moveToFolder.setInt(2, message_id); long s_folder = System.currentTimeMillis(); @@ -423,7 +439,6 @@ // and for those rows inserting blobs in the attach table Statement stmt = conn.createStatement(); int num = Rn.nextInt(10 - 1); - System.out.println("num: " + num); InputStream streamIn = null; Reader streamReader = null; try {