Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 46545 invoked from network); 27 Mar 2008 11:33:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Mar 2008 11:33:41 -0000 Received: (qmail 8229 invoked by uid 500); 27 Mar 2008 11:33:40 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 8194 invoked by uid 500); 27 Mar 2008 11:33:40 -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 8185 invoked by uid 99); 27 Mar 2008 11:33:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2008 04:33:40 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2008 11:32:58 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 377D7234C0A7 for ; Thu, 27 Mar 2008 04:31:27 -0700 (PDT) Message-ID: <1532635850.1206617487225.JavaMail.jira@brutus> Date: Thu, 27 Mar 2008 04:31:27 -0700 (PDT) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-3352) truncateTable crashed, Caused by: java.lang.NullPointerException In-Reply-To: <6457666.1201232556368.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3352?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Knut Anders Hatlen updated DERBY-3352: -------------------------------------- Attachment: test.diff I'm not familiar with this code, but the fix looks simple and correct to me= . To see that it actually did what it intended to do, I wrote a small JUnit= test that verified that the NPE was fixed and that the table was correctly= truncated. See the attached patch. The test also checks that a "not implem= ented" exception is thrown in insane builds. If we keep the TRUNCATE TABLE code in trunk, although only enabled in debug= builds, I think it is worth checking in the test. Since we don't know the = state of this code, it's good to have a place where we can add tests for it= as a first step towards enabling it in non-debug builds as well (if it's d= ecided that it's a good thing to have TRUNCATE TABLE in Derby). > truncateTable crashed, Caused by: java.lang.NullPointerException > ---------------------------------------------------------------- > > Key: DERBY-3352 > URL: https://issues.apache.org/jira/browse/DERBY-3352 > Project: Derby > Issue Type: Bug > Components: Services > Affects Versions: 10.3.1.4, 10.3.2.1 > Environment: Windows XP.SP2 , Eclipse 3.2.2 , JDK 1.5_05=20 > Reporter: QingpingXu > Priority: Critical > Attachments: derby-3352.diff, test.diff > > > Since derby 10.3.2.1, when truncate a table which has index , a java.lang= .NullPointerException is throwed;but the same src runs successfully with de= rby 10.2.2.0=E3=80=82 > here's the example source code and stack trace: > Src: > public static void main(String[] args) > =09{ > =09=09 > =09=09try > =09=09{ > =09=09=09Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); > =09=09=09 > =09=09=09Connection conn =3D DriverManager.getConnection("jdbc:derby:test= ;create=3Dtrue"); > =09=09=09 > =09=09=09Statement stat =3D conn.createStatement(); > =09=09=09stat.executeUpdate("create table m (uri varchar(256),f int)"); > =09=09=09stat.executeUpdate("create index aa on m (uri)"); > =09=09=09stat.executeUpdate("truncate table m"); > =09=09=09 > =09=09=09System.out.println("Truncate table m successfully=EF=BC=81"); > =09=09} > =09=09catch (Exception ex) > =09=09{ > =09=09=09ex.printStackTrace(); > =09=09} > =09} > Error: > java.sql.SQLException: Java Exception:":java.lang.NullPointerException"= =E3=80=82 > =09at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLE= xceptionFactory.java:45) > =09at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88) > =09at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245) > =09at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLExcepti= on(TransactionResourceImpl.java:403) > =09at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(= TransactionResourceImpl.java:346) > =09at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedCon= nection.java:1574) > =09at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Connecti= onChild.java:81) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedSta= tement.java:1315) > =09at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.ja= va:618) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(EmbedStatem= ent.java:176) > =09at update.UpdateURI.main(UpdateURI.java:34) > Caused by: java.lang.NullPointerException > =09at org.apache.derby.impl.sql.execute.AlterTableConstantAction.truncate= Table(AlterTableConstantAction.java:1462) > =09at org.apache.derby.impl.sql.execute.AlterTableConstantAction.executeC= onstantAction(AlterTableConstantAction.java:531) > =09at org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.= java:64) > =09at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericP= reparedStatement.java:370) > =09at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedSta= tement.java:1225) > =09... 3 more --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.