You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2011/01/31 03:49:56 UTC
svn commit: r1065472 - in /incubator/lcf/trunk: CHANGES.txt
framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Author: kwright
Date: Mon Jan 31 02:49:56 2011
New Revision: 1065472
URL: http://svn.apache.org/viewvc?rev=1065472&view=rev
Log:
Another fix for CONNECTORS-148; intermittent user/database creation failures still occur unless the user name is created without parameters.
Modified:
incubator/lcf/trunk/CHANGES.txt
incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
Modified: incubator/lcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/CHANGES.txt?rev=1065472&r1=1065471&r2=1065472&view=diff
==============================================================================
--- incubator/lcf/trunk/CHANGES.txt (original)
+++ incubator/lcf/trunk/CHANGES.txt Mon Jan 31 02:49:56 2011
@@ -3,6 +3,11 @@ $Id$
================== 0.2-dev ==================
+CONNECTORS-148: Intermittent failures creating the PostgreSQL database
+still occurring; traced the problem this time to PostgreSQL not accepting
+a parameter for the password when creating a user.
+(Nicolas Max, Karl Wright)
+
CONNECTORS-153: Add support for robots meta tag to web connector.
(Erlend GarĂ¥sen, Karl Wright)
Modified: incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1065472&r1=1065471&r2=1065472&view=diff
==============================================================================
--- incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original)
+++ incubator/lcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Mon Jan 31 02:49:56 2011
@@ -518,9 +518,21 @@ public class DBInterfacePostgreSQL exten
null,null,null,true,-1,null,null);
if (set.getRowCount() == 0)
{
- params.clear();
- params.add(password);
- masterDatabase.executeQuery("CREATE USER "+userName+" PASSWORD ?",params,
+ // We have to quote the password. Due to a postgresql bug, parameters don't work for this field.
+ StringBuffer sb = new StringBuffer();
+ sb.append("'");
+ int i = 0;
+ while (i < password.length())
+ {
+ char x = password.charAt(i);
+ if (x == '\'')
+ sb.append("'");
+ sb.append(x);
+ i++;
+ }
+ sb.append("'");
+ String quotedPassword = sb.toString();
+ masterDatabase.executeQuery("CREATE USER "+userName+" PASSWORD "+quotedPassword,null,
null,invalidateKeys,null,false,0,null,null);
}