[libpostgresql-jdbc-java] 02/08: Handle a table with no permissions correctly.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_2_512
in repository libpostgresql-jdbc-java.
commit edb427e3e48526e9113278d9723b9a189274d738
Author: Kris Jurka <books at ejurka.com>
Date: Sat Oct 16 00:39:45 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 7abca47..4ab9188 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.5 2009/03/12 04:00:09 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.33.2.6 2010/05/01 16:52:34 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2650,6 +2650,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 c7bbb9e..b6ba861 100644
--- a/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -3,7 +3,7 @@
* Copyright (c) 2004-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36.2.1 2007/04/11 07:33:26 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.36.2.2 2008/11/07 09:12:01 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -351,6 +351,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