From d36920bf87fe157393a1dba8ff8db66f06aa7969 Mon Sep 17 00:00:00 2001 From: markt Date: Fri, 25 Apr 2008 18:38:38 +0000 Subject: [PATCH] Fix compiler warnings for o.a.c.deploy.* Note using generics would have highlighted bug 43470 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@651680 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/catalina/deploy/ContextHandler.java | 10 +-- .../org/apache/catalina/deploy/ContextService.java | 10 +-- .../apache/catalina/deploy/ContextTransaction.java | 4 +- java/org/apache/catalina/deploy/FilterDef.java | 4 +- .../apache/catalina/deploy/NamingResources.java | 80 ++++++++++++---------- java/org/apache/catalina/deploy/ResourceBase.java | 4 +- 6 files changed, 60 insertions(+), 52 deletions(-) diff --git a/java/org/apache/catalina/deploy/ContextHandler.java b/java/org/apache/catalina/deploy/ContextHandler.java index 48ce513dc..297f87499 100644 --- a/java/org/apache/catalina/deploy/ContextHandler.java +++ b/java/org/apache/catalina/deploy/ContextHandler.java @@ -59,14 +59,14 @@ public class ContextHandler extends ResourceBase implements Serializable { * soapHeader[0] : namespaceURI * soapHeader[1] : localpart */ - private HashMap soapHeaders = new HashMap(); + private HashMap soapHeaders = new HashMap(); - public Iterator getLocalparts() { + public Iterator getLocalparts() { return soapHeaders.keySet().iterator(); } public String getNamespaceuri(String localpart) { - return (String) soapHeaders.get(localpart); + return soapHeaders.get(localpart); } public void addSoapHeaders(String localpart, String namespaceuri) { @@ -83,7 +83,7 @@ public class ContextHandler extends ResourceBase implements Serializable { /** * The soapRole. */ - private ArrayList soapRoles = new ArrayList(); + private ArrayList soapRoles = new ArrayList(); public String getSoapRole(int i) { return this.soapRoles.get(i); @@ -100,7 +100,7 @@ public class ContextHandler extends ResourceBase implements Serializable { /** * The portName. */ - private ArrayList portNames = new ArrayList(); + private ArrayList portNames = new ArrayList(); public String getPortName(int i) { return this.portNames.get(i); diff --git a/java/org/apache/catalina/deploy/ContextService.java b/java/org/apache/catalina/deploy/ContextService.java index 96576c8c4..b0849fc95 100644 --- a/java/org/apache/catalina/deploy/ContextService.java +++ b/java/org/apache/catalina/deploy/ContextService.java @@ -19,7 +19,6 @@ package org.apache.catalina.deploy; import java.io.Serializable; -import java.util.ArrayList; import java.util.Iterator; import java.util.HashMap; @@ -143,7 +142,7 @@ public class ContextService extends ResourceBase implements Serializable { * particular port-component. * */ - public Iterator getServiceendpoints() { + public Iterator getServiceendpoints() { return this.listProperties(); } @@ -162,14 +161,15 @@ public class ContextService extends ResourceBase implements Serializable { * * The instanciation of the handler have to be done. */ - private HashMap handlers = new HashMap(); + private HashMap handlers = + new HashMap(); - public Iterator getHandlers() { + public Iterator getHandlers() { return handlers.keySet().iterator(); } public ContextHandler getHandler(String handlername) { - return (ContextHandler) handlers.get(handlername); + return handlers.get(handlername); } public void addHandler(ContextHandler handler) { diff --git a/java/org/apache/catalina/deploy/ContextTransaction.java b/java/org/apache/catalina/deploy/ContextTransaction.java index abd3b95e5..96fb4f35d 100644 --- a/java/org/apache/catalina/deploy/ContextTransaction.java +++ b/java/org/apache/catalina/deploy/ContextTransaction.java @@ -40,7 +40,7 @@ public class ContextTransaction implements Serializable { /** * Holder for our configured properties. */ - private HashMap properties = new HashMap(); + private HashMap properties = new HashMap(); /** * Return a configured property. @@ -66,7 +66,7 @@ public class ContextTransaction implements Serializable { /** * List properties. */ - public Iterator listProperties() { + public Iterator listProperties() { return properties.keySet().iterator(); } diff --git a/java/org/apache/catalina/deploy/FilterDef.java b/java/org/apache/catalina/deploy/FilterDef.java index a1f4fd9a7..fa66c18ae 100644 --- a/java/org/apache/catalina/deploy/FilterDef.java +++ b/java/org/apache/catalina/deploy/FilterDef.java @@ -113,9 +113,9 @@ public class FilterDef implements Serializable { * The set of initialization parameters for this filter, keyed by * parameter name. */ - private Map parameters = new HashMap(); + private Map parameters = new HashMap(); - public Map getParameterMap() { + public Map getParameterMap() { return (this.parameters); diff --git a/java/org/apache/catalina/deploy/NamingResources.java b/java/org/apache/catalina/deploy/NamingResources.java index 468885a4d..dba9b83c4 100644 --- a/java/org/apache/catalina/deploy/NamingResources.java +++ b/java/org/apache/catalina/deploy/NamingResources.java @@ -62,58 +62,67 @@ public class NamingResources implements Serializable { * List of naming entries, keyed by name. The value is the entry type, as * declared by the user. */ - private Hashtable entries = new Hashtable(); + private Hashtable entries = + new Hashtable(); /** * The EJB resource references for this web application, keyed by name. */ - private HashMap ejbs = new HashMap(); + private HashMap ejbs = + new HashMap(); /** * The environment entries for this web application, keyed by name. */ - private HashMap envs = new HashMap(); + private HashMap envs = + new HashMap(); /** * The local EJB resource references for this web application, keyed by * name. */ - private HashMap localEjbs = new HashMap(); + private HashMap localEjbs = + new HashMap(); /** * The message destination referencess for this web application, * keyed by name. */ - private HashMap mdrs = new HashMap(); + private HashMap mdrs = + new HashMap(); /** * The resource environment references for this web application, * keyed by name. */ - private HashMap resourceEnvRefs = new HashMap(); + private HashMap resourceEnvRefs = + new HashMap(); /** * The resource references for this web application, keyed by name. */ - private HashMap resources = new HashMap(); + private HashMap resources = + new HashMap(); /** * The resource links for this web application, keyed by name. */ - private HashMap resourceLinks = new HashMap(); + private HashMap resourceLinks = + new HashMap(); /** * The web service references for this web application, keyed by name. */ - private HashMap services = new HashMap(); + private HashMap services = + new HashMap(); /** @@ -339,7 +348,7 @@ public class NamingResources implements Serializable { if (entries.containsKey(resourceLink.getName())) { return; } else { - Object value = resourceLink.getType(); + String value = resourceLink.getType(); if (value == null) { value = ""; } @@ -365,7 +374,7 @@ public class NamingResources implements Serializable { if (entries.containsKey(service.getName())) { return; } else { - Object value = service.getType(); + String value = service.getType(); if (value == null) { value = ""; } @@ -390,7 +399,7 @@ public class NamingResources implements Serializable { public ContextEjb findEjb(String name) { synchronized (ejbs) { - return ((ContextEjb) ejbs.get(name)); + return ejbs.get(name); } } @@ -404,7 +413,7 @@ public class NamingResources implements Serializable { synchronized (ejbs) { ContextEjb results[] = new ContextEjb[ejbs.size()]; - return ((ContextEjb[]) ejbs.values().toArray(results)); + return ejbs.values().toArray(results); } } @@ -419,7 +428,7 @@ public class NamingResources implements Serializable { public ContextEnvironment findEnvironment(String name) { synchronized (envs) { - return ((ContextEnvironment) envs.get(name)); + return envs.get(name); } } @@ -434,7 +443,7 @@ public class NamingResources implements Serializable { synchronized (envs) { ContextEnvironment results[] = new ContextEnvironment[envs.size()]; - return ((ContextEnvironment[]) envs.values().toArray(results)); + return envs.values().toArray(results); } } @@ -449,7 +458,7 @@ public class NamingResources implements Serializable { public ContextLocalEjb findLocalEjb(String name) { synchronized (localEjbs) { - return ((ContextLocalEjb) localEjbs.get(name)); + return localEjbs.get(name); } } @@ -463,7 +472,7 @@ public class NamingResources implements Serializable { synchronized (localEjbs) { ContextLocalEjb results[] = new ContextLocalEjb[localEjbs.size()]; - return ((ContextLocalEjb[]) localEjbs.values().toArray(results)); + return localEjbs.values().toArray(results); } } @@ -478,7 +487,7 @@ public class NamingResources implements Serializable { public MessageDestinationRef findMessageDestinationRef(String name) { synchronized (mdrs) { - return ((MessageDestinationRef) mdrs.get(name)); + return mdrs.get(name); } } @@ -493,7 +502,7 @@ public class NamingResources implements Serializable { synchronized (mdrs) { MessageDestinationRef results[] = new MessageDestinationRef[mdrs.size()]; - return ((MessageDestinationRef[]) mdrs.values().toArray(results)); + return mdrs.values().toArray(results); } } @@ -508,7 +517,7 @@ public class NamingResources implements Serializable { public ContextResource findResource(String name) { synchronized (resources) { - return ((ContextResource) resources.get(name)); + return resources.get(name); } } @@ -523,7 +532,7 @@ public class NamingResources implements Serializable { public ContextResourceLink findResourceLink(String name) { synchronized (resourceLinks) { - return ((ContextResourceLink) resourceLinks.get(name)); + return resourceLinks.get(name); } } @@ -538,8 +547,7 @@ public class NamingResources implements Serializable { synchronized (resourceLinks) { ContextResourceLink results[] = new ContextResourceLink[resourceLinks.size()]; - return ((ContextResourceLink[]) resourceLinks.values() - .toArray(results)); + return resourceLinks.values().toArray(results); } } @@ -553,7 +561,7 @@ public class NamingResources implements Serializable { synchronized (resources) { ContextResource results[] = new ContextResource[resources.size()]; - return ((ContextResource[]) resources.values().toArray(results)); + return resources.values().toArray(results); } } @@ -568,7 +576,7 @@ public class NamingResources implements Serializable { public ContextResourceEnvRef findResourceEnvRef(String name) { synchronized (resourceEnvRefs) { - return ((ContextResourceEnvRef) resourceEnvRefs.get(name)); + return resourceEnvRefs.get(name); } } @@ -583,7 +591,7 @@ public class NamingResources implements Serializable { synchronized (resourceEnvRefs) { ContextResourceEnvRef results[] = new ContextResourceEnvRef[resourceEnvRefs.size()]; - return ((ContextResourceEnvRef[]) resourceEnvRefs.values().toArray(results)); + return resourceEnvRefs.values().toArray(results); } } @@ -598,7 +606,7 @@ public class NamingResources implements Serializable { public ContextService findService(String name) { synchronized (services) { - return ((ContextService) services.get(name)); + return services.get(name); } } @@ -612,7 +620,7 @@ public class NamingResources implements Serializable { synchronized (services) { ContextService results[] = new ContextService[services.size()]; - return ((ContextService[]) services.values().toArray(results)); + return services.values().toArray(results); } } @@ -639,7 +647,7 @@ public class NamingResources implements Serializable { ContextEjb ejb = null; synchronized (ejbs) { - ejb = (ContextEjb) ejbs.remove(name); + ejb = ejbs.remove(name); } if (ejb != null) { support.firePropertyChange("ejb", ejb, null); @@ -660,7 +668,7 @@ public class NamingResources implements Serializable { ContextEnvironment environment = null; synchronized (envs) { - environment = (ContextEnvironment) envs.remove(name); + environment = envs.remove(name); } if (environment != null) { support.firePropertyChange("environment", environment, null); @@ -681,7 +689,7 @@ public class NamingResources implements Serializable { ContextLocalEjb localEjb = null; synchronized (localEjbs) { - localEjb = (ContextLocalEjb) localEjbs.remove(name); + localEjb = localEjbs.remove(name); } if (localEjb != null) { support.firePropertyChange("localEjb", localEjb, null); @@ -702,7 +710,7 @@ public class NamingResources implements Serializable { MessageDestinationRef mdr = null; synchronized (mdrs) { - mdr = (MessageDestinationRef) mdrs.remove(name); + mdr = mdrs.remove(name); } if (mdr != null) { support.firePropertyChange("messageDestinationRef", @@ -736,7 +744,7 @@ public class NamingResources implements Serializable { ContextResource resource = null; synchronized (resources) { - resource = (ContextResource) resources.remove(name); + resource = resources.remove(name); } if (resource != null) { support.firePropertyChange("resource", resource, null); @@ -758,7 +766,7 @@ public class NamingResources implements Serializable { ContextResourceEnvRef resourceEnvRef = null; synchronized (resourceEnvRefs) { resourceEnvRef = - (ContextResourceEnvRef) resourceEnvRefs.remove(name); + resourceEnvRefs.remove(name); } if (resourceEnvRef != null) { support.firePropertyChange("resourceEnvRef", resourceEnvRef, null); @@ -779,7 +787,7 @@ public class NamingResources implements Serializable { ContextResourceLink resourceLink = null; synchronized (resourceLinks) { - resourceLink = (ContextResourceLink) resourceLinks.remove(name); + resourceLink = resourceLinks.remove(name); } if (resourceLink != null) { support.firePropertyChange("resourceLink", resourceLink, null); @@ -800,7 +808,7 @@ public class NamingResources implements Serializable { ContextService service = null; synchronized (services) { - service = (ContextService) services.remove(name); + service = services.remove(name); } if (service != null) { support.firePropertyChange("service", service, null); diff --git a/java/org/apache/catalina/deploy/ResourceBase.java b/java/org/apache/catalina/deploy/ResourceBase.java index 0579789f9..79541bf00 100644 --- a/java/org/apache/catalina/deploy/ResourceBase.java +++ b/java/org/apache/catalina/deploy/ResourceBase.java @@ -84,7 +84,7 @@ public class ResourceBase implements Serializable, Injectable { /** * Holder for our configured properties. */ - private HashMap properties = new HashMap(); + private HashMap properties = new HashMap(); /** * Return a configured property. @@ -110,7 +110,7 @@ public class ResourceBase implements Serializable, Injectable { /** * List properties. */ - public Iterator listProperties() { + public Iterator listProperties() { return properties.keySet().iterator(); } -- 2.11.0