Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 90161 invoked from network); 26 Aug 2006 10:47:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Aug 2006 10:47:13 -0000 Received: (qmail 6900 invoked by uid 500); 26 Aug 2006 10:47:13 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 6860 invoked by uid 500); 26 Aug 2006 10:47:12 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 6851 invoked by uid 99); 26 Aug 2006 10:47:12 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 03:47:12 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.1.36] (HELO gmpea-pix-1.sun.com) (192.18.1.36) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Aug 2006 03:47:10 -0700 Received: from d1-emea-10.sun.com ([192.18.2.120]) by gmpea-pix-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k7QAkk7A019835 for ; Sat, 26 Aug 2006 11:46:49 +0100 (BST) Received: from conversion-daemon.d1-emea-10.sun.com by d1-emea-10.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0J4L00J01PM6MF00@d1-emea-10.sun.com> (original mail from Knut.Hatlen@Sun.COM) for derby-dev@db.apache.org; Sat, 26 Aug 2006 11:46:46 +0100 (BST) Received: from localhost ([193.71.105.147]) by d1-emea-10.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0J4L004DMPXY3VT3@d1-emea-10.sun.com> for derby-dev@db.apache.org; Sat, 26 Aug 2006 11:46:46 +0100 (BST) Date: Sat, 26 Aug 2006 12:46:21 +0200 From: Knut Anders Hatlen Subject: Re: [JUnit] Should assertSQLState throw SQLException? In-reply-to: <44EE3C27.4010507@apache.org> Sender: Knut.Hatlen@Sun.COM To: derby-dev@db.apache.org Message-id: <8664gfwz9e.fsf@ugle.hatlen.net> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT References: <86veoljkzu.fsf@ugle.hatlen.net> <44EB13C7.2070206@sun.com> <44EB27CE.2080203@Sun.com> <44EE3C27.4010507@apache.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Daniel John Debrunner writes: > Kristian Waagan wrote: > > >> Any suggestions on how we can achieve what Knut Anders is proposing? >> I think it is a good proposal to preserve the stack trace, the error >> message and the SQL state. > > I think we want to do something like this (which requires JDK 1.4 or > higher), I'm looking at implementing this and maybe just lose the error > in jdk1.3. > > > } catch (AssertionFailedError e) { > > // Save the SQLException > e.initCause(exception); > > throw e; > } > > around the asserts in assertSQLState() (except for assertion that > exception is not null) > > This will save the stack trace. Sounds good to me. I don't think it's a big issue that we lose the error in jdk1.3. > This could be followed on by code in BaseTestCase.runBase to always > print the exception, or to save the exception's stack trace in the newly > added "failed" folder (see BaseTestCase.getFailedFolder()). > > I don't think individual tests should be trying to print stack traces, > if we can centralize it then we will end up with consistent results. > E.g. well formatted information about SQLExceptions including the > chaining. Having each test print exceptions will mean endless variety as > to how they are printed and most missing the chain of exceptions. That's > what happens today with the existing tests. I agree. Thank you for all your hard work on the JUnit framework! -- Knut Anders