Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 6D82C1337B5C for ; Thu, 7 Oct 2010 22:17:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 09194-01 for ; Fri, 8 Oct 2010 01:17:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id 359241337B4A for ; Thu, 7 Oct 2010 22:17:15 -0300 (ADT) Received: from [192.168.157.32] (te183.montanavision.com [216.220.28.183]) by outbound.vnet-inc.com (Postfix) with ESMTP id C400A5954 for ; Thu, 7 Oct 2010 19:17:13 -0600 (MDT) Message-ID: <4CAE7105.1080805@ttc-cmc.net> Date: Thu, 07 Oct 2010 19:16:53 -0600 From: danap User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070601 SeaMonkey/1.1.2 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: DatabaseMetaData.getTablePrivileges() Content-Type: multipart/mixed; boundary="------------050102060206080601080901" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/60 X-Sequence-Number: 21028 This is a multi-part message in MIME format. --------------050102060206080601080901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Today I update the one of the development systems for the MyJSQLView project to test the PostgreSQL 9.0 database. Once the database was installed and also the latest JDBC 9.0-801 I tested the program. The application crashed and after some testing I attributed the exception to the empty string "" parameter for the schemaPattern argument in DatabaseMetaData.getTablePrivileges() for the JDBC. Well not sure the JDBC is really causing the problem, it is throwing the exception, but the error disappears when the same JDBC is used with the PostgreSQL 8.4.4 database. The Java API since I'm pretty sure 1.4 clearly indicates the empty string "" is valid for the schemaPattern parameter. " Parameters: schemaPattern - a schema name pattern; must match the schema name as it is stored in the database; "" retrieves those without a schema; null means that the schema name should not be used to narrow the search " Particulars, Exception, and Abbreviated Code attached. Source for the code, MyJSQLView_Access; http://code.google.com/p/myjsqlview/source/browse/ danap. -------------------------------------------------------- Linux Platform Java(TM) SE Runtime Environment (build 1.6.0_01-b06) postgresql-9.0-801.jdbc3.jar & postgresql-9.0.801.jdbc4.jar SQL version: PostgreSQL 8.4.4 (Works Fine) SQL version: PostgreSQL 9.0.1 (Crashes) Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.addACLPrivileges(AbstractJdbc2DatabaseMetaData.java:2799) at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.parseACL(AbstractJdbc2DatabaseMetaData.java:2878) at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getTablePrivileges(AbstractJdbc2DatabaseMetaData.java:2700) at com.dandymadeproductions.myjsqlview.MyJSQLView_Access.loadDBTables(MyJSQLView_Access.java:1559) at com.dandymadeproductions.myjsqlview.MyJSQLView_Access.accessCheck(MyJSQLView_Access.java:1200) at com.dandymadeproductions.myjsqlview.MyJSQLView_Access.actionPerformed(MyJSQLView_Access.java:628) ---------------------------------------------------------- --------------050102060206080601080901 Content-Type: text/plain; name="dbTables.txt" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="dbTables.txt" RGF0YWJhc2VNZXRhRGF0YSBkYk1ldGFEYXRhOwpSZXN1bHRTZXQgZGJfcmVzdWx0U2V0Owp0 cnkKewogICBkYk1ldGFEYXRhID0gZGJDb25uZWN0aW9uLmdldE1ldGFEYXRhKCk7CiAgIGRi X3Jlc3VsdFNldCA9IGRiTWV0YURhdGEuZ2V0VGFibGVzKGNhdGFsb2csIHNjaGVtYVBhdHRl cm4sIHRhYmxlTm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Q3VycmVudFVzZXIoKTsKICAgICAg ICAgICAgICAgIGlmICh0YWJsZXMuY29udGFpbnModGFibGVOYW1lKSAmJiAhZ3JhbnRlZS5l cXVhbHModXNlcikpCiAgICAgICAgICAgICAgICB0YWJsZXMucmVtb3ZlKHRhYmxlTmFtZSk7 CiAgICAgICAgICAgICB9CiAgICAgICAgICAgfQogICAgICB9CiAgICAgIGRiX3Jlc3VsdFNl dC5jbG9zZSgpOwp9CmNhdGNoIChTUUxFeGNlcHRpb24gZSkKewogICB0aHJvdyBlOwp9 --------------050102060206080601080901--