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 18:48:14 UTC
svn commit: r729650 - /tomcat/trunk/java/org/apache/catalina/core/
Author: markt
Date: Sat Dec 27 09:48:13 2008
New Revision: 729650
URL: http://svn.apache.org/viewvc?rev=729650&view=rev
Log:
Generics changes for o.a.c.core
Fix various Eclipse warnings (unused code, unnecessary casts, etc)
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
tomcat/trunk/java/org/apache/catalina/core/ApplicationRequest.java
tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java
tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
tomcat/trunk/java/org/apache/catalina/core/StandardContextValve.java
tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java
tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
tomcat/trunk/java/org/apache/catalina/core/StandardService.java
tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Sat Dec 27 09:48:13 2008
@@ -111,7 +111,7 @@
* Empty collection to serve as the basis for empty enumerations.
* <strong>DO NOT ADD ANY ELEMENTS TO THIS COLLECTION!</strong>
*/
- private static final ArrayList empty = new ArrayList();
+ private static final ArrayList<Object> empty = new ArrayList<Object>();
/**
@@ -123,7 +123,7 @@
/**
* The merged context initialization parameters for this Context.
*/
- private Map parameters = null;
+ private Map<String,String> parameters = null;
/**
@@ -183,7 +183,7 @@
*/
public Enumeration getAttributeNames() {
- return new Enumerator(attributes.keySet(), true);
+ return new Enumerator<String>(attributes.keySet(), true);
}
@@ -254,7 +254,7 @@
public String getInitParameter(final String name) {
mergeParameters();
- return ((String) parameters.get(name));
+ return parameters.get(name);
}
@@ -266,7 +266,7 @@
public Enumeration getInitParameterNames() {
mergeParameters();
- return (new Enumerator(parameters.keySet()));
+ return (new Enumerator<String>(parameters.keySet()));
}
@@ -478,7 +478,7 @@
jarFile = new File(context.getWorkPath(), path);
}
if (jarFile.exists()) {
- return jarFile.toURL();
+ return jarFile.toURI().toURL();
} else {
return null;
}
@@ -572,9 +572,10 @@
* @param resources Directory context to search
* @param path Collection path
*/
- private Set getResourcePathsInternal(DirContext resources, String path) {
+ private Set<String> getResourcePathsInternal(DirContext resources,
+ String path) {
- ResourceSet set = new ResourceSet();
+ ResourceSet<String> set = new ResourceSet<String>();
try {
listCollectionPaths(set, resources, path);
} catch (NamingException e) {
@@ -620,7 +621,7 @@
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
public Enumeration getServletNames() {
- return (new Enumerator(empty));
+ return (new Enumerator<Object>(empty));
}
@@ -628,7 +629,7 @@
* @deprecated As of Java Servlet API 2.1, with no direct replacement.
*/
public Enumeration getServlets() {
- return (new Enumerator(empty));
+ return (new Enumerator<Object>(empty));
}
@@ -809,7 +810,7 @@
return this.context;
}
- protected Map getReadonlyAttributes() {
+ protected Map<String,String> getReadonlyAttributes() {
return this.readOnlyAttributes;
}
/**
@@ -818,17 +819,17 @@
protected void clearAttributes() {
// Create list of attributes to be removed
- ArrayList list = new ArrayList();
- Iterator iter = attributes.keySet().iterator();
+ ArrayList<String> list = new ArrayList<String>();
+ Iterator<String> iter = attributes.keySet().iterator();
while (iter.hasNext()) {
list.add(iter.next());
}
// Remove application originated attributes
// (read only attributes will be left in place)
- Iterator keys = list.iterator();
+ Iterator<String> keys = list.iterator();
while (keys.hasNext()) {
- String key = (String) keys.next();
+ String key = keys.next();
removeAttribute(key);
}
@@ -908,7 +909,7 @@
if (parameters != null)
return;
- Map results = new ConcurrentHashMap();
+ Map<String,String> results = new ConcurrentHashMap<String,String>();
String names[] = context.findParameters();
for (int i = 0; i < names.length; i++)
results.put(names[i], context.findParameter(names[i]));
@@ -931,13 +932,12 @@
* List resource paths (recursively), and store all of them in the given
* Set.
*/
- private static void listCollectionPaths
- (Set set, DirContext resources, String path)
- throws NamingException {
+ private static void listCollectionPaths(Set<String> set,
+ DirContext resources, String path) throws NamingException {
- Enumeration childPaths = resources.listBindings(path);
+ Enumeration<Binding> childPaths = resources.listBindings(path);
while (childPaths.hasMoreElements()) {
- Binding binding = (Binding) childPaths.nextElement();
+ Binding binding = childPaths.nextElement();
String name = binding.getName();
StringBuffer childPath = new StringBuffer(path);
if (!"/".equals(path) && !path.endsWith("/"))
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java Sat Dec 27 09:48:13 2008
@@ -56,13 +56,13 @@
/**
* Cache Class object used for reflection.
*/
- private HashMap classCache;
+ private HashMap<String,Class<?>[]> classCache;
/**
* Cache method object.
*/
- private HashMap objectCache;
+ private HashMap<String,Method> objectCache;
// ----------------------------------------------------------- Constructors
@@ -78,14 +78,14 @@
super();
this.context = context;
- classCache = new HashMap();
- objectCache = new HashMap();
+ classCache = new HashMap<String,Class<?>[]>();
+ objectCache = new HashMap<String,Method>();
initClassCache();
}
private void initClassCache(){
- Class[] clazz = new Class[]{String.class};
+ Class<?>[] clazz = new Class[]{String.class};
classCache.put("getContext", clazz);
classCache.put("getMimeType", clazz);
classCache.put("getResourcePaths", clazz);
@@ -367,26 +367,6 @@
/**
* Use reflection to invoke the requested method. Cache the method object
* to speed up the process
- * @param appContext The AppliationContext object on which the method
- * will be invoked
- * @param methodName The method to call.
- * @param params The arguments passed to the called method.
- */
- private Object doPrivileged(ApplicationContext appContext,
- final String methodName,
- final Object[] params) {
- try{
- return invokeMethod(appContext, methodName, params );
- } catch (Throwable t){
- throw new RuntimeException(t.getMessage());
- }
-
- }
-
-
- /**
- * Use reflection to invoke the requested method. Cache the method object
- * to speed up the process
* will be invoked
* @param methodName The method to call.
* @param params The arguments passed to the called method.
@@ -414,16 +394,16 @@
throws Throwable{
try{
- Method method = (Method)objectCache.get(methodName);
+ Method method = objectCache.get(methodName);
if (method == null){
method = appContext.getClass()
- .getMethod(methodName, (Class[])classCache.get(methodName));
+ .getMethod(methodName, classCache.get(methodName));
objectCache.put(methodName, method);
}
return executeMethod(method,appContext,params);
} catch (Exception ex){
- handleException(ex, methodName);
+ handleException(ex);
return null;
} finally {
params = null;
@@ -438,16 +418,15 @@
* @param params The arguments passed to the called method.
*/
private Object doPrivileged(final String methodName,
- final Class[] clazz,
+ final Class<?>[] clazz,
Object[] params){
try{
- Method method = context.getClass()
- .getMethod(methodName, (Class[])clazz);
+ Method method = context.getClass().getMethod(methodName, clazz);
return executeMethod(method,context,params);
} catch (Exception ex){
try{
- handleException(ex, methodName);
+ handleException(ex);
}catch (Throwable t){
throw new RuntimeException(t.getMessage());
}
@@ -473,7 +452,7 @@
InvocationTargetException {
if (SecurityUtil.isPackageProtectionEnabled()){
- return AccessController.doPrivileged(new PrivilegedExceptionAction(){
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>(){
public Object run() throws IllegalAccessException, InvocationTargetException{
return method.invoke(context, params);
}
@@ -489,7 +468,7 @@
* Throw the real exception.
* @param ex The current exception
*/
- private void handleException(Exception ex, String methodName)
+ private void handleException(Exception ex)
throws Throwable {
Throwable realException;
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java Sat Dec 27 09:48:13 2008
@@ -66,7 +66,8 @@
implements RequestDispatcher {
- protected class PrivilegedForward implements PrivilegedExceptionAction {
+ protected class PrivilegedForward
+ implements PrivilegedExceptionAction<Void> {
private ServletRequest request;
private ServletResponse response;
@@ -76,13 +77,14 @@
this.response = response;
}
- public Object run() throws java.lang.Exception {
+ public Void run() throws java.lang.Exception {
doForward(request,response);
return null;
}
}
- protected class PrivilegedInclude implements PrivilegedExceptionAction {
+ protected class PrivilegedInclude implements
+ PrivilegedExceptionAction<Void> {
private ServletRequest request;
private ServletResponse response;
@@ -92,7 +94,7 @@
this.response = response;
}
- public Object run() throws ServletException, IOException {
+ public Void run() throws ServletException, IOException {
doInclude(request,response);
return null;
}
@@ -397,12 +399,12 @@
ServletOutputStream stream = response.getOutputStream();
stream.close();
} catch (IllegalStateException f) {
- ;
+ // Ignore
} catch (IOException f) {
- ;
+ // Ignore
}
} catch (IOException e) {
- ;
+ // Ignore
}
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Sat Dec 27 09:48:13 2008
@@ -56,13 +56,13 @@
final class ApplicationFilterChain implements FilterChain, CometFilterChain {
// Used to enforce requirements of SRV.8.2 / SRV.14.2.5.1
- private final static ThreadLocal lastServicedRequest;
- private final static ThreadLocal lastServicedResponse;
+ private final static ThreadLocal<ServletRequest> lastServicedRequest;
+ private final static ThreadLocal<ServletResponse> lastServicedResponse;
static {
if (Globals.STRICT_SERVLET_COMPLIANCE) {
- lastServicedRequest = new ThreadLocal();
- lastServicedResponse = new ThreadLocal();
+ lastServicedRequest = new ThreadLocal<ServletRequest>();
+ lastServicedResponse = new ThreadLocal<ServletResponse>();
} else {
lastServicedRequest = null;
lastServicedResponse = null;
@@ -135,15 +135,15 @@
* Static class array used when the SecurityManager is turned on and
* <code>doFilter</code> is invoked.
*/
- private static Class[] classType = new Class[]{ServletRequest.class,
- ServletResponse.class,
- FilterChain.class};
+ private static Class<?>[] classType = new Class[]{ServletRequest.class,
+ ServletResponse.class,
+ FilterChain.class};
/**
* Static class array used when the SecurityManager is turned on and
* <code>service</code> is invoked.
*/
- private static Class[] classTypeUsedInService = new Class[]{
+ private static Class<?>[] classTypeUsedInService = new Class[]{
ServletRequest.class,
ServletResponse.class};
@@ -151,14 +151,14 @@
* Static class array used when the SecurityManager is turned on and
* <code>doFilterEvent</code> is invoked.
*/
- private static Class[] cometClassType =
+ private static Class<?>[] cometClassType =
new Class[]{ CometEvent.class, CometFilterChain.class};
/**
* Static class array used when the SecurityManager is turned on and
* <code>event</code> is invoked.
*/
- private static Class[] classTypeUsedInEvent =
+ private static Class<?>[] classTypeUsedInEvent =
new Class[] { CometEvent.class };
// ---------------------------------------------------- FilterChain Methods
@@ -183,8 +183,8 @@
final ServletResponse res = response;
try {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run()
+ new java.security.PrivilegedExceptionAction<Void>() {
+ public Void run()
throws ServletException, IOException {
internalDoFilter(req,res);
return null;
@@ -287,8 +287,7 @@
principal);
args = null;
} else {
- servlet.service((HttpServletRequest) request,
- (HttpServletResponse) response);
+ servlet.service(request, response);
}
} else {
servlet.service(request, response);
@@ -340,8 +339,8 @@
final CometEvent ev = event;
try {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run()
+ new java.security.PrivilegedExceptionAction<Void>() {
+ public Void run()
throws ServletException, IOException {
internalDoFilterEvent(ev);
return null;
@@ -372,7 +371,7 @@
* @return The last request to be serviced.
*/
public static ServletRequest getLastServicedRequest() {
- return (ServletRequest) lastServicedRequest.get();
+ return lastServicedRequest.get();
}
@@ -383,7 +382,7 @@
* @return The last response to be serviced.
*/
public static ServletResponse getLastServicedResponse() {
- return (ServletResponse) lastServicedResponse.get();
+ return lastServicedResponse.get();
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java Sat Dec 27 09:48:13 2008
@@ -140,11 +140,11 @@
*/
public String getInitParameter(String name) {
- Map map = filterDef.getParameterMap();
+ Map<String,String> map = filterDef.getParameterMap();
if (map == null)
return (null);
else
- return ((String) map.get(name));
+ return map.get(name);
}
@@ -155,11 +155,11 @@
*/
public Enumeration getInitParameterNames() {
- Map map = filterDef.getParameterMap();
+ Map<String,String> map = filterDef.getParameterMap();
if (map == null)
- return (new Enumerator(new ArrayList()));
+ return (new Enumerator<String>(new ArrayList<String>()));
else
- return (new Enumerator(map.keySet()));
+ return (new Enumerator<String>(map.keySet()));
}
@@ -329,7 +329,7 @@
} else {
// Allocate a new filter instance
- Filter filter = getFilter();
+ getFilter();
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterFactory.java Sat Dec 27 09:48:13 2008
@@ -21,7 +21,6 @@
import javax.servlet.Servlet;
import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpServletRequest;
import org.apache.catalina.CometFilter;
import org.apache.catalina.Globals;
@@ -58,7 +57,7 @@
public static final String DISPATCHER_REQUEST_PATH_ATTR =
Globals.DISPATCHER_REQUEST_PATH_ATTR;
- private static ApplicationFilterFactory factory = null;;
+ private static ApplicationFilterFactory factory = null;
// ----------------------------------------------------------- Constructors
@@ -110,9 +109,6 @@
requestPath = attribute.toString();
}
- HttpServletRequest hreq = null;
- if (request instanceof HttpServletRequest)
- hreq = (HttpServletRequest)request;
// If there is no servlet to execute, return null
if (servlet == null)
return (null);
@@ -168,7 +164,7 @@
ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
context.findFilterConfig(filterMaps[i].getFilterName());
if (filterConfig == null) {
- ; // FIXME - log configuration problem
+ // FIXME - log configuration problem
continue;
}
boolean isCometFilter = false;
@@ -198,7 +194,7 @@
ApplicationFilterConfig filterConfig = (ApplicationFilterConfig)
context.findFilterConfig(filterMaps[i].getFilterName());
if (filterConfig == null) {
- ; // FIXME - log configuration problem
+ // FIXME - log configuration problem
continue;
}
boolean isCometFilter = false;
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Sat Dec 27 09:48:13 2008
@@ -140,7 +140,7 @@
* The request parameters for this request. This is initialized from the
* wrapped request, but updates are allowed.
*/
- protected Map parameters = null;
+ protected Map<String, String[]> parameters = null;
/**
@@ -369,7 +369,7 @@
* Override the <code>getParameterMap()</code> method of the
* wrapped request.
*/
- public Map getParameterMap() {
+ public Map<String, String[]> getParameterMap() {
parseParameters();
return (parameters);
@@ -381,10 +381,10 @@
* Override the <code>getParameterNames()</code> method of the
* wrapped request.
*/
- public Enumeration getParameterNames() {
+ public Enumeration<String> getParameterNames() {
parseParameters();
- return (new Enumerator(parameters.keySet()));
+ return (new Enumerator<String>(parameters.keySet()));
}
@@ -400,7 +400,7 @@
parseParameters();
Object value = parameters.get(name);
if (value == null)
- return ((String[]) null);
+ return null;
else if (value instanceof String[])
return ((String[]) value);
else if (value instanceof String) {
@@ -613,14 +613,14 @@
*
* @param orig Origin Map to be copied
*/
- Map copyMap(Map orig) {
+ Map<String, String[]> copyMap(Map<String, String[]> orig) {
if (orig == null)
- return (new HashMap());
- HashMap dest = new HashMap();
- Iterator keys = orig.keySet().iterator();
+ return (new HashMap<String, String[]>());
+ HashMap<String, String[]> dest = new HashMap<String, String[]>();
+ Iterator<String> keys = orig.keySet().iterator();
while (keys.hasNext()) {
- String key = (String) keys.next();
+ String key = keys.next();
dest.put(key, orig.get(key));
}
return (dest);
@@ -724,7 +724,7 @@
return;
}
- parameters = new HashMap();
+ parameters = new HashMap<String, String[]>();
parameters = copyMap(getRequest().getParameterMap());
mergeParameters();
parsedParams = true;
@@ -818,7 +818,7 @@
*/
protected String[] mergeValues(Object values1, Object values2) {
- ArrayList results = new ArrayList();
+ ArrayList<Object> results = new ArrayList<Object>();
if (values1 == null)
;
@@ -843,7 +843,7 @@
results.add(values2.toString());
String values[] = new String[results.size()];
- return ((String[]) results.toArray(values));
+ return results.toArray(values);
}
@@ -862,7 +862,7 @@
if ((queryParamString == null) || (queryParamString.length() < 1))
return;
- HashMap queryParameters = new HashMap();
+ HashMap<String, String[]> queryParameters = new HashMap<String, String[]>();
String encoding = getCharacterEncoding();
if (encoding == null)
encoding = "ISO-8859-1";
@@ -870,11 +870,11 @@
RequestUtil.parseParameters
(queryParameters, queryParamString, encoding);
} catch (Exception e) {
- ;
+ // Ignore
}
- Iterator keys = parameters.keySet().iterator();
+ Iterator<String> keys = parameters.keySet().iterator();
while (keys.hasNext()) {
- String key = (String) keys.next();
+ String key = keys.next();
Object value = queryParameters.get(key);
if (value == null) {
queryParameters.put(key, parameters.get(key));
@@ -895,11 +895,11 @@
* Utility class used to expose the special attributes as being available
* as request attributes.
*/
- protected class AttributeNamesEnumerator implements Enumeration {
+ protected class AttributeNamesEnumerator implements Enumeration<String> {
protected int pos = -1;
protected int last = -1;
- protected Enumeration parentEnumeration = null;
+ protected Enumeration<String> parentEnumeration = null;
protected String next = null;
public AttributeNamesEnumerator() {
@@ -916,7 +916,7 @@
|| ((next = findNext()) != null));
}
- public Object nextElement() {
+ public String nextElement() {
if (pos != last) {
for (int i = pos + 1; i <= last; i++) {
if (getAttribute(specials[i]) != null) {
@@ -937,7 +937,7 @@
protected String findNext() {
String result = null;
while ((result == null) && (parentEnumeration.hasMoreElements())) {
- String current = (String) parentEnumeration.nextElement();
+ String current = parentEnumeration.nextElement();
if (!isSpecial(current)) {
result = current;
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationRequest.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationRequest.java Sat Dec 27 09:48:13 2008
@@ -86,7 +86,8 @@
* The request attributes for this request. This is initialized from the
* wrapped request, but updates are allowed.
*/
- protected HashMap attributes = new HashMap();
+ protected HashMap<String, Object> attributes =
+ new HashMap<String, Object>();
/**
@@ -117,10 +118,10 @@
* Override the <code>getAttributeNames()</code> method of the wrapped
* request.
*/
- public Enumeration getAttributeNames() {
+ public Enumeration<String> getAttributeNames() {
synchronized (attributes) {
- return (new Enumerator(attributes.keySet()));
+ return (new Enumerator<String>(attributes.keySet()));
}
}
@@ -176,9 +177,9 @@
// Initialize the attributes for this request
synchronized (attributes) {
attributes.clear();
- Enumeration names = request.getAttributeNames();
+ Enumeration<String> names = request.getAttributeNames();
while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
+ String name = names.nextElement();
Object value = request.getAttribute(name);
attributes.put(name, value);
}
Modified: tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/AprLifecycleListener.java Sat Dec 27 09:48:13 2008
@@ -127,11 +127,11 @@
}
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);
@@ -188,8 +188,11 @@
+ minor + "." + patch));
}
// Log APR flags
- log.info(sm.getString("aprListener.flags", Library.APR_HAVE_IPV6, Library.APR_HAS_SENDFILE,
- Library.APR_HAS_SO_ACCEPTFILTER, Library.APR_HAS_RANDOM));
+ log.info(sm.getString("aprListener.flags",
+ Boolean.valueOf(Library.APR_HAVE_IPV6),
+ Boolean.valueOf(Library.APR_HAS_SENDFILE),
+ Boolean.valueOf(Library.APR_HAS_SO_ACCEPTFILTER),
+ Boolean.valueOf(Library.APR_HAS_RANDOM)));
return true;
}
@@ -206,11 +209,11 @@
return;
}
String methodName = "randSet";
- Class paramTypes[] = new Class[1];
+ Class<?> paramTypes[] = new Class[1];
paramTypes[0] = String.class;
Object paramValues[] = new Object[1];
paramValues[0] = SSLRandomSeed;
- Class clazz = Class.forName("org.apache.tomcat.jni.SSL");
+ Class<?> clazz = Class.forName("org.apache.tomcat.jni.SSL");
Method method = clazz.getMethod(methodName, paramTypes);
method.invoke(null, paramValues);
@@ -228,7 +231,7 @@
}
public void setSSLEngine(String SSLEngine) {
- this.SSLEngine = SSLEngine;
+ AprLifecycleListener.SSLEngine = SSLEngine;
}
public String getSSLRandomSeed() {
@@ -236,6 +239,6 @@
}
public void setSSLRandomSeed(String SSLRandomSeed) {
- this.SSLRandomSeed = SSLRandomSeed;
+ AprLifecycleListener.SSLRandomSeed = SSLRandomSeed;
}
}
Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Sat Dec 27 09:48:13 2008
@@ -133,7 +133,7 @@
* Tomcat.
*/
protected class PrivilegedAddChild
- implements PrivilegedAction {
+ implements PrivilegedAction<Void> {
private Container child;
@@ -141,7 +141,7 @@
this.child = child;
}
- public Object run() {
+ public Void run() {
addChildInternal(child);
return null;
}
@@ -155,7 +155,8 @@
/**
* The child Containers belonging to this Container, keyed by name.
*/
- protected HashMap children = new HashMap();
+ protected HashMap<String, Container> children =
+ new HashMap<String, Container>();
/**
@@ -173,7 +174,7 @@
/**
* The container event listeners for this Container.
*/
- protected ArrayList listeners = new ArrayList();
+ protected ArrayList<ContainerListener> listeners = new ArrayList<ContainerListener>();
/**
@@ -731,7 +732,7 @@
DirContext oldResources = this.resources;
if (oldResources == resources)
return;
- Hashtable env = new Hashtable();
+ Hashtable<String, String> env = new Hashtable<String, String>();
if (getParent() != null)
env.put(ProxyDirContext.HOST, getParent().getName());
env.put(ProxyDirContext.CONTEXT, getName());
@@ -764,7 +765,7 @@
*/
public void addChild(Container child) {
if (Globals.IS_SECURITY_ENABLED) {
- PrivilegedAction dp =
+ PrivilegedAction<Void> dp =
new PrivilegedAddChild(child);
AccessController.doPrivileged(dp);
} else {
@@ -844,7 +845,7 @@
if (name == null)
return (null);
synchronized (children) { // Required by post-start changes
- return ((Container) children.get(name));
+ return children.get(name);
}
}
@@ -858,7 +859,7 @@
synchronized (children) {
Container results[] = new Container[children.size()];
- return ((Container[]) children.values().toArray(results));
+ return children.values().toArray(results);
}
}
@@ -874,7 +875,7 @@
synchronized (listeners) {
ContainerListener[] results =
new ContainerListener[listeners.size()];
- return ((ContainerListener[]) listeners.toArray(results));
+ return listeners.toArray(results);
}
}
@@ -1356,10 +1357,10 @@
ContainerEvent event = new ContainerEvent(this, type, data);
ContainerListener list[] = new ContainerListener[0];
synchronized (listeners) {
- list = (ContainerListener[]) listeners.toArray(list);
+ list = listeners.toArray(list);
}
for (int i = 0; i < list.length; i++)
- ((ContainerListener) list[i]).containerEvent(event);
+ list[i].containerEvent(event);
}
@@ -1471,7 +1472,7 @@
public ObjectName[] getChildren() {
ObjectName result[]=new ObjectName[children.size()];
- Iterator it=children.values().iterator();
+ Iterator<Container> it=children.values().iterator();
int i=0;
while( it.hasNext() ) {
Object next=it.next();
@@ -1556,7 +1557,7 @@
try {
thread.join();
} catch (InterruptedException e) {
- ;
+ // Ignore
}
thread = null;
@@ -1578,7 +1579,7 @@
try {
Thread.sleep(backgroundProcessorDelay * 1000L);
} catch (InterruptedException e) {
- ;
+ // Ignore
}
if (!threadDone) {
Container parent = (Container) getMappingObject();
Modified: tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java Sat Dec 27 09:48:13 2008
@@ -77,7 +77,7 @@
protected FilterChain filterChain = null;
- private static Enumeration dummyEnum = new Enumeration(){
+ private static Enumeration<Object> dummyEnum = new Enumeration<Object>(){
public boolean hasMoreElements(){
return false;
}
@@ -179,7 +179,7 @@
}
public void finishRequest() throws IOException {}
public Object getNote(String name) { return null; }
- public Iterator getNoteNames() { return null; }
+ public Iterator<String> getNoteNames() { return null; }
public void removeNote(String name) {}
public void setContentType(String type) {}
public void setNote(String name, Object value) {}
Modified: tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java Sat Dec 27 09:48:13 2008
@@ -39,13 +39,11 @@
import org.apache.catalina.ContainerEvent;
import org.apache.catalina.ContainerListener;
import org.apache.catalina.Context;
-import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
-import org.apache.catalina.Service;
import org.apache.catalina.deploy.ContextEjb;
import org.apache.catalina.deploy.ContextEnvironment;
import org.apache.catalina.deploy.ContextHandler;
@@ -137,7 +135,8 @@
/**
* Objectnames hashtable.
*/
- protected HashMap objectNames = new HashMap();
+ protected HashMap<String, ObjectName> objectNames =
+ new HashMap<String, ObjectName>();
/**
@@ -218,7 +217,7 @@
if (initialized)
return;
- Hashtable contextEnv = new Hashtable();
+ Hashtable<String, Object> contextEnv = new Hashtable<String, Object>();
try {
namingContext = new NamingContext(contextEnv, getName());
} catch (NamingException e) {
@@ -665,9 +664,9 @@
compCtx.bind("UserTransaction", ref);
ContextTransaction transaction = namingResources.getTransaction();
if (transaction != null) {
- Iterator params = transaction.listProperties();
+ Iterator<String> params = transaction.listProperties();
while (params.hasNext()) {
- String paramName = (String) params.next();
+ String paramName = params.next();
String paramValue = (String) transaction.getProperty(paramName);
StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
ref.add(refAddr);
@@ -726,8 +725,6 @@
if (path.length() < 1)
path = "/";
Host host = (Host) ((Context)container).getParent();
- Engine engine = (Engine) host.getParent();
- Service service = engine.getService();
name = new ObjectName(domain + ":type=DataSource" +
",path=" + path +
",host=" + host.getName() +
@@ -749,9 +746,9 @@
Reference ref = new EjbRef
(ejb.getType(), ejb.getHome(), ejb.getRemote(), ejb.getLink());
// Adding the additional parameters, if any
- Iterator params = ejb.listProperties();
+ Iterator<String> params = ejb.listProperties();
while (params.hasNext()) {
- String paramName = (String) params.next();
+ String paramName = params.next();
String paramValue = (String) ejb.getProperty(paramName);
StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
ref.add(refAddr);
@@ -938,31 +935,31 @@
(service.getName(), service.getType(), service.getServiceqname(),
service.getWsdlfile(), service.getJaxrpcmappingfile());
// Adding the additional port-component-ref, if any
- Iterator portcomponent = service.getServiceendpoints();
+ Iterator<String> portcomponent = service.getServiceendpoints();
while (portcomponent.hasNext()) {
- String serviceendpoint = (String) portcomponent.next();
+ String serviceendpoint = portcomponent.next();
StringRefAddr refAddr = new StringRefAddr(ServiceRef.SERVICEENDPOINTINTERFACE, serviceendpoint);
ref.add(refAddr);
- String portlink = (String) service.getPortlink(serviceendpoint);
+ String portlink = service.getPortlink(serviceendpoint);
refAddr = new StringRefAddr(ServiceRef.PORTCOMPONENTLINK, portlink);
ref.add(refAddr);
}
// Adding the additional parameters, if any
- Iterator handlers = service.getHandlers();
+ Iterator<String> handlers = service.getHandlers();
while (handlers.hasNext()) {
- String handlername = (String) handlers.next();
- ContextHandler handler = (ContextHandler) service.getHandler(handlername);
+ String handlername = handlers.next();
+ ContextHandler handler = service.getHandler(handlername);
HandlerRef handlerRef = new HandlerRef(handlername, handler.getHandlerclass());
- Iterator localParts = handler.getLocalparts();
+ Iterator<String> localParts = handler.getLocalparts();
while (localParts.hasNext()) {
- String localPart = (String) localParts.next();
- String namespaceURI = (String) handler.getNamespaceuri(localPart);
+ String localPart = localParts.next();
+ String namespaceURI = handler.getNamespaceuri(localPart);
handlerRef.add(new StringRefAddr(HandlerRef.HANDLER_LOCALPART, localPart));
handlerRef.add(new StringRefAddr(HandlerRef.HANDLER_NAMESPACE, namespaceURI));
}
- Iterator params = handler.listProperties();
+ Iterator<String> params = handler.listProperties();
while (params.hasNext()) {
- String paramName = (String) params.next();
+ String paramName = params.next();
String paramValue = (String) handler.getProperty(paramName);
handlerRef.add(new StringRefAddr(HandlerRef.HANDLER_PARAMNAME, paramName));
handlerRef.add(new StringRefAddr(HandlerRef.HANDLER_PARAMVALUE, paramValue));
@@ -1000,9 +997,9 @@
(resource.getType(), resource.getDescription(),
resource.getScope(), resource.getAuth());
// Adding the additional parameters, if any
- Iterator params = resource.listProperties();
+ Iterator<String> params = resource.listProperties();
while (params.hasNext()) {
- String paramName = (String) params.next();
+ String paramName = params.next();
String paramValue = (String) resource.getProperty(paramName);
StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
ref.add(refAddr);
@@ -1040,9 +1037,9 @@
// Create a reference to the resource env.
Reference ref = new ResourceEnvRef(resourceEnvRef.getType());
// Adding the additional parameters, if any
- Iterator params = resourceEnvRef.listProperties();
+ Iterator<String> params = resourceEnvRef.listProperties();
while (params.hasNext()) {
- String paramName = (String) params.next();
+ String paramName = params.next();
String paramValue = (String) resourceEnvRef.getProperty(paramName);
StringRefAddr refAddr = new StringRefAddr(paramName, paramValue);
ref.add(refAddr);
@@ -1149,7 +1146,7 @@
logger.error(sm.getString("naming.unbindFailed", e));
}
- ObjectName on = (ObjectName) objectNames.get(name);
+ ObjectName on = objectNames.get(name);
if (on != null) {
Registry.getRegistry(null, null).unregisterComponent(on);
}
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContextValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContextValve.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContextValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContextValve.java Sat Dec 27 09:48:13 2008
@@ -131,7 +131,7 @@
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
- ;
+ // Ignore
}
}
@@ -309,9 +309,9 @@
try {
response.sendError(HttpServletResponse.SC_NOT_FOUND);
} catch (IllegalStateException e) {
- ;
+ // Ignore
} catch (IOException e) {
- ;
+ // Ignore
}
}
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardHost.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardHost.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardHost.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardHost.java Sat Dec 27 09:48:13 2008
@@ -134,12 +134,6 @@
/**
- * The live deploy flag for this Host.
- */
- private boolean liveDeploy = true;
-
-
- /**
* Unpack WARs property.
*/
private boolean unpackWARs = true;
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardPipeline.java Sat Dec 27 09:48:13 2008
@@ -375,7 +375,7 @@
try {
((Contained) oldBasic).setContainer(null);
} catch (Throwable t) {
- ;
+ // Ignore
}
}
}
@@ -474,7 +474,7 @@
*/
public Valve[] getValves() {
- ArrayList valveList = new ArrayList();
+ ArrayList<Valve> valveList = new ArrayList<Valve>();
Valve current = first;
if (current == null) {
current = basic;
@@ -484,13 +484,13 @@
current = current.getNext();
}
- return ((Valve[]) valveList.toArray(new Valve[0]));
+ return valveList.toArray(new Valve[0]);
}
public ObjectName[] getValveObjectNames() {
- ArrayList valveList = new ArrayList();
+ ArrayList<ObjectName> valveList = new ArrayList<ObjectName>();
Valve current = first;
if (current == null) {
current = basic;
@@ -502,7 +502,7 @@
current = current.getNext();
}
- return ((ObjectName[]) valveList.toArray(new ObjectName[0]));
+ return valveList.toArray(new ObjectName[0]);
}
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardServer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardServer.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardServer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardServer.java Sat Dec 27 09:48:13 2008
@@ -64,16 +64,6 @@
private static Log log = LogFactory.getLog(StandardServer.class);
- // -------------------------------------------------------------- Constants
-
-
- /**
- * ServerLifecycleListener classname.
- */
- private static String SERVER_LISTENER_CLASS_NAME =
- "org.apache.catalina.mbeans.ServerLifecycleListener";
-
-
// ------------------------------------------------------------ Constructor
@@ -358,7 +348,7 @@
try {
((Lifecycle) service).start();
} catch (LifecycleException e) {
- ;
+ // Ignore
}
}
@@ -451,7 +441,7 @@
try {
socket.close();
} catch (IOException e) {
- ;
+ // Ignore
}
// Match against our command string
@@ -468,7 +458,7 @@
try {
serverSocket.close();
} catch (IOException e) {
- ;
+ // Ignore
}
}
@@ -540,7 +530,7 @@
try {
((Lifecycle) services[j]).stop();
} catch (LifecycleException e) {
- ;
+ // Ignore
}
}
int k = 0;
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardService.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardService.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardService.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardService.java Sat Dec 27 09:48:13 2008
@@ -158,7 +158,7 @@
try {
((Lifecycle) this.container).start();
} catch (LifecycleException e) {
- ;
+ // Ignore
}
}
synchronized (connectors) {
@@ -170,7 +170,7 @@
try {
((Lifecycle) oldContainer).stop();
} catch (LifecycleException e) {
- ;
+ // Ignore
}
}
@@ -270,7 +270,7 @@
}
}
- if (started && (connector instanceof Lifecycle)) {
+ if (started) {
try {
((Lifecycle) connector).start();
} catch (LifecycleException e) {
@@ -334,7 +334,7 @@
}
if (j < 0)
return;
- if (started && (connectors[j] instanceof Lifecycle)) {
+ if (started) {
try {
((Lifecycle) connectors[j]).stop();
} catch (LifecycleException e) {
@@ -527,8 +527,7 @@
// Start our defined Connectors second
synchronized (connectors) {
for (int i = 0; i < connectors.length; i++) {
- if (connectors[i] instanceof Lifecycle)
- ((Lifecycle) connectors[i]).start();
+ ((Lifecycle) connectors[i]).start();
}
}
@@ -589,8 +588,7 @@
// Stop our defined Connectors first
synchronized (connectors) {
for (int i = 0; i < connectors.length; i++) {
- if (connectors[i] instanceof Lifecycle)
- ((Lifecycle) connectors[i]).stop();
+ ((Lifecycle) connectors[i]).stop();
}
}
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardThreadExecutor.java Sat Dec 27 09:48:13 2008
@@ -91,7 +91,7 @@
TaskThreadFactory tf = new TaskThreadFactory(namePrefix,daemon,getThreadPriority());
lifecycle.fireLifecycleEvent(START_EVENT, null);
executor = new ThreadPoolExecutor(getMinSpareThreads(), getMaxThreads(), maxIdleTime, TimeUnit.MILLISECONDS,taskqueue, tf);
- taskqueue.setParent( (ThreadPoolExecutor) executor);
+ taskqueue.setParent(executor);
lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
}
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Sat Dec 27 09:48:13 2008
@@ -160,14 +160,14 @@
/**
* Mappings associated with the wrapper.
*/
- protected ArrayList mappings = new ArrayList();
+ protected ArrayList<String> mappings = new ArrayList<String>();
/**
* The initialization parameters for this servlet, keyed by
* parameter name.
*/
- protected HashMap parameters = new HashMap();
+ protected HashMap<String, String> parameters = new HashMap<String, String>();
/**
@@ -175,7 +175,7 @@
* used in the servlet. The corresponding value is the role name of
* the web application itself.
*/
- protected HashMap references = new HashMap();
+ protected HashMap<String, String> references = new HashMap<String, String>();
/**
@@ -221,7 +221,7 @@
/**
* Stack containing the STM instances.
*/
- protected Stack instancePool = null;
+ protected Stack<Servlet> instancePool = null;
/**
@@ -256,14 +256,14 @@
* Static class array used when the SecurityManager is turned on and
* <code>Servlet.init</code> is invoked.
*/
- protected static Class[] classType = new Class[]{ServletConfig.class};
+ protected static Class<?>[] classType = new Class[]{ServletConfig.class};
/**
* Static class array used when the SecurityManager is turned on and
* <code>Servlet.service</code> is invoked.
*/
- protected static Class[] classTypeUsedInService = new Class[]{
+ protected static Class<?>[] classTypeUsedInService = new Class[]{
ServletRequest.class,
ServletResponse.class};
@@ -558,7 +558,7 @@
try {
loadServlet();
} catch (Throwable t) {
- ;
+ // Ignore
}
return (singleThreadModel);
@@ -593,13 +593,13 @@
*/
public String[] getServletMethods() throws ServletException {
- Class servletClazz = loadServlet().getClass();
+ Class<? extends Servlet> servletClazz = loadServlet().getClass();
if (!javax.servlet.http.HttpServlet.class.isAssignableFrom(
servletClazz)) {
return DEFAULT_SERVLET_METHODS;
}
- HashSet allow = new HashSet();
+ HashSet<String> allow = new HashSet<String>();
allow.add("TRACE");
allow.add("OPTIONS");
@@ -620,7 +620,7 @@
}
String[] methodNames = new String[allow.size()];
- return (String[]) allow.toArray(methodNames);
+ return allow.toArray(methodNames);
}
@@ -827,14 +827,14 @@
try {
instancePool.wait();
} catch (InterruptedException e) {
- ;
+ // Ignore
}
}
}
if (log.isTraceEnabled())
log.trace(" Returning allocated STM instance");
countAllocated.incrementAndGet();
- return (Servlet) instancePool.pop();
+ return instancePool.pop();
}
@@ -877,7 +877,7 @@
public String findInitParameter(String name) {
synchronized (parameters) {
- return ((String) parameters.get(name));
+ return parameters.get(name);
}
}
@@ -891,7 +891,7 @@
synchronized (parameters) {
String results[] = new String[parameters.size()];
- return ((String[]) parameters.keySet().toArray(results));
+ return parameters.keySet().toArray(results);
}
}
@@ -903,7 +903,7 @@
public String[] findMappings() {
synchronized (mappings) {
- return (String[]) mappings.toArray(new String[mappings.size()]);
+ return mappings.toArray(new String[mappings.size()]);
}
}
@@ -918,7 +918,7 @@
public String findSecurityReference(String name) {
synchronized (references) {
- return ((String) references.get(name));
+ return references.get(name);
}
}
@@ -932,7 +932,7 @@
synchronized (references) {
String results[] = new String[references.size()];
- return ((String[]) references.keySet().toArray(results));
+ return references.keySet().toArray(results);
}
}
@@ -1055,7 +1055,7 @@
if( Globals.IS_SECURITY_ENABLED) {
- Object[] args = new Object[]{((ServletConfig)facade)};
+ Object[] args = new Object[]{(facade)};
SecurityUtil.doAsPrivilege("init",
servlet,
classType,
@@ -1111,7 +1111,7 @@
singleThreadModel = servlet instanceof SingleThreadModel;
if (singleThreadModel) {
if (instancePool == null)
- instancePool = new Stack();
+ instancePool = new Stack<Servlet>();
}
fireContainerEvent("load", this);
@@ -1262,7 +1262,7 @@
try {
Thread.sleep(delay);
} catch (InterruptedException e) {
- ;
+ // Ignore
}
nRetries++;
}
@@ -1325,7 +1325,7 @@
if (singleThreadModel && (instancePool != null)) {
try {
while (!instancePool.isEmpty()) {
- Servlet s = (Servlet) instancePool.pop();
+ Servlet s = instancePool.pop();
if (Globals.IS_SECURITY_ENABLED) {
SecurityUtil.doAsPrivilege("destroy", s);
SecurityUtil.remove(instance);
@@ -1378,10 +1378,10 @@
* Return the set of initialization parameter names defined for this
* servlet. If none are defined, an empty Enumeration is returned.
*/
- public Enumeration getInitParameterNames() {
+ public Enumeration<String> getInitParameterNames() {
synchronized (parameters) {
- return (new Enumerator(parameters.keySet()));
+ return (new Enumerator<String>(parameters.keySet()));
}
}
@@ -1484,7 +1484,7 @@
*/
protected void addDefaultMapper(String mapperClass) {
- ; // No need for a default Mapper on a Wrapper
+ // No need for a default Mapper on a Wrapper
}
@@ -1502,7 +1502,7 @@
return (true);
}
try {
- Class clazz =
+ Class<?> clazz =
this.getClass().getClassLoader().loadClass(classname);
return (ContainerServlet.class.isAssignableFrom(clazz));
} catch (Throwable t) {
@@ -1512,7 +1512,7 @@
}
- protected Method[] getAllDeclaredMethods(Class c) {
+ protected Method[] getAllDeclaredMethods(Class<?> c) {
if (c.equals(javax.servlet.http.HttpServlet.class)) {
return null;
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java?rev=729650&r1=729649&r2=729650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java Sat Dec 27 09:48:13 2008
@@ -45,7 +45,7 @@
public StandardWrapperFacade(StandardWrapper config) {
super();
- this.config = (ServletConfig) config;
+ this.config = config;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org