Author: yoavs
Date: Fri Apr 14 08:35:10 2006
New Revision: 394121

URL: http://svn.apache.org/viewcvs?rev=394121&view=rev
Log:
Bugzilla 38596: http://issues.apache.org/bugzilla/show_bug.cgi?id=38596

Modified:
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java?rev=394121&r1=394120&r2=394121&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/DataSourceRealm.java
 Fri Apr 14 08:35:10 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
+ * Copyright 1999,2004-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -57,13 +57,13 @@
     /**
      * The generated string for the roles PreparedStatement
      */
-    private StringBuffer preparedRoles = null;
+    private String preparedRoles = null;
 
 
     /**
      * The generated string for the credentials PreparedStatement
      */
-    private StringBuffer preparedCredentials = null;
+    private String preparedCredentials = null;
 
 
     /**
@@ -581,7 +581,7 @@
         throws SQLException {
 
         PreparedStatement credentials =
-            dbConnection.prepareStatement(preparedCredentials.toString());
+            dbConnection.prepareStatement(preparedCredentials);
 
         credentials.setString(1, username);
         return (credentials);
@@ -601,7 +601,7 @@
         throws SQLException {
 
         PreparedStatement roles = 
-            dbConnection.prepareStatement(preparedRoles.toString());
+            dbConnection.prepareStatement(preparedRoles);
 
         roles.setString(1, username);
         return (roles);
@@ -624,23 +624,24 @@
         super.start();
 
         // Create the roles PreparedStatement string
-        preparedRoles = new StringBuffer("SELECT ");
-        preparedRoles.append(roleNameCol);
-        preparedRoles.append(" FROM ");
-        preparedRoles.append(userRoleTable);
-        preparedRoles.append(" WHERE ");
-        preparedRoles.append(userNameCol);
-        preparedRoles.append(" = ?");
+        StringBuffer temp = new StringBuffer("SELECT ");
+        temp.append(roleNameCol);
+        temp.append(" FROM ");
+        temp.append(userRoleTable);
+        temp.append(" WHERE ");
+        temp.append(userNameCol);
+        temp.append(" = ?");
+        preparedRoles = temp.toString();
 
         // Create the credentials PreparedStatement string
-        preparedCredentials = new StringBuffer("SELECT ");
-        preparedCredentials.append(userCredCol);
-        preparedCredentials.append(" FROM ");
-        preparedCredentials.append(userTable);
-        preparedCredentials.append(" WHERE ");
-        preparedCredentials.append(userNameCol);
-        preparedCredentials.append(" = ?");
-
+        temp = new StringBuffer("SELECT ");
+        temp.append(userCredCol);
+        temp.append(" FROM ");
+        temp.append(userTable);
+        temp.append(" WHERE ");
+        temp.append(userNameCol);
+        temp.append(" = ?");
+        preparedCredentials = temp.toString();
     }
 
 

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=394121&r1=394120&r2=394121&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Fri Apr 14 08:35:10 2006
@@ -88,6 +88,10 @@
         <bug>37848</bug>: Only output catalina.sh diagnostic messages if we 
have a TTY, submitted by
           David Shaw. (yoavs)
       </fix>
+      <fix>
+        <bug>38596</bug>: Minor performance optimization in DataSourceRealm, 
suggested by Sandy
+          McArthur. (yoavs)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to