Author: markt Date: Tue Nov 18 15:29:05 2008 New Revision: 718766 URL: http://svn.apache.org/viewvc?rev=718766&view=rev Log: Remaining generics changes in o.a.tomcat.util No nasty surprises. Should be no functional impact.
Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java tomcat/trunk/java/org/apache/tomcat/util/digester/ArrayStack.java tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java tomcat/trunk/java/org/apache/tomcat/util/digester/CallParamRule.java tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java tomcat/trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java tomcat/trunk/java/org/apache/tomcat/util/digester/ParserFeatureSetterFactory.java tomcat/trunk/java/org/apache/tomcat/util/digester/Rules.java tomcat/trunk/java/org/apache/tomcat/util/digester/RulesBase.java tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java tomcat/trunk/java/org/apache/tomcat/util/digester/XercesParser.java tomcat/trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java tomcat/trunk/java/org/apache/tomcat/util/http/BaseRequest.java tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java tomcat/trunk/java/org/apache/tomcat/util/http/MimeMap.java tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java tomcat/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/AbstractRulesImpl.java Tue Nov 18 15:29:05 2008 @@ -136,7 +136,7 @@ * * @deprecated Call match(namespaceURI,pattern) instead. */ - public List match(String pattern) { + public List<Rule> match(String pattern) { return match(namespaceURI, pattern); } @@ -152,7 +152,7 @@ * or <code>null</code> to match regardless of namespace URI * @param pattern Nesting pattern to be matched */ - abstract public List match(String namespaceURI, String pattern); + abstract public List<Rule> match(String namespaceURI, String pattern); /** @@ -162,6 +162,6 @@ * in the order originally registered through the <code>add()</code> * method. */ - abstract public List rules(); + abstract public List<Rule> rules(); } Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/ArrayStack.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/ArrayStack.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/ArrayStack.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/ArrayStack.java Tue Nov 18 15:29:05 2008 @@ -42,7 +42,7 @@ * @see java.util.Stack * @since Digester 1.6 (from Commons Collections 1.0) */ -public class ArrayStack extends ArrayList { +public class ArrayStack<E> extends ArrayList<E> { /** Ensure serialization compatibility */ private static final long serialVersionUID = 2130079159931574599L; @@ -84,7 +84,7 @@ * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ - public Object peek() throws EmptyStackException { + public E peek() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); @@ -102,7 +102,7 @@ * @throws EmptyStackException if there are not enough items on the * stack to satisfy this request */ - public Object peek(int n) throws EmptyStackException { + public E peek(int n) throws EmptyStackException { int m = (size() - n) - 1; if (m < 0) { throw new EmptyStackException(); @@ -117,7 +117,7 @@ * @return the top item on the stack * @throws EmptyStackException if the stack is empty */ - public Object pop() throws EmptyStackException { + public E pop() throws EmptyStackException { int n = size(); if (n <= 0) { throw new EmptyStackException(); @@ -133,7 +133,7 @@ * @param item the item to be added * @return the item just pushed */ - public Object push(Object item) { + public E push(E item) { add(item); return item; } @@ -150,7 +150,7 @@ * @param object the object to be searched for * @return the 1-based depth into the stack of the object, or -1 if not found */ - public int search(Object object) { + public int search(E object) { int i = size() - 1; // Current index int n = 1; // Current distance while (i >= 0) { Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java Tue Nov 18 15:29:05 2008 @@ -131,7 +131,7 @@ * Use [EMAIL PROTECTED] #CallMethodRule(String methodName,int paramCount, Class [] paramTypes)} instead. */ public CallMethodRule(Digester digester, String methodName, - int paramCount, Class paramTypes[]) { + int paramCount, Class<?> paramTypes[]) { this(methodName, paramCount, paramTypes); } @@ -295,7 +295,7 @@ public CallMethodRule( String methodName, int paramCount, - Class paramTypes[]) { + Class<?> paramTypes[]) { this(0, methodName, paramCount, paramTypes); } @@ -322,7 +322,7 @@ public CallMethodRule( int targetOffset, String methodName, int paramCount, - Class paramTypes[]) { + Class<?> paramTypes[]) { this.targetOffset = targetOffset; this.methodName = methodName; @@ -375,7 +375,7 @@ /** * The parameter types of the parameters to be collected. */ - protected Class paramTypes[] = null; + protected Class<?> paramTypes[] = null; /** * The names of the classes of the parameters to be collected. Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/CallParamRule.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/CallParamRule.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/CallParamRule.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/CallParamRule.java Tue Nov 18 15:29:05 2008 @@ -167,7 +167,7 @@ * Stack is used to allow nested body text to be processed. * Lazy creation. */ - protected ArrayStack bodyTextStack; + protected ArrayStack<String> bodyTextStack; // --------------------------------------------------------- Public Methods @@ -224,7 +224,7 @@ // so that we can make sure that the right set of parameters // is at the top of the stack if (bodyTextStack == null) { - bodyTextStack = new ArrayStack(); + bodyTextStack = new ArrayStack<String>(); } bodyTextStack.push(bodyText.trim()); } Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java Tue Nov 18 15:29:05 2008 @@ -149,7 +149,8 @@ /** * The stack of body text string buffers for surrounding elements. */ - protected ArrayStack bodyTexts = new ArrayStack(); + protected ArrayStack<StringBuffer> bodyTexts = + new ArrayStack<StringBuffer>(); /** @@ -162,7 +163,7 @@ * * @since 1.6 */ - protected ArrayStack matches = new ArrayStack(10); + protected ArrayStack<List<Rule>> matches = new ArrayStack<List<Rule>>(10); /** * The class loader to use for instantiating application objects. @@ -188,7 +189,8 @@ * The URLs of entityValidator that have been registered, keyed by the public * identifier that corresponds. */ - protected HashMap entityValidator = new HashMap(); + protected HashMap<String,String> entityValidator = + new HashMap<String,String>(); /** @@ -236,14 +238,15 @@ * is required because documents can declare nested uses of the same * prefix for different Namespace URIs). */ - protected HashMap namespaces = new HashMap(); + protected HashMap<String,ArrayStack<String>> namespaces = + new HashMap<String,ArrayStack<String>>(); /** * The parameters stack being utilized by CallMethodRule and * CallParamRule rules. */ - protected ArrayStack params = new ArrayStack(); + protected ArrayStack<Object> params = new ArrayStack<Object>(); /** @@ -296,7 +299,7 @@ /** * The object stack being constructed. */ - protected ArrayStack stack = new ArrayStack(); + protected ArrayStack<Object> stack = new ArrayStack<Object>(); /** @@ -322,7 +325,7 @@ /** * Fake attributes map (attributes are often used for object creation). */ - protected Map<Class, List<String>> fakeAttributes = null; + protected Map<Class<?>, List<String>> fakeAttributes = null; /** @@ -346,7 +349,8 @@ "http://www.w3.org/2001/XMLSchema"; /** Stacks used for interrule communication, indexed by name String */ - private HashMap stacksByName = new HashMap(); + private HashMap<String,ArrayStack<Object>> stacksByName = + new HashMap<String,ArrayStack<Object>>(); // ------------------------------------------------------------- Properties @@ -359,12 +363,12 @@ */ public String findNamespaceURI(String prefix) { - ArrayStack stack = (ArrayStack) namespaces.get(prefix); + ArrayStack<String> stack = namespaces.get(prefix); if (stack == null) { return (null); } try { - return ((String) stack.peek()); + return stack.peek(); } catch (EmptyStackException e) { return (null); } @@ -927,7 +931,7 @@ /** * Return the fake attributes list. */ - public Map<Class, List<String>> getFakeAttributes() { + public Map<Class<?>, List<String>> getFakeAttributes() { return (this.fakeAttributes); @@ -960,7 +964,7 @@ * * @param fakeAttributes The new fake attributes. */ - public void setFakeAttributes(Map<Class, List<String>> fakeAttributes) { + public void setFakeAttributes(Map<Class<?>, List<String>> fakeAttributes) { this.fakeAttributes = fakeAttributes; @@ -1038,9 +1042,9 @@ } // Fire "finish" events for all defined rules - Iterator rules = getRules().rules().iterator(); + Iterator<Rule> rules = getRules().rules().iterator(); while (rules.hasNext()) { - Rule rule = (Rule) rules.next(); + Rule rule = rules.next(); try { rule.finish(); } catch (Exception e) { @@ -1095,12 +1099,12 @@ } // Fire "body" events for all relevant rules - List rules = (List) matches.pop(); + List<Rule> rules = matches.pop(); if ((rules != null) && (rules.size() > 0)) { String bodyText = this.bodyText.toString(); for (int i = 0; i < rules.size(); i++) { try { - Rule rule = (Rule) rules.get(i); + Rule rule = rules.get(i); if (debug) { log.debug(" Fire body() for " + rule); } @@ -1123,7 +1127,7 @@ } // Recover the body text from the surrounding element - bodyText = (StringBuffer) bodyTexts.pop(); + bodyText = bodyTexts.pop(); if (debug) { log.debug(" Popping body text '" + bodyText.toString() + "'"); } @@ -1133,7 +1137,7 @@ for (int i = 0; i < rules.size(); i++) { int j = (rules.size() - i) - 1; try { - Rule rule = (Rule) rules.get(j); + Rule rule = rules.get(j); if (debug) { log.debug(" Fire end() for " + rule); } @@ -1173,7 +1177,7 @@ } // Deregister this prefix mapping - ArrayStack stack = (ArrayStack) namespaces.get(prefix); + ArrayStack<String> stack = namespaces.get(prefix); if (stack == null) { return; } @@ -1346,12 +1350,12 @@ } // Fire "begin" events for all relevant rules - List rules = getRules().match(namespaceURI, match); + List<Rule> rules = getRules().match(namespaceURI, match); matches.push(rules); if ((rules != null) && (rules.size() > 0)) { for (int i = 0; i < rules.size(); i++) { try { - Rule rule = (Rule) rules.get(i); + Rule rule = rules.get(i); if (debug) { log.debug(" Fire begin() for " + rule); } @@ -1389,9 +1393,9 @@ } // Register this prefix mapping - ArrayStack stack = (ArrayStack) namespaces.get(prefix); + ArrayStack<String> stack = namespaces.get(prefix); if (stack == null) { - stack = new ArrayStack(); + stack = new ArrayStack<String>(); namespaces.put(prefix, stack); } stack.push(namespaceURI); @@ -1481,12 +1485,12 @@ // Has this system identifier been registered? String entityURL = null; if (publicId != null) { - entityURL = (String) entityValidator.get(publicId); + entityURL = entityValidator.get(publicId); } // Redirect the schema location to a local destination if (schemaLocation != null && entityURL == null && systemId != null){ - entityURL = (String)entityValidator.get(systemId); + entityURL = entityValidator.get(systemId); } if (entityURL == null) { @@ -1857,7 +1861,7 @@ * @see CallMethodRule */ public void addCallMethod(String pattern, String methodName, - int paramCount, Class paramTypes[]) { + int paramCount, Class<?> paramTypes[]) { addRule(pattern, new CallMethodRule( @@ -1999,7 +2003,7 @@ * @param clazz Java class of the object creation factory class * @see FactoryCreateRule */ - public void addFactoryCreate(String pattern, Class clazz) { + public void addFactoryCreate(String pattern, Class<?> clazz) { addFactoryCreate(pattern, clazz, false); @@ -2034,7 +2038,7 @@ * value specified by <code>className</code> * @see FactoryCreateRule */ - public void addFactoryCreate(String pattern, Class clazz, + public void addFactoryCreate(String pattern, Class<?> clazz, String attributeName) { addFactoryCreate(pattern, clazz, attributeName, false); @@ -2090,7 +2094,7 @@ */ public void addFactoryCreate( String pattern, - Class clazz, + Class<?> clazz, boolean ignoreCreateExceptions) { addRule( @@ -2137,7 +2141,7 @@ */ public void addFactoryCreate( String pattern, - Class clazz, + Class<?> clazz, String attributeName, boolean ignoreCreateExceptions) { @@ -2190,7 +2194,7 @@ * @param clazz Java class to be created * @see ObjectCreateRule */ - public void addObjectCreate(String pattern, Class clazz) { + public void addObjectCreate(String pattern, Class<?> clazz) { addRule(pattern, new ObjectCreateRule(clazz)); @@ -2227,7 +2231,7 @@ */ public void addObjectCreate(String pattern, String attributeName, - Class clazz) { + Class<?> clazz) { addRule(pattern, new ObjectCreateRule(attributeName, clazz)); @@ -2511,9 +2515,9 @@ * @since 1.6 */ public void push(String stackName, Object value) { - ArrayStack namedStack = (ArrayStack) stacksByName.get(stackName); + ArrayStack<Object> namedStack = stacksByName.get(stackName); if (namedStack == null) { - namedStack = new ArrayStack(); + namedStack = new ArrayStack<Object>(); stacksByName.put(stackName, namedStack); } namedStack.push(value); @@ -2534,7 +2538,7 @@ */ public Object pop(String stackName) { Object result = null; - ArrayStack namedStack = (ArrayStack) stacksByName.get(stackName); + ArrayStack<Object> namedStack = stacksByName.get(stackName); if (namedStack == null) { if (log.isDebugEnabled()) { log.debug("Stack '" + stackName + "' is empty"); @@ -2564,7 +2568,7 @@ */ public Object peek(String stackName) { Object result = null; - ArrayStack namedStack = (ArrayStack) stacksByName.get(stackName); + ArrayStack<Object> namedStack = stacksByName.get(stackName); if (namedStack == null ) { if (log.isDebugEnabled()) { log.debug("Stack '" + stackName + "' is empty"); @@ -2590,7 +2594,7 @@ */ public boolean isEmpty(String stackName) { boolean result = true; - ArrayStack namedStack = (ArrayStack) stacksByName.get(stackName); + ArrayStack<Object> namedStack = stacksByName.get(stackName); if (namedStack != null ) { result = namedStack.isEmpty(); } @@ -2680,7 +2684,7 @@ /** * Return the set of DTD URL registrations, keyed by public identifier. */ - Map getRegistrations() { + Map<String,String> getRegistrations() { return (entityValidator); @@ -2700,7 +2704,7 @@ * @deprecated Call <code>match()</code> on the <code>Rules</code> * implementation returned by <code>getRules()</code> */ - List getRules(String match) { + List<Rule> getRules(String match) { return (getRules().match(match)); Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java Tue Nov 18 15:29:05 2008 @@ -40,7 +40,7 @@ /** Should exceptions thrown by the factory be ignored? */ private boolean ignoreCreateExceptions; /** Stock to manage */ - private ArrayStack exceptionIgnoredStack; + private ArrayStack<Boolean> exceptionIgnoredStack; // ----------------------------------------------------------- Constructors @@ -74,7 +74,7 @@ * @deprecated The digester instance is now set in the [EMAIL PROTECTED] Digester#addRule} method. * Use [EMAIL PROTECTED] #FactoryCreateRule(Class clazz)} instead. */ - public FactoryCreateRule(Digester digester, Class clazz) { + public FactoryCreateRule(Digester digester, Class<?> clazz) { this(clazz); @@ -118,7 +118,7 @@ * Use [EMAIL PROTECTED] #FactoryCreateRule(Class clazz, String attributeName)} instead. */ public FactoryCreateRule(Digester digester, - Class clazz, String attributeName) { + Class<?> clazz, String attributeName) { this(clazz, attributeName); @@ -167,7 +167,7 @@ * * @param clazz Java class name of the object creation factory class */ - public FactoryCreateRule(Class clazz) { + public FactoryCreateRule(Class<?> clazz) { this(clazz, false); @@ -205,7 +205,7 @@ * @param attributeName Attribute name which, if present, contains an * override of the class name of the object creation factory to create. */ - public FactoryCreateRule(Class clazz, String attributeName) { + public FactoryCreateRule(Class<?> clazz, String attributeName) { this(clazz, attributeName, false); @@ -253,7 +253,7 @@ * object creation factory * will be ignored. */ - public FactoryCreateRule(Class clazz, boolean ignoreCreateExceptions) { + public FactoryCreateRule(Class<?> clazz, boolean ignoreCreateExceptions) { this(clazz, null, ignoreCreateExceptions); @@ -297,7 +297,7 @@ * creation factory will be ignored. */ public FactoryCreateRule( - Class clazz, + Class<?> clazz, String attributeName, boolean ignoreCreateExceptions) { @@ -359,7 +359,7 @@ if (ignoreCreateExceptions) { if (exceptionIgnoredStack == null) { - exceptionIgnoredStack = new ArrayStack(); + exceptionIgnoredStack = new ArrayStack<Boolean>(); } try { @@ -408,7 +408,7 @@ exceptionIgnoredStack != null && !(exceptionIgnoredStack.empty())) { - if (((Boolean) exceptionIgnoredStack.pop()).booleanValue()) { + if ((exceptionIgnoredStack.pop()).booleanValue()) { // creation exception was ignored // nothing was put onto the stack if (digester.log.isTraceEnabled()) { @@ -485,7 +485,7 @@ digester.log.debug("[FactoryCreateRule]{" + digester.match + "} New factory " + realClassName); } - Class clazz = digester.getClassLoader().loadClass(realClassName); + Class<?> clazz = digester.getClassLoader().loadClass(realClassName); creationFactory = (ObjectCreationFactory) clazz.newInstance(); creationFactory.setDigester(digester); Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/ObjectCreateRule.java Tue Nov 18 15:29:05 2008 @@ -60,7 +60,7 @@ * @deprecated The digester instance is now set in the [EMAIL PROTECTED] Digester#addRule} method. * Use [EMAIL PROTECTED] #ObjectCreateRule(Class clazz)} instead. */ - public ObjectCreateRule(Digester digester, Class clazz) { + public ObjectCreateRule(Digester digester, Class<?> clazz) { this(clazz); @@ -101,7 +101,7 @@ */ public ObjectCreateRule(Digester digester, String attributeName, - Class clazz) { + Class<?> clazz) { this(attributeName, clazz); @@ -124,7 +124,7 @@ * * @param clazz Java class name of the object to be created */ - public ObjectCreateRule(Class clazz) { + public ObjectCreateRule(Class<?> clazz) { this(clazz.getName(), (String) null); @@ -157,7 +157,7 @@ * override of the class name to create */ public ObjectCreateRule(String attributeName, - Class clazz) { + Class<?> clazz) { this(clazz.getName(), attributeName); @@ -202,7 +202,7 @@ } // Instantiate the new object and push it on the context stack - Class clazz = digester.getClassLoader().loadClass(realClassName); + Class<?> clazz = digester.getClassLoader().loadClass(realClassName); Object instance = clazz.newInstance(); digester.push(instance); Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/ParserFeatureSetterFactory.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/ParserFeatureSetterFactory.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/ParserFeatureSetterFactory.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/ParserFeatureSetterFactory.java Tue Nov 18 15:29:05 2008 @@ -45,8 +45,7 @@ static { try{ // Use reflection to avoid a build dependency with Xerces. - Class versionClass = - Class.forName("org.apache.xerces.impl.Version"); + Class.forName("org.apache.xerces.impl.Version"); isXercesUsed = true; } catch (Exception ex){ isXercesUsed = false; Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/Rules.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/Rules.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/Rules.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/Rules.java Tue Nov 18 15:29:05 2008 @@ -98,7 +98,7 @@ * * @deprecated Call match(namespaceURI,pattern) instead. */ - public List match(String pattern); + public List<Rule> match(String pattern); /** @@ -112,7 +112,7 @@ * or <code>null</code> to match regardless of namespace URI * @param pattern Nesting pattern to be matched */ - public List match(String namespaceURI, String pattern); + public List<Rule> match(String namespaceURI, String pattern); /** @@ -122,7 +122,7 @@ * in the order originally registered through the <code>add()</code> * method. */ - public List rules(); + public List<Rule> rules(); } Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/RulesBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/RulesBase.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/RulesBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/RulesBase.java Tue Nov 18 15:29:05 2008 @@ -54,7 +54,8 @@ * Each value is a List containing the Rules for that pattern, in the * order that they were orginally registered. */ - protected HashMap cache = new HashMap(); + protected HashMap<String,List<Rule>> cache = + new HashMap<String,List<Rule>>(); /** @@ -75,7 +76,7 @@ * The set of registered Rule instances, in the order that they were * originally registered. */ - protected ArrayList rules = new ArrayList(); + protected ArrayList<Rule> rules = new ArrayList<Rule>(); // ------------------------------------------------------------- Properties @@ -100,9 +101,9 @@ public void setDigester(Digester digester) { this.digester = digester; - Iterator items = rules.iterator(); + Iterator<Rule> items = rules.iterator(); while (items.hasNext()) { - Rule item = (Rule) items.next(); + Rule item = items.next(); item.setDigester(digester); } @@ -152,9 +153,9 @@ } - List list = (List) cache.get(pattern); + List<Rule> list = cache.get(pattern); if (list == null) { - list = new ArrayList(); + list = new ArrayList<Rule>(); cache.put(pattern, list); } list.add(rule); @@ -191,7 +192,7 @@ * * @deprecated Call match(namespaceURI,pattern) instead. */ - public List match(String pattern) { + public List<Rule> match(String pattern) { return (match(null, pattern)); @@ -209,16 +210,16 @@ * or <code>null</code> to match regardless of namespace URI * @param pattern Nesting pattern to be matched */ - public List match(String namespaceURI, String pattern) { + public List<Rule> match(String namespaceURI, String pattern) { // List rulesList = (List) this.cache.get(pattern); - List rulesList = lookup(namespaceURI, pattern); + List<Rule> rulesList = lookup(namespaceURI, pattern); if ((rulesList == null) || (rulesList.size() < 1)) { // Find the longest key, ie more discriminant String longKey = ""; - Iterator keys = this.cache.keySet().iterator(); + Iterator<String> keys = this.cache.keySet().iterator(); while (keys.hasNext()) { - String key = (String) keys.next(); + String key = keys.next(); if (key.startsWith("*/")) { if (pattern.equals(key.substring(2)) || pattern.endsWith(key.substring(1))) { @@ -232,7 +233,7 @@ } } if (rulesList == null) { - rulesList = new ArrayList(); + rulesList = new ArrayList<Rule>(); } return (rulesList); @@ -246,7 +247,7 @@ * in the order originally registered through the <code>add()</code> * method. */ - public List rules() { + public List<Rule> rules() { return (this.rules); @@ -265,10 +266,10 @@ * select matching rules regardless of namespace URI * @param pattern Pattern to be matched */ - protected List lookup(String namespaceURI, String pattern) { + protected List<Rule> lookup(String namespaceURI, String pattern) { // Optimize when no namespace URI is specified - List list = (List) this.cache.get(pattern); + List<Rule> list = this.cache.get(pattern); if (list == null) { return (null); } @@ -277,10 +278,10 @@ } // Select only Rules that match on the specified namespace URI - ArrayList results = new ArrayList(); - Iterator items = list.iterator(); + ArrayList<Rule> results = new ArrayList<Rule>(); + Iterator<Rule> items = list.iterator(); while (items.hasNext()) { - Rule item = (Rule) items.next(); + Rule item = items.next(); if ((namespaceURI.equals(item.getNamespaceURI())) || (item.getNamespaceURI() == null)) { results.add(item); Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java Tue Nov 18 15:29:05 2008 @@ -54,9 +54,9 @@ /** The Rules implementation that this class wraps. */ private Rules wrappedRules; /** Rules to be fired when the wrapped implementations returns none. */ - private List defaultRules = new ArrayList(); + private List<Rule> defaultRules = new ArrayList<Rule>(); /** All rules (preserves order in which they were originally added) */ - private List allRules = new ArrayList(); + private List<Rule> allRules = new ArrayList<Rule>(); // --------------------------------------------------------- Constructor @@ -83,9 +83,9 @@ /** Sets digeseter using these Rules */ public void setDigester(Digester digester) { wrappedRules.setDigester(digester); - Iterator it = defaultRules.iterator(); + Iterator<Rule> it = defaultRules.iterator(); while (it.hasNext()) { - Rule rule = (Rule) it.next(); + Rule rule = it.next(); rule.setDigester(digester); } } @@ -101,13 +101,13 @@ } /** Gets Rule's which will be fired when the wrapped implementation returns no matches */ - public List getDefaults() { + public List<Rule> getDefaults() { return defaultRules; } // --------------------------------------------------------- Public Methods - public List match(String pattern) { + public List<Rule> match(String pattern) { return match("", pattern); } @@ -116,11 +116,11 @@ * If wrapped implementation returns any matches return those. * Otherwise, return default matches. */ - public List match(String namespaceURI, String pattern) { - List matches = wrappedRules.match(namespaceURI, pattern); + public List<Rule> match(String namespaceURI, String pattern) { + List<Rule> matches = wrappedRules.match(namespaceURI, pattern); if (matches == null || matches.isEmpty()) { // a little bit of defensive programming - return new ArrayList(defaultRules); + return new ArrayList<Rule>(defaultRules); } // otherwise return matches; @@ -142,7 +142,7 @@ } /** Gets all rules */ - public List rules() { + public List<Rule> rules() { return allRules; } Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/XercesParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/XercesParser.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/digester/XercesParser.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/digester/XercesParser.java Tue Nov 18 15:29:05 2008 @@ -99,7 +99,7 @@ String versionNumber = "1.0"; try{ // Use reflection to avoid a build dependency with Xerces. - Class versionClass = + Class<?> versionClass = Class.forName("org.apache.xerces.impl.Version"); // Will return Xerces-J 2.x.0 Method method = Modified: tomcat/trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/AcceptLanguage.java Tue Nov 18 15:29:05 2008 @@ -50,10 +50,10 @@ Vector<Locale> l = new Vector<Locale>(); extractLocales( languages,quality, l); - return (Locale)l.elementAt(0); + return l.elementAt(0); } - public static Enumeration getLocales(String acceptLanguage) { + public static Enumeration<Locale> getLocales(String acceptLanguage) { // Short circuit with an empty enumeration if null header if (acceptLanguage == null) { Vector<Locale> v = new Vector<Locale>(); @@ -125,17 +125,16 @@ } } - private static void extractLocales(Hashtable languages, Vector q, - Vector<Locale> l) - { + private static void extractLocales( + Hashtable<String,Vector<String>> languages, Vector<Double> q, + Vector<Locale> l) { // XXX We will need to order by q value Vector in the Future ? - Enumeration e = q.elements(); + Enumeration<Double> e = q.elements(); while (e.hasMoreElements()) { - Vector v = - (Vector)languages.get(((Double)e.nextElement()).toString()); - Enumeration le = v.elements(); + Vector<String> v = languages.get((e.nextElement()).toString()); + Enumeration<String> le = v.elements(); while (le.hasMoreElements()) { - String language = (String)le.nextElement(); + String language = le.nextElement(); String country = ""; int countryIndex = language.indexOf("-"); if (countryIndex > -1) { Modified: tomcat/trunk/java/org/apache/tomcat/util/http/BaseRequest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/BaseRequest.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/BaseRequest.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/BaseRequest.java Tue Nov 18 15:29:05 2008 @@ -285,7 +285,7 @@ * Get iterator over attribute names * @return iterator over attribute names */ - public Iterator getAttributeNames() { + public Iterator<String> getAttributeNames() { return attributes.keySet().iterator(); } Modified: tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/MimeHeaders.java Tue Nov 18 15:29:05 2008 @@ -139,9 +139,9 @@ StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("=== MimeHeaders ==="); - Enumeration e = names(); + Enumeration<String> e = names(); while (e.hasMoreElements()) { - String n = (String)e.nextElement(); + String n = e.nextElement(); pw.println(n + " = " + getHeader(n)); } return sw.toString(); @@ -197,11 +197,11 @@ * Field names may appear multiple times in this enumeration, indicating * that multiple fields with that name exist in this header. */ - public Enumeration names() { + public Enumeration<String> names() { return new NamesEnumerator(this); } - public Enumeration values(String name) { + public Enumeration<String> values(String name) { return new ValuesEnumerator(this, name); } @@ -358,7 +358,7 @@ This is less frequesnt than add() - we want to keep add O(1). */ -class NamesEnumerator implements Enumeration { +class NamesEnumerator implements Enumeration<String> { int pos; int size; String next; @@ -396,7 +396,7 @@ return next!=null; } - public Object nextElement() { + public String nextElement() { String current=next; findNext(); return current; @@ -406,7 +406,7 @@ /** Enumerate the values for a (possibly ) multiple value element. */ -class ValuesEnumerator implements Enumeration { +class ValuesEnumerator implements Enumeration<String> { int pos; int size; MessageBytes next; @@ -437,7 +437,7 @@ return next!=null; } - public Object nextElement() { + public String nextElement() { MessageBytes current=next; findNext(); return current.toString(); Modified: tomcat/trunk/java/org/apache/tomcat/util/http/MimeMap.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/MimeMap.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/MimeMap.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/MimeMap.java Tue Nov 18 15:29:05 2008 @@ -140,13 +140,13 @@ map.put(extn, type.toLowerCase()); } - public Enumeration getExtensions() { + public Enumeration<String> getExtensions() { return map.keys(); } public String getContentType(String extn) { - String type = (String)map.get(extn.toLowerCase()); - if( type == null ) type=(String)defaultMap.get( extn ); + String type = map.get(extn.toLowerCase()); + if(type == null) type = defaultMap.get(extn); return type; } Modified: tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java Tue Nov 18 15:29:05 2008 @@ -167,7 +167,7 @@ if ( key==null ) return; String values[]; if (paramHashStringArray.containsKey(key)) { - String oldValues[] = (String[])paramHashStringArray.get(key); + String oldValues[] = paramHashStringArray.get(key); values = new String[oldValues.length + newValues.length]; for (int i = 0; i < oldValues.length; i++) { values[i] = oldValues[i]; @@ -187,15 +187,15 @@ // sub-request if( currentChild!=null ) { currentChild.merge(); - return (String[])currentChild.paramHashStringArray.get(name); + return currentChild.paramHashStringArray.get(name); } // no "facade" - String values[]=(String[])paramHashStringArray.get(name); + String values[] = paramHashStringArray.get(name); return values; } - public Enumeration getParameterNames() { + public Enumeration<String> getParameterNames() { handleQueryParameters(); // Slow - the original code if( currentChild!=null ) { @@ -276,10 +276,10 @@ */ private static void merge2(Hashtable<String,String[]> one, Hashtable<String,String[]> two ) { - Enumeration e = two.keys(); + Enumeration<String> e = two.keys(); while (e.hasMoreElements()) { - String name = (String) e.nextElement(); + String name = e.nextElement(); String[] oneValue = one.get(name); String[] twoValue = two.get(name); String[] combinedValue; @@ -310,8 +310,7 @@ if( key==null ) return; String values[]; if (paramHashStringArray.containsKey(key)) { - String oldValues[] = (String[])paramHashStringArray. - get(key); + String oldValues[] = paramHashStringArray.get(key); values = new String[oldValues.length + 1]; for (int i = 0; i < oldValues.length; i++) { values[i] = oldValues[i]; @@ -517,11 +516,11 @@ */ public String paramsAsString() { StringBuffer sb=new StringBuffer(); - Enumeration en= paramHashStringArray.keys(); + Enumeration<String> en= paramHashStringArray.keys(); while( en.hasMoreElements() ) { - String k=(String)en.nextElement(); + String k = en.nextElement(); sb.append( k ).append("="); - String v[]=(String[])paramHashStringArray.get( k ); + String v[] = paramHashStringArray.get( k ); for( int i=0; i<v.length; i++ ) sb.append( v[i] ).append(","); sb.append("\n"); Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/DiskFileUpload.java Tue Nov 18 15:29:05 2008 @@ -190,9 +190,9 @@ * @exception FileUploadException if there are problems reading/parsing * the request or storing files. */ - public List /* FileItem */ parseRequest(HttpServletRequest req, - int sizeThreshold, - long sizeMax, String path) + public List<FileItem> parseRequest(HttpServletRequest req, + int sizeThreshold, + long sizeMax, String path) throws FileUploadException { setSizeThreshold(sizeThreshold); Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java Tue Nov 18 15:29:05 2008 @@ -239,7 +239,7 @@ * @exception FileUploadException if there are problems reading/parsing * the request or storing files. */ - public List /* FileItem */ parseRequest(HttpServletRequest req) + public List<FileItem> parseRequest(HttpServletRequest req) throws FileUploadException { if (null == req) @@ -247,7 +247,7 @@ throw new NullPointerException("req parameter"); } - ArrayList items = new ArrayList(); + ArrayList<FileItem> items = new ArrayList<FileItem>(); String contentType = req.getHeader(CONTENT_TYPE); if ((null == contentType) || (!contentType.startsWith(MULTIPART))) @@ -295,7 +295,7 @@ boolean nextPart = multi.skipPreamble(); while (nextPart) { - Map headers = parseHeaders(multi.readHeaders()); + Map<String,String> headers = parseHeaders(multi.readHeaders()); String fieldName = getFieldName(headers); if (fieldName != null) { @@ -402,7 +402,7 @@ * * @return The file name for the current <code>encapsulation</code>. */ - protected String getFileName(Map /* String, String */ headers) + protected String getFileName(Map<String,String> headers) { String fileName = null; String cd = getHeader(headers, CONTENT_DISPOSITION); @@ -427,7 +427,7 @@ * * @return The field name for the current <code>encapsulation</code>. */ - protected String getFieldName(Map /* String, String */ headers) + protected String getFieldName(Map<String,String> headers) { String fieldName = null; String cd = getHeader(headers, CONTENT_DISPOSITION); @@ -456,7 +456,7 @@ * * @exception FileUploadException if an error occurs. */ - protected FileItem createItem(Map /* String, String */ headers, + protected FileItem createItem(Map<String,String> headers, boolean isFormField) throws FileUploadException { @@ -479,9 +479,9 @@ * * @return A <code>Map</code> containing the parsed HTTP request headers. */ - protected Map /* String, String */ parseHeaders(String headerPart) + protected Map<String,String> parseHeaders(String headerPart) { - Map headers = new HashMap(); + Map<String,String> headers = new HashMap<String,String>(); char buffer[] = new char[MAX_HEADER_SIZE]; boolean done = false; int j = 0; @@ -548,10 +548,10 @@ * @return The value of specified header, or a comma-separated list if * there were multiple headers of that name. */ - protected final String getHeader(Map /* String, String */ headers, + protected final String getHeader(Map<String,String> headers, String name) { - return (String) headers.get(name.toLowerCase()); + return headers.get(name.toLowerCase()); } Modified: tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Tue Nov 18 15:29:05 2008 @@ -289,7 +289,7 @@ * @return The context names */ public String[] getContextNames() { - List list=new ArrayList(); + List<String> list = new ArrayList<String>(); for( int i=0; i<hosts.length; i++ ) { for( int j=0; j<hosts[i].contextList.contexts.length; j++ ) { String cname=hosts[i].contextList.contexts[j].name; @@ -298,7 +298,7 @@ } } String res[] = new String[list.size()]; - return (String[])list.toArray(res); + return list.toArray(res); } @@ -508,7 +508,7 @@ } public String[] getWrapperNames( String host, String context ) { - List list=new ArrayList(); + List<String> list = new ArrayList<String>(); if( host==null ) host=""; if( context==null ) context=""; for( int i=0; i<hosts.length; i++ ) { @@ -532,7 +532,7 @@ } } String res[]=new String[list.size()]; - return (String[])list.toArray(res); + return list.toArray(res); } Modified: tomcat/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java Tue Nov 18 15:29:05 2008 @@ -59,13 +59,14 @@ /** * Thread <-> CaptureLog associations. */ - protected static ThreadLocal logs = new ThreadLocal(); + protected static ThreadLocal<Stack<CaptureLog>> logs = + new ThreadLocal<Stack<CaptureLog>>(); /** * Spare CaptureLog ready for reuse. */ - protected static Stack reuse = new Stack(); + protected static Stack<CaptureLog> reuse = new Stack<CaptureLog>(); // --------------------------------------------------------- Public Methods @@ -78,16 +79,16 @@ CaptureLog log = null; if (!reuse.isEmpty()) { try { - log = (CaptureLog)reuse.pop(); + log = reuse.pop(); } catch (EmptyStackException e) { log = new CaptureLog(); } } else { log = new CaptureLog(); } - Stack stack = (Stack)logs.get(); + Stack<CaptureLog> stack = logs.get(); if (stack == null) { - stack = new Stack(); + stack = new Stack<CaptureLog>(); logs.set(stack); } stack.push(log); @@ -98,11 +99,11 @@ * Stop capturing thread's output and return captured data as a String. */ public static String stopCapture() { - Stack stack = (Stack)logs.get(); + Stack<CaptureLog> stack = logs.get(); if (stack == null || stack.isEmpty()) { return null; } - CaptureLog log = (CaptureLog)stack.pop(); + CaptureLog log = stack.pop(); if (log == null) { return null; } @@ -120,9 +121,9 @@ * Find PrintStream to which the output must be written to. */ protected PrintStream findStream() { - Stack stack = (Stack)logs.get(); + Stack<CaptureLog> stack = logs.get(); if (stack != null && !stack.isEmpty()) { - CaptureLog log = (CaptureLog)stack.peek(); + CaptureLog log = stack.peek(); if (log != null) { PrintStream ps = log.getStream(); if (ps != null) { Modified: tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java?rev=718766&r1=718765&r2=718766&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/threads/ThreadWithAttributes.java Tue Nov 18 15:29:05 2008 @@ -35,7 +35,7 @@ private Object control; public static int MAX_NOTES=16; private Object notes[]=new Object[MAX_NOTES]; - private Hashtable attributes=new Hashtable(); + private Hashtable<?,?> attributes=new Hashtable<Object,Object>(); private String currentStage; private Object param; @@ -97,7 +97,7 @@ /** Generic attributes. You'll need a hashtable lookup - * you can use notes for array access. */ - public final Hashtable getAttributes(Object control) { + public final Hashtable<?,?> getAttributes(Object control) { if( this.control != control ) return null; return attributes; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]