db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1067346 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/iapi/util/IdUtil.java java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java
Date Fri, 04 Feb 2011 23:30:14 GMT
Author: kmarsden
Date: Fri Feb  4 23:30:14 2011
New Revision: 1067346

URL: http://svn.apache.org/viewvc?rev=1067346&view=rev
Log:
DERBY-4475 [patch] roleName isn't trimmed as expected

Contributed by Dave Brosius

merge 891350 from trunk


Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/util/IdUtil.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb  4 23:30:14 2011
@@ -1,2 +1,2 @@
 /db/derby/code/branches/10.6:942027,957000,962738,965351,987678,1055601
-/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,931076,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716,965647,967304,980684,986689,986834,999119,1002291,1002682,1002853
 ,1021426,1025795,1040658,1053724,1055169,1062096,1063809,1065061,1067250
+/db/derby/code/trunk:757811,764912,769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,791027,792001,792254,792434,793089,793588,794106,794276,794303,794955,795166,795459,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,827505,829022,829410,830545,831304,831319,832379,833430,835286,881074,881444,882732,884163,885421,885659,887246,888311,891350,892912,897161,898635,901165,901648,901760,902857,903108,905224,908418,908586,909176,910481,910511,911315,911793,915177,915733,916075,916897,917771,918152,918359,921028,927430,928065,929085,931076,934474,936215,938959,940462,940469,942286,942476,942480,942587,946794,948045,948069,951346,951366,952138,952581,954748,955001,955634,956075,956445,956659,958163,959550,962716,965647,967304,980684,986689,986834,999119,1002291,1002682,
 1002853,1021426,1025795,1040658,1053724,1055169,1062096,1063809,1065061,1067250

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/util/IdUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/util/IdUtil.java?rev=1067346&r1=1067345&r2=1067346&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/util/IdUtil.java (original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/iapi/util/IdUtil.java Fri Feb
 4 23:30:14 2011
@@ -746,7 +746,7 @@ public abstract class IdUtil
 	 */
 	public static String parseRoleId(String roleName) throws StandardException
 	{
-		roleName.trim();
+		roleName = roleName.trim();
 		// NONE is a special case and is not allowed with its special
 		// meaning in SET ROLE <value specification>. Even if there is
 		// a role with case normal form "NONE", we require it to be

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java?rev=1067346&r1=1067345&r2=1067346&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/RolesTest.java
Fri Feb  4 23:30:14 2011
@@ -1060,6 +1060,23 @@ public class RolesTest extends BaseJDBCT
             fail("execute of set role ? failed: [foo]" + e, e);
         }
 
+        // Test that trimming works:
+        try {
+            pstmt.setString(1, " BAR ");
+            int rowcnt = pstmt.executeUpdate();
+            assertEquals("rowcount from set role ? not 0", rowcnt, 0);
+        } catch (SQLException e) {
+            fail("execute of set role ? failed: [foo]" + e, e);
+        }
+
+        try {
+            int rowcnt = conn.createStatement().executeUpdate(
+                "set role ' BAR '");
+            assertEquals("rowcount from set role ? not 0", rowcnt, 0);
+        } catch (SQLException e) {
+            fail("execute of set role ? failed: [foo]" + e, e);
+        }
+
 
         try {
             pstmt.setString(1, "");



Mime
View raw message