[libpostgresql-jdbc-java] 06/15: Handle a table with no permissions correctly.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:56 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_4_703
in repository libpostgresql-jdbc-java.
commit 85ba14237da935a29b17cf484b1f2447ef7560e9
Author: Kris Jurka <books at ejurka.com>
Date: Sat Oct 16 00:39:14 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 59b1fa8..08ad0e6 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.51.2.4 2010/05/01 16:52:23 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java,v 1.51.2.5 2010/08/10 19:46:19 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 9b40d5c..7dd072c 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.44.2.1 2009/12/04 21:22:02 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java,v 1.44.2.2 2009/12/09 01:06:41 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