tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r543691 - /tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/
Date Sat, 02 Jun 2007 01:37:09 GMT
Author: markt
Date: Fri Jun  1 18:37:08 2007
New Revision: 543691

URL: http://svn.apache.org/viewvc?view=rev&rev=543691
Log:
Fix compiler warnings in o.a.c.realm

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/GenericPrincipal.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASCallbackHandler.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JDBCRealm.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/MemoryRealm.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/UserDatabaseRealm.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/DataSourceRealm.java Fri Jun  1 18:37:08
2007
@@ -345,7 +345,7 @@
             return (null);
         }
 
-        ArrayList list = getRoles(dbConnection, username);
+        ArrayList<String> list = getRoles(dbConnection, username);
 
         // Create and return a suitable Principal for this user
         return (new GenericPrincipal(this, username, credentials, list));
@@ -527,17 +527,17 @@
      * @param dbConnection The database connection to be used
      * @param username Username for which roles should be retrieved
      */
-    protected ArrayList getRoles(Connection dbConnection,
+    protected ArrayList<String> getRoles(Connection dbConnection,
                                      String username) {
     	
         ResultSet rs = null;
         PreparedStatement stmt = null;
-        ArrayList list = null;
+        ArrayList<String> list = null;
     	
         try {
     		stmt = roles(dbConnection, username);
     		rs = stmt.executeQuery();
-    		list = new ArrayList();
+    		list = new ArrayList<String>();
     		
     		while (rs.next()) {
     			String role = rs.getString(1);

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/GenericPrincipal.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/GenericPrincipal.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/GenericPrincipal.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/GenericPrincipal.java Fri Jun  1 18:37:08
2007
@@ -65,7 +65,7 @@
      * @param roles List of roles (must be Strings) possessed by this user
      */
     public GenericPrincipal(Realm realm, String name, String password,
-                            List roles) {
+                            List<String> roles) {
         this(realm, name, password, roles, null);
     }
 
@@ -82,7 +82,7 @@
      *        getUserPrincipal call if not null; if null, this will be returned
      */
     public GenericPrincipal(Realm realm, String name, String password,
-                            List roles, Principal userPrincipal) {
+                            List<String> roles, Principal userPrincipal) {
 
         super();
         this.realm = realm;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASCallbackHandler.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASCallbackHandler.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASCallbackHandler.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASCallbackHandler.java Fri Jun 
1 18:37:08 2007
@@ -27,8 +27,6 @@
 import javax.security.auth.callback.UnsupportedCallbackException;
 
 import org.apache.catalina.util.StringManager;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
 
 /**
  * <p>Implementation of the JAAS <code>CallbackHandler</code> interface,
@@ -49,7 +47,6 @@
  */
 
 public class JAASCallbackHandler implements CallbackHandler {
-    private static Log log = LogFactory.getLog(JAASCallbackHandler.class);
 
     // ------------------------------------------------------------ Constructor
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Fri Jun
 1 18:37:08 2007
@@ -212,7 +212,7 @@
      */
     public SecurityConstraint [] findSecurityConstraints(Request request,
                                                      Context context) {
-        ArrayList results = null;
+        ArrayList<SecurityConstraint> results = null;
         // Are there any defined security constraints?
         SecurityConstraint constraints[] = context.findConstraints();
         if ((constraints == null) || (constraints.length == 0)) {
@@ -235,7 +235,7 @@
                     constraints[i].included(uri, method));
             if (constraints[i].included(uri, method)) {
                 if(results == null) {
-                    results = new ArrayList();
+                    results = new ArrayList<SecurityConstraint>();
                 }
                 results.add(constraints[i]);
             }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java Fri Jun  1 18:37:08
2007
@@ -457,7 +457,6 @@
      */
     protected Principal createPrincipal(String username, Subject subject) {
         // Prepare to scan the Principals for this Subject
-        String password = null; // Will not be carried forward
 
         List<String> roles = new ArrayList<String>();
         Principal userPrincipal = null;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JDBCRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JDBCRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JDBCRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JDBCRealm.java Fri Jun  1 18:37:08
2007
@@ -420,7 +420,7 @@
             return (null);
         }
 
-        ArrayList roles = getRoles(username);
+        ArrayList<String> roles = getRoles(username);
         
         // Create and return a suitable Principal for this user
         return (new GenericPrincipal(this, username, credentials, roles));
@@ -604,7 +604,7 @@
     /**
      * Return the roles associated with the gven user name.
      */
-    protected ArrayList getRoles(String username) {
+    protected ArrayList<String> getRoles(String username) {
         
         PreparedStatement stmt = null;
         ResultSet rs = null;
@@ -626,7 +626,7 @@
                 
                 try {
                     // Accumulate the user's roles
-                    ArrayList roleList = new ArrayList();
+                    ArrayList<String> roleList = new ArrayList<String>();
                     stmt = roles(dbConnection, username);
                     rs = stmt.executeQuery();
                     while (rs.next()) {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JNDIRealm.java Fri Jun  1 18:37:08
2007
@@ -903,7 +903,7 @@
                         // Check the user's credentials
                         if (checkCredentials(context, user, credentials)) {
                             // Search for additional roles
-                            List roles = getRoles(context, user);
+                            List<String> roles = getRoles(context, user);
                             return (new GenericPrincipal(this,
                                                          username,
                                                          credentials,
@@ -931,7 +931,7 @@
                 return (null);
 
             // Search for additional roles
-            List roles = getRoles(context, user);
+            List<String> roles = getRoles(context, user);
 
             // Create and return a suitable Principal for this user
             return (new GenericPrincipal(this, username, credentials, roles));
@@ -961,7 +961,7 @@
         User user = null;
 
         // Get attributes to retrieve from user entry
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         if (userPassword != null)
             list.add(userPassword);
         if (userRoleName != null)
@@ -1020,7 +1020,7 @@
             password = getAttributeValue(userPassword, attrs);
 
         // Retrieve values of userRoleName attribute
-        ArrayList roles = null;
+        ArrayList<String> roles = null;
         if (userRoleName != null)
             roles = addAttributeValues(userRoleName, attrs, roles);
 
@@ -1110,7 +1110,7 @@
             password = getAttributeValue(userPassword, attrs);
 
         // Retrieve values of userRoleName attribute
-        ArrayList roles = null;
+        ArrayList<String> roles = null;
         if (userRoleName != null)
             roles = addAttributeValues(userRoleName, attrs, roles);
 
@@ -1264,7 +1264,6 @@
                                   User user,
                                   String credentials)
          throws NamingException {
-         Attributes attr;
 
          if (credentials == null || user == null)
              return (false);
@@ -1288,7 +1287,7 @@
             if (containerLog.isTraceEnabled()) {
                 containerLog.trace("  binding as "  + dn);
             }
-            attr = context.getAttributes("", null);
+            context.getAttributes("", null);
             validated = true;
         }
         catch (AuthenticationException e) {
@@ -1328,7 +1327,7 @@
      *
      * @exception NamingException if a directory server error occurs
      */
-    protected List getRoles(DirContext context, User user)
+    protected List<String> getRoles(DirContext context, User user)
         throws NamingException {
 
         if (user == null)
@@ -1344,9 +1343,9 @@
             containerLog.trace("  getRoles(" + dn + ")");
 
         // Start with roles retrieved from the user entry
-        ArrayList list = user.roles;
+        ArrayList<String> list = user.roles;
         if (list == null) {
-            list = new ArrayList();
+            list = new ArrayList<String>();
         }
 
         // Are we configured to do role searches?
@@ -1433,9 +1432,9 @@
      *
      * @exception NamingException if a directory server error occurs
      */
-    private ArrayList addAttributeValues(String attrId,
+    private ArrayList<String> addAttributeValues(String attrId,
                                          Attributes attrs,
-                                         ArrayList values)
+                                         ArrayList<String> values)
         throws NamingException{
 
         if (containerLog.isTraceEnabled())
@@ -1443,7 +1442,7 @@
         if (attrId == null || attrs == null)
             return values;
         if (values == null)
-            values = new ArrayList();
+            values = new ArrayList<String>();
         Attribute attr = attrs.get(attrId);
         if (attr == null)
             return (values);
@@ -1620,7 +1619,7 @@
      */
     protected Hashtable getDirectoryContextEnvironment() {
 
-        Hashtable env = new Hashtable();
+        Hashtable<String,String> env = new Hashtable<String,String>();
 
         // Configure our directory context environment.
         if (containerLog.isDebugEnabled() && connectionAttempt == 0)
@@ -1714,7 +1713,7 @@
     protected String[] parseUserPatternString(String userPatternString) {
 
         if (userPatternString != null) {
-            ArrayList pathList = new ArrayList();
+            ArrayList<String> pathList = new ArrayList<String>();
             int startParenLoc = userPatternString.indexOf('(');
             if (startParenLoc == -1) {
                 // no parens here; return whole thing
@@ -1802,10 +1801,11 @@
     String username = null;
     String dn = null;
     String password = null;
-    ArrayList roles = null;
+    ArrayList<String> roles = null;
 
 
-    User(String username, String dn, String password, ArrayList roles) {
+    User(String username, String dn, String password,
+            ArrayList<String> roles) {
         this.username = username;
         this.dn = dn;
         this.password = password;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/MemoryRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/MemoryRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/MemoryRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/MemoryRealm.java Fri Jun  1 18:37:08
2007
@@ -82,7 +82,8 @@
     /**
      * The set of valid Principals for this Realm, keyed by user name.
      */
-    private Map principals = new HashMap();
+    private Map<String,GenericPrincipal> principals =
+        new HashMap<String,GenericPrincipal>();
 
 
     /**
@@ -184,7 +185,7 @@
     void addUser(String username, String password, String roles) {
 
         // Accumulate the list of roles for this user
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         roles += ",";
         while (true) {
             int comma = roles.indexOf(',');

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/UserDatabaseRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/UserDatabaseRealm.java?view=diff&rev=543691&r1=543690&r2=543691
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/UserDatabaseRealm.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/UserDatabaseRealm.java Fri Jun  1
18:37:08 2007
@@ -214,7 +214,7 @@
             return null;
         }
 
-        List roles = new ArrayList();
+        List<String> roles = new ArrayList<String>();
         Iterator uroles = user.getRoles();
         while(uroles.hasNext()) {
             Role role = (Role)uroles.next();



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message