[libpostgresql-jdbc-java] 01/11: Handle a table with no permissions correctly.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:57 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL9_0_802
in repository libpostgresql-jdbc-java.

commit 4a4584369ddd6e0d6752a4f4920ecc9f577286c9
Author: Kris Jurka <books at ejurka.com>
Date:   Sat Oct 16 00:38:39 2010 +0000

    Handle a table with no permissions correctly.
    
    Problem reported by danap.
---
 org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java |  5 ++++-
 org/postgresql/test/jdbc2/DatabaseMetaDataTest.java     | 12 +++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
index 715d0d3..f3d12f6 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2008, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.56 2010/08/06 22:01:21 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.57 2010/08/10 19:46:13 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -2796,6 +2796,9 @@ public abstract class AbstractJdbc2DatabaseMetaData
      */
     private void addACLPrivileges(String acl, Hashtable privileges) {
         int equalIndex = acl.lastIndexOf("=");
+        if (equalIndex == -1)
+            return;
+
         String name = acl.substring(0, equalIndex);
         if (name.length() == 0)
         {
diff --git a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index 540f78d..c863ab9 100644
--- a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2008, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.46 2009/12/09 01:06:34 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.47 2010/08/06 22:01:21 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -414,6 +414,16 @@ public class DatabaseMetaDataTest extends TestCase
         assertTrue("Couldn't find SELECT priv on table testmetadata for " + TestUtil.getUser(), l_foundSelect);
     }
 
+    public void testNoTablePrivileges() throws SQLException
+    {
+        Statement stmt = con.createStatement();
+        stmt.execute("REVOKE ALL ON testmetadata FROM PUBLIC");
+        stmt.execute("REVOKE ALL ON testmetadata FROM " + TestUtil.getUser());
+        DatabaseMetaData dbmd = con.getMetaData();
+        ResultSet rs = dbmd.getTablePrivileges(null, null, "testmetadata");
+        assertTrue(!rs.next());
+    }
+
     public void testPrimaryKeys() throws SQLException
     {
         // At the moment just test that no exceptions are thrown KJ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list