You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/12/11 18:27:57 UTC

svn commit: r603312 - in /jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http: auth/AuthSchemeRegistry.java conn/params/HttpConnectionManagerParams.java cookie/CookieSpecRegistry.java

Author: rolandw
Date: Tue Dec 11 09:27:55 2007
New Revision: 603312

URL: http://svn.apache.org/viewvc?rev=603312&view=rev
Log:
some more generics in client and friends

Modified:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java?rev=603312&r1=603311&r2=603312&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java Tue Dec 11 09:27:55 2007
@@ -49,7 +49,8 @@
  */
 public final class AuthSchemeRegistry {
 
-    private final Map registeredSchemes = new LinkedHashMap();
+    private final Map<String,AuthSchemeFactory> registeredSchemes =
+        new LinkedHashMap<String,AuthSchemeFactory>();
     
     /**
      * Registers a {@link AuthSchemeFactory} with  the given identifier. If a factory with the 
@@ -108,7 +109,7 @@
         if (name == null) {
             throw new IllegalArgumentException("Name may not be null");
         }
-        AuthSchemeFactory factory = (AuthSchemeFactory) registeredSchemes.get(name.toLowerCase());
+        AuthSchemeFactory factory = registeredSchemes.get(name.toLowerCase());
         if (factory != null) {
             return factory.newInstance(params);
         } else {
@@ -122,8 +123,8 @@
      * 
      * @return list of registered scheme names
      */
-    public synchronized List getSchemeNames() {
-        return new ArrayList(registeredSchemes.keySet()); 
+    public synchronized List<String> getSchemeNames() {
+        return new ArrayList<String>(registeredSchemes.keySet()); 
     } 
     
 }

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java?rev=603312&r1=603311&r2=603312&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java Tue Dec 11 09:27:55 2007
@@ -114,15 +114,15 @@
                 ("The maximum must be greater than 0.");
         }
         
-        Map currentValues = (Map) params.getParameter
-            (ConnManagerPNames.MAX_HOST_CONNECTIONS);
+        Map<Object,Integer> currentValues = (Map<Object,Integer>)
+            params.getParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS);
         // param values are meant to be immutable so we'll make a copy
         // to modify
-        Map newValues = null;
+        Map<Object,Integer> newValues = null;
         if (currentValues == null) {
-            newValues = new HashMap();
+            newValues = new HashMap<Object,Integer>();
         } else {
-            newValues = new HashMap(currentValues);
+            newValues = new HashMap<Object,Integer>(currentValues);
         }
         newValues.put(key, new Integer(max));
         params.setParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, newValues);
@@ -183,10 +183,10 @@
         // if neither a specific nor a default maximum is configured...
         int result = DEFAULT_MAX_HOST_CONNECTIONS;
 
-        Map m = (Map) params.getParameter
-            (ConnManagerPNames.MAX_HOST_CONNECTIONS);
+        Map<Object,Integer> m = (Map<Object,Integer>)
+            params.getParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS);
         if (m != null) {
-            Integer max = (Integer) m.get(key);
+            Integer max = m.get(key);
             if ((max == null) && (key != ROUTE_DEFAULT)) {
                 // no specific maximum, get the configured default
                 max = (Integer) m.get(ROUTE_DEFAULT);

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java?rev=603312&r1=603311&r2=603312&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/cookie/CookieSpecRegistry.java Tue Dec 11 09:27:55 2007
@@ -50,11 +50,11 @@
  */
 public final class CookieSpecRegistry {
 
-    private final Map registeredSpecs;
+    private final Map<String,CookieSpecFactory> registeredSpecs;
     
     public CookieSpecRegistry() {
         super();
-        this.registeredSpecs = new LinkedHashMap();
+        this.registeredSpecs = new LinkedHashMap<String,CookieSpecFactory>();
     }
     
     /**
@@ -107,7 +107,7 @@
         if (name == null) {
             throw new IllegalArgumentException("Name may not be null");
         }
-        CookieSpecFactory factory = (CookieSpecFactory) registeredSpecs.get(name.toLowerCase());
+        CookieSpecFactory factory = registeredSpecs.get(name.toLowerCase());
         if (factory != null) {
             return factory.newInstance(params);
         } else {
@@ -139,7 +139,7 @@
      * @return list of registered cookie spec names
      */
     public synchronized List getSpecNames(){
-        return new ArrayList(registeredSpecs.keySet()); 
+        return new ArrayList<String>(registeredSpecs.keySet()); 
     }
     
 }