You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/12/27 19:30:47 UTC

svn commit: r729651 - in /tomcat/trunk/java/org/apache/catalina/connector: CometEventImpl.java Connector.java CoyoteInputStream.java CoyoteWriter.java MapperListener.java OutputBuffer.java Request.java RequestFacade.java Response.java ResponseFacade.java

Author: markt
Date: Sat Dec 27 10:30:47 2008
New Revision: 729651

URL: http://svn.apache.org/viewvc?rev=729651&view=rev
Log:
Generics changes for o.a.c.connector
Fix various Eclipse warnings (unused code, casts, etc)

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java
    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java
    tomcat/trunk/java/org/apache/catalina/connector/CoyoteWriter.java
    tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java
    tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
    tomcat/trunk/java/org/apache/catalina/connector/Request.java
    tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java
    tomcat/trunk/java/org/apache/catalina/connector/Response.java
    tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java Sat Dec 27 10:30:47 2008
@@ -26,7 +26,6 @@
 
 import org.apache.catalina.CometEvent;
 import org.apache.catalina.util.StringManager;
-import org.apache.coyote.ActionCode;
 
 public class CometEventImpl implements CometEvent {
 
@@ -119,7 +118,7 @@
             UnsupportedOperationException {
         if (request.getAttribute("org.apache.tomcat.comet.timeout.support") == Boolean.TRUE) {
             request.setAttribute("org.apache.tomcat.comet.timeout", new Integer(timeout));
-            if (request.isComet()) request.setCometTimeout((long)timeout);
+            if (request.isComet()) request.setCometTimeout(timeout);
         } else {
             throw new UnsupportedOperationException();
         }

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Sat Dec 27 10:30:47 2008
@@ -79,7 +79,7 @@
         setProtocol(protocol);
         // Instantiate protocol handler
         try {
-            Class clazz = Class.forName(protocolHandlerClassName);
+            Class<?> clazz = Class.forName(protocolHandlerClassName);
             this.protocolHandler = (ProtocolHandler) clazz.newInstance();
         } catch (Exception e) {
             log.error
@@ -278,7 +278,8 @@
      protected boolean useBodyEncodingForURI = false;
 
 
-     protected static HashMap replacements = new HashMap();
+     protected static HashMap<String,String> replacements =
+         new HashMap<String,String>();
      static {
          replacements.put("acceptCount", "backlog");
          replacements.put("connectionLinger", "soLinger");
@@ -304,7 +305,7 @@
     public Object getProperty(String name) {
         String repl = name;
         if (replacements.get(name) != null) {
-            repl = (String) replacements.get(name);
+            repl = replacements.get(name);
         }
         return IntrospectionUtils.getProperty(protocolHandler, repl);
     }
@@ -316,7 +317,7 @@
     public boolean setProperty(String name, String value) {
         String repl = name;
         if (replacements.get(name) != null) {
-            repl = (String) replacements.get(name);
+            repl = replacements.get(name);
         }
         return IntrospectionUtils.setProperty(protocolHandler, repl, value);
     }
@@ -623,11 +624,11 @@
         int patch = 0;
         try {
             String methodName = "initialize";
-            Class paramTypes[] = new Class[1];
+            Class<?> paramTypes[] = new Class[1];
             paramTypes[0] = String.class;
             Object paramValues[] = new Object[1];
             paramValues[0] = null;
-            Class clazz = Class.forName("org.apache.tomcat.jni.Library");
+            Class<?> clazz = Class.forName("org.apache.tomcat.jni.Library");
             Method method = clazz.getMethod(methodName, paramTypes);
             method.invoke(null, paramValues);
             major = clazz.getField("TCN_MAJOR_VERSION").getInt(null);

Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Sat Dec 27 10:30:47 2008
@@ -83,10 +83,10 @@
             
             try{
                 Integer result = 
-                    (Integer)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction(){
+                    AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Integer>(){
 
-                            public Object run() throws IOException{
+                            public Integer run() throws IOException{
                                 Integer integer = new Integer(ib.readByte());
                                 return integer;
                             }
@@ -111,10 +111,10 @@
         if (SecurityUtil.isPackageProtectionEnabled()){
             try{
                 Integer result = 
-                    (Integer)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction(){
+                    AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Integer>(){
 
-                            public Object run() throws IOException{
+                            public Integer run() throws IOException{
                                 Integer integer = new Integer(ib.available());
                                 return integer;
                             }
@@ -139,10 +139,10 @@
         if (SecurityUtil.isPackageProtectionEnabled()){
             try{
                 Integer result = 
-                    (Integer)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction(){
+                    AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Integer>(){
 
-                            public Object run() throws IOException{
+                            public Integer run() throws IOException{
                                 Integer integer = 
                                     new Integer(ib.read(b, 0, b.length));
                                 return integer;
@@ -170,10 +170,10 @@
         if (SecurityUtil.isPackageProtectionEnabled()){
             try{
                 Integer result = 
-                    (Integer)AccessController.doPrivileged(
-                        new PrivilegedExceptionAction(){
+                    AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Integer>(){
 
-                            public Object run() throws IOException{
+                            public Integer run() throws IOException{
                                 Integer integer = 
                                     new Integer(ib.read(b, off, len));
                                 return integer;
@@ -210,9 +210,9 @@
         if (SecurityUtil.isPackageProtectionEnabled()){
             try{
                 AccessController.doPrivileged(
-                    new PrivilegedExceptionAction(){
+                    new PrivilegedExceptionAction<Void>(){
 
-                        public Object run() throws IOException{
+                        public Void run() throws IOException{
                             ib.close();
                             return null;
                         }

Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteWriter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteWriter.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/CoyoteWriter.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteWriter.java Sat Dec 27 10:30:47 2008
@@ -109,7 +109,7 @@
         try {
             ob.close();
         } catch (IOException ex ) {
-            ;
+            // Ignore
         }
         error = false;
 

Modified: tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java Sat Dec 27 10:30:47 2008
@@ -122,10 +122,10 @@
             // Query hosts
             String onStr = domain + ":type=Host,*";
             ObjectName objectName = new ObjectName(onStr);
-            Set set = mBeanServer.queryMBeans(objectName, null);
-            Iterator iterator = set.iterator();
+            Set<ObjectInstance> set = mBeanServer.queryMBeans(objectName, null);
+            Iterator<ObjectInstance> iterator = set.iterator();
             while (iterator.hasNext()) {
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 registerHost(oi.getObjectName());
             }
 
@@ -136,7 +136,7 @@
             set = mBeanServer.queryMBeans(objectName, null);
             iterator = set.iterator();
             while (iterator.hasNext()) {
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 registerContext(oi.getObjectName());
             }
 
@@ -146,7 +146,7 @@
             set = mBeanServer.queryMBeans(objectName, null);
             iterator = set.iterator();
             while (iterator.hasNext()) {
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 registerWrapper(oi.getObjectName());
             }
 
@@ -290,8 +290,8 @@
             // Get the hosts' list
             String onStr = domain + ":type=Host,*";
             ObjectName objectName = new ObjectName(onStr);
-            Set set = mBeanServer.queryMBeans(objectName, null);
-            Iterator iterator = set.iterator();
+            Set<ObjectInstance> set = mBeanServer.queryMBeans(objectName, null);
+            Iterator<ObjectInstance> iterator = set.iterator();
             String[] aliases;
             boolean isRegisteredWithAlias = false;
             
@@ -299,7 +299,7 @@
 
                 if (isRegisteredWithAlias) break;
             
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 hostName = oi.getObjectName();
                 aliases = (String[])
                     mBeanServer.invoke(hostName, "findAliases", null, null);

Modified: tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/OutputBuffer.java Sat Dec 27 10:30:47 2008
@@ -112,7 +112,8 @@
     /**
      * List of encoders.
      */
-    protected HashMap encoders = new HashMap();
+    protected HashMap<String, C2BConverter> encoders =
+        new HashMap<String, C2BConverter>();
 
 
     /**
@@ -497,15 +498,15 @@
         gotEnc = true;
         if (enc == null)
             enc = DEFAULT_ENCODING;
-        conv = (C2BConverter) encoders.get(enc);
+        conv = encoders.get(enc);
         if (conv == null) {
             
             if (Globals.IS_SECURITY_ENABLED){
                 try{
-                    conv = (C2BConverter)AccessController.doPrivileged(
-                            new PrivilegedExceptionAction(){
+                    conv = AccessController.doPrivileged(
+                            new PrivilegedExceptionAction<C2BConverter>(){
 
-                                public Object run() throws IOException{
+                                public C2BConverter run() throws IOException{
                                     return new C2BConverter(bb, enc);
                                 }
 

Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Sat Dec 27 10:30:47 2008
@@ -169,26 +169,28 @@
     /**
      * The attributes associated with this Request, keyed by attribute name.
      */
-    protected HashMap attributes = new HashMap();
+    protected HashMap<String, Object> attributes =
+        new HashMap<String, Object>();
 
 
     /**
      * List of read only attributes for this Request.
      */
-    private HashMap readOnlyAttributes = new HashMap();
+    private HashMap<String,Object> readOnlyAttributes =
+        new HashMap<String,Object>();
 
 
     /**
      * The preferred Locales assocaited with this Request.
      */
-    protected ArrayList locales = new ArrayList();
+    protected ArrayList<Locale> locales = new ArrayList<Locale>();
 
 
     /**
      * Internal notes associated with this request by Catalina components
      * and event listeners.
      */
-    private transient HashMap notes = new HashMap();
+    private transient HashMap<String, Object> notes = new HashMap<String, Object>();
 
 
     /**
@@ -292,7 +294,7 @@
     /**
      * Hash map used in the getParametersMap method.
      */
-    protected ParameterMap parameterMap = new ParameterMap();
+    protected ParameterMap<String, String[]> parameterMap = new ParameterMap<String, String[]>();
 
 
     /**
@@ -424,7 +426,7 @@
         requestedSessionURL = false;
 
         if (Globals.IS_SECURITY_ENABLED || Connector.RECYCLE_FACADES) {
-            parameterMap = new ParameterMap();
+            parameterMap = new ParameterMap<String, String[]>();
         } else {
             parameterMap.setLocked(false);
             parameterMap.clear();
@@ -740,7 +742,7 @@
      * Return an Iterator containing the String names of all notes bindings
      * that exist for this request.
      */
-    public Iterator getNoteNames() {
+    public Iterator<String> getNoteNames() {
         return (notes.keySet().iterator());
     }
 
@@ -931,11 +933,11 @@
      * Return the names of all request attributes for this Request, or an
      * empty <code>Enumeration</code> if there are none.
      */
-    public Enumeration getAttributeNames() {
+    public Enumeration<String> getAttributeNames() {
         if (isSecure()) {
             getAttribute(Globals.CERTIFICATES_ATTR);
         }
-        return new Enumerator(attributes.keySet(), true);
+        return new Enumerator<String>(attributes.keySet(), true);
     }
 
 
@@ -999,7 +1001,7 @@
             parseLocales();
 
         if (locales.size() > 0) {
-            return ((Locale) locales.get(0));
+            return locales.get(0);
         } else {
             return (defaultLocale);
         }
@@ -1013,16 +1015,16 @@
      * headers that were encountered.  If the request did not specify a
      * preferred language, the server's default Locale is returned.
      */
-    public Enumeration getLocales() {
+    public Enumeration<Locale> getLocales() {
 
         if (!localesParsed)
             parseLocales();
 
         if (locales.size() > 0)
-            return (new Enumerator(locales));
-        ArrayList results = new ArrayList();
+            return (new Enumerator<Locale>(locales));
+        ArrayList<Locale> results = new ArrayList<Locale>();
         results.add(defaultLocale);
-        return (new Enumerator(results));
+        return (new Enumerator<Locale>(results));
 
     }
 
@@ -1054,14 +1056,14 @@
      * @return A <code>Map</code> containing parameter names as keys
      *  and parameter values as map values.
      */
-    public Map getParameterMap() {
+    public Map<String, String[]> getParameterMap() {
 
         if (parameterMap.isLocked())
             return parameterMap;
 
-        Enumeration enumeration = getParameterNames();
+        Enumeration<String> enumeration = getParameterNames();
         while (enumeration.hasMoreElements()) {
-            String name = enumeration.nextElement().toString();
+            String name = enumeration.nextElement();
             String[] values = getParameterValues(name);
             parameterMap.put(name, values);
         }
@@ -2533,10 +2535,10 @@
 
         localesParsed = true;
 
-        Enumeration values = getHeaders("accept-language");
+        Enumeration<String> values = getHeaders("accept-language");
 
         while (values.hasMoreElements()) {
-            String value = values.nextElement().toString();
+            String value = values.nextElement();
             parseLocalesHeader(value);
         }
 
@@ -2552,7 +2554,7 @@
         // a local collection, sorted by the quality value (so we can
         // add Locales in descending order).  The values will be ArrayLists
         // containing the corresponding Locales to be added
-        TreeMap locales = new TreeMap();
+        TreeMap<Double, ArrayList<Locale>> locales = new TreeMap<Double, ArrayList<Locale>>();
 
         // Preprocess the value to remove all whitespace
         int white = value.indexOf(' ');
@@ -2628,9 +2630,9 @@
             // Add a new Locale to the list of Locales for this quality level
             Locale locale = new Locale(language, country, variant);
             Double key = new Double(-quality);  // Reverse the order
-            ArrayList values = (ArrayList) locales.get(key);
+            ArrayList<Locale> values = locales.get(key);
             if (values == null) {
-                values = new ArrayList();
+                values = new ArrayList<Locale>();
                 locales.put(key, values);
             }
             values.add(locale);
@@ -2639,13 +2641,13 @@
 
         // Process the quality values in highest->lowest order (due to
         // negating the Double value when creating the key)
-        Iterator keys = locales.keySet().iterator();
+        Iterator<Double> keys = locales.keySet().iterator();
         while (keys.hasNext()) {
-            Double key = (Double) keys.next();
-            ArrayList list = (ArrayList) locales.get(key);
-            Iterator values = list.iterator();
+            Double key = keys.next();
+            ArrayList<Locale> list = locales.get(key);
+            Iterator<Locale> values = list.iterator();
             while (values.hasNext()) {
-                Locale locale = (Locale) values.next();
+                Locale locale = values.next();
                 addLocale(locale);
             }
         }

Modified: tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java Sat Dec 27 10:30:47 2008
@@ -55,25 +55,25 @@
     // ----------------------------------------------------------- DoPrivileged
     
     private final class GetAttributePrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Enumeration<String>> {
         
-        public Object run() {
+        public Enumeration<String> run() {
             return request.getAttributeNames();
         }            
     }
      
     
     private final class GetParameterMapPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Map<String,String[]>> {
         
-        public Object run() {
+        public Map<String,String[]> run() {
             return request.getParameterMap();
         }        
     }    
     
     
     private final class GetRequestDispatcherPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<RequestDispatcher> {
 
         private String path;
 
@@ -81,14 +81,14 @@
             this.path = path;
         }
         
-        public Object run() {   
+        public RequestDispatcher run() {   
             return request.getRequestDispatcher(path);
         }           
     }    
     
     
     private final class GetParameterPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<String> {
 
         public String name;
 
@@ -96,23 +96,23 @@
             this.name = name;
         }
 
-        public Object run() {       
+        public String run() {       
             return request.getParameter(name);
         }           
     }    
     
      
     private final class GetParameterNamesPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Enumeration<String>> {
         
-        public Object run() {          
+        public Enumeration<String> run() {          
             return request.getParameterNames();
         }           
     } 
     
     
     private final class GetParameterValuePrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<String[]> {
 
         public String name;
 
@@ -120,32 +120,32 @@
             this.name = name;
         }
 
-        public Object run() {       
+        public String[] run() {       
             return request.getParameterValues(name);
         }           
     }    
   
     
     private final class GetCookiesPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Cookie[]> {
         
-        public Object run() {       
+        public Cookie[] run() {       
             return request.getCookies();
         }           
     }      
     
     
     private final class GetCharacterEncodingPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<String> {
         
-        public Object run() {       
+        public String run() {       
             return request.getCharacterEncoding();
         }           
     }   
         
     
     private final class GetHeadersPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Enumeration<String>> {
 
         private String name;
 
@@ -153,40 +153,40 @@
             this.name = name;
         }
         
-        public Object run() {       
+        public Enumeration<String> run() {       
             return request.getHeaders(name);
         }           
     }    
         
     
     private final class GetHeaderNamesPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Enumeration<String>> {
 
-        public Object run() {       
+        public Enumeration<String> run() {       
             return request.getHeaderNames();
         }           
     }  
             
     
     private final class GetLocalePrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Locale> {
 
-        public Object run() {       
+        public Locale run() {       
             return request.getLocale();
         }           
     }    
             
     
     private final class GetLocalesPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Enumeration<Locale>> {
 
-        public Object run() {       
+        public Enumeration<Locale> run() {       
             return request.getLocales();
         }           
     }    
     
     private final class GetSessionPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<HttpSession> {
 
         private boolean create;
         
@@ -194,7 +194,7 @@
             this.create = create;
         }
                 
-        public Object run() {  
+        public HttpSession run() {  
             return request.getSession(create);
         }           
     }
@@ -272,7 +272,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Enumeration)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetAttributePrivilegedAction());        
         } else {
             return request.getAttributeNames();
@@ -288,7 +288,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (String)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetCharacterEncodingPrivilegedAction());
         } else {
             return request.getCharacterEncoding();
@@ -349,7 +349,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (String)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetParameterPrivilegedAction(name));
         } else {
             return request.getParameter(name);
@@ -365,7 +365,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Enumeration)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetParameterNamesPrivilegedAction());
         } else {
             return request.getParameterNames();
@@ -387,10 +387,10 @@
          * in place, so that performance won't suffer in the nonsecure case
          */
         if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = (String[]) AccessController.doPrivileged(
+            ret = AccessController.doPrivileged(
                 new GetParameterValuePrivilegedAction(name));
             if (ret != null) {
-                ret = (String[]) ret.clone();
+                ret = ret.clone();
             }
         } else {
             ret = request.getParameterValues(name);
@@ -408,7 +408,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Map)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetParameterMapPrivilegedAction());        
         } else {
             return request.getParameterMap();
@@ -523,7 +523,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Locale)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetLocalePrivilegedAction());
         } else {
             return request.getLocale();
@@ -539,7 +539,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Enumeration)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetLocalesPrivilegedAction());
         } else {
             return request.getLocales();
@@ -566,7 +566,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (RequestDispatcher)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetRequestDispatcherPrivilegedAction(path));
         } else {
             return request.getRequestDispatcher(path);
@@ -609,10 +609,10 @@
          * in place, so that performance won't suffer in the nonsecure case
          */
         if (SecurityUtil.isPackageProtectionEnabled()){
-            ret = (Cookie[])AccessController.doPrivileged(
+            ret = AccessController.doPrivileged(
                 new GetCookiesPrivilegedAction());
             if (ret != null) {
-                ret = (Cookie[]) ret.clone();
+                ret = ret.clone();
             }
         } else {
             ret = request.getCookies();
@@ -652,7 +652,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Enumeration)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetHeadersPrivilegedAction(name));
         } else {
             return request.getHeaders(name);
@@ -668,7 +668,7 @@
         }
 
         if (Globals.IS_SECURITY_ENABLED){
-            return (Enumeration)AccessController.doPrivileged(
+            return AccessController.doPrivileged(
                 new GetHeaderNamesPrivilegedAction());
         } else {
             return request.getHeaderNames();
@@ -827,7 +827,7 @@
         }
 
         if (SecurityUtil.isPackageProtectionEnabled()){
-            return (HttpSession)AccessController.
+            return AccessController.
                 doPrivileged(new GetSessionPrivilegedAction(create));
         } else {
             return request.getSession(create);

Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Sat Dec 27 10:30:47 2008
@@ -222,7 +222,7 @@
     /**
      * The set of Cookies associated with this Response.
      */
-    protected ArrayList cookies = new ArrayList();
+    protected ArrayList<Cookie> cookies = new ArrayList<Cookie>();
 
 
     /**
@@ -380,7 +380,7 @@
      * @param request The new associated request
      */
     public void setRequest(org.apache.catalina.connector.Request request) {
-        this.request = (Request) request;
+        this.request = request;
     }
 
 
@@ -864,7 +864,7 @@
      * a zero-length array if no cookies have been set.
      */
     public Cookie[] getCookies() {
-        return ((Cookie[]) cookies.toArray(new Cookie[cookies.size()]));
+        return cookies.toArray(new Cookie[cookies.size()]);
     }
 
 
@@ -907,8 +907,9 @@
      */
     public String[] getHeaderValues(String name) {
 
-        Enumeration enumeration = coyoteResponse.getMimeHeaders().values(name);
-        Vector result = new Vector();
+        Enumeration<String> enumeration =
+            coyoteResponse.getMimeHeaders().values(name);
+        Vector<String> result = new Vector<String>();
         while (enumeration.hasMoreElements()) {
             result.addElement(enumeration.nextElement());
         }
@@ -995,8 +996,8 @@
         //web application code can receive a IllegalArgumentException 
         //from the appendCookieValue invokation
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run(){
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                public Void run(){
                     ServerCookie.appendCookieValue
                         (sb, cookie.getVersion(), cookie.getName(), 
                          cookie.getValue(), cookie.getPath(), 
@@ -1430,10 +1431,10 @@
             return (false);
         
         if (SecurityUtil.isPackageProtectionEnabled()) {
-            return ((Boolean)
-                AccessController.doPrivileged(new PrivilegedAction() {
+            return (
+                AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
 
-                public Object run(){
+                public Boolean run(){
                     return new Boolean(doIsEncodeable(hreq, session, location));
                 }
             })).booleanValue();
@@ -1534,9 +1535,9 @@
                     final String frelativePath = relativePath;
                     if (SecurityUtil.isPackageProtectionEnabled() ){
                         try{
-                            encodedURI = (String)AccessController.doPrivileged( 
-                                new PrivilegedExceptionAction(){                                
-                                    public Object run() throws IOException{
+                            encodedURI = AccessController.doPrivileged( 
+                                new PrivilegedExceptionAction<String>(){                                
+                                    public String run() throws IOException{
                                         return urlEncoder.encodeURL(frelativePath);
                                     }
                            });   

Modified: tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java?rev=729651&r1=729650&r2=729651&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/ResponseFacade.java Sat Dec 27 10:30:47 2008
@@ -50,7 +50,7 @@
     // ----------------------------------------------------------- DoPrivileged
     
     private final class SetContentTypePrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Void> {
 
         private String contentType;
 
@@ -58,14 +58,14 @@
             this.contentType = contentType;
         }
         
-        public Object run() {
+        public Void run() {
             response.setContentType(contentType);
             return null;
         }            
     }
 
     private final class DateHeaderPrivilegedAction
-            implements PrivilegedAction {
+            implements PrivilegedAction<Void> {
 
         private String name;
         private long value;
@@ -77,7 +77,7 @@
             this.add = add;
         }
 
-        public Object run() {
+        public Void run() {
             if(add) {
                 response.addDateHeader(name, value);
             } else {
@@ -258,9 +258,10 @@
 
         if (SecurityUtil.isPackageProtectionEnabled()){
             try{
-                AccessController.doPrivileged(new PrivilegedExceptionAction(){
+                AccessController.doPrivileged(
+                        new PrivilegedExceptionAction<Void>(){
 
-                    public Object run() throws IOException{
+                    public Void run() throws IOException{
                         response.setAppCommitted(true);
 
                         response.flushBuffer();



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