Author: markt Date: Fri Dec 26 11:18:42 2008 New Revision: 729526 URL: http://svn.apache.org/viewvc?rev=729526&view=rev Log: Fix various Eclipse warnings in o.a.c.servlets, mainly unnecessary casts.
Modified: tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Modified: tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java?rev=729526&r1=729525&r2=729526&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/CGIServlet.java Fri Dec 26 11:18:42 2008 @@ -40,7 +40,6 @@ import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; -import javax.servlet.UnavailableException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -1701,7 +1700,9 @@ // such as a socket disconnect on the servlet side; otherwise, the // external process could hang if (bufRead != -1) { - while ((bufRead = cgiOutput.read(bBuf)) != -1) {} + while ((bufRead = cgiOutput.read(bBuf)) != -1) { + // NOOP - just read the data + } } } @@ -1713,6 +1714,7 @@ try { Thread.sleep(500); } catch (InterruptedException ignored) { + // Ignore } } } //replacement for Process.waitFor() Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=729526&r1=729525&r2=729526&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Fri Dec 26 11:18:42 2008 @@ -213,6 +213,7 @@ * Finalize this servlet. */ public void destroy() { + // NOOP } Modified: tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java?rev=729526&r1=729525&r2=729526&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java (original) +++ tomcat/trunk/java/org/apache/catalina/servlets/WebdavServlet.java Fri Dec 26 11:18:42 2008 @@ -536,7 +536,7 @@ Enumeration<String> lockNullResourcesList = currentLockNullResources.elements(); while (lockNullResourcesList.hasMoreElements()) { - String lockNullPath = (String) + String lockNullPath = lockNullResourcesList.nextElement(); if (lockNullPath.equals(path)) { resp.setStatus(WebdavStatus.SC_MULTI_STATUS); @@ -592,7 +592,7 @@ while ((!stack.isEmpty()) && (depth >= 0)) { - String currentPath = (String) stack.pop(); + String currentPath = stack.pop(); parseProperties(req, generatedXML, currentPath, type, properties); @@ -608,8 +608,7 @@ NamingEnumeration<NameClassPair> enumeration = resources.list(currentPath); while (enumeration.hasMoreElements()) { - NameClassPair ncPair = - (NameClassPair) enumeration.nextElement(); + NameClassPair ncPair = enumeration.nextElement(); String newPath = currentPath; if (!(newPath.endsWith("/"))) newPath += "/"; @@ -635,7 +634,7 @@ Enumeration<String> lockNullResourcesList = currentLockNullResources.elements(); while (lockNullResourcesList.hasMoreElements()) { - String lockNullPath = (String) + String lockNullPath = lockNullResourcesList.nextElement(); parseLockNullProperties (req, generatedXML, lockNullPath, type, @@ -1100,7 +1099,7 @@ Vector<String> lockPaths = new Vector<String>(); locksList = collectionLocks.elements(); while (locksList.hasMoreElements()) { - LockInfo currentLock = (LockInfo) locksList.nextElement(); + LockInfo currentLock = locksList.nextElement(); if (currentLock.hasExpired()) { resourceLocks.remove(currentLock.path); continue; @@ -1114,7 +1113,7 @@ } locksList = resourceLocks.elements(); while (locksList.hasMoreElements()) { - LockInfo currentLock = (LockInfo) locksList.nextElement(); + LockInfo currentLock = locksList.nextElement(); if (currentLock.hasExpired()) { resourceLocks.remove(currentLock.path); continue; @@ -1149,7 +1148,7 @@ generatedXML.writeElement(null, "href", XMLWriter.OPENING); generatedXML - .writeText((String) lockPathsList.nextElement()); + .writeText(lockPathsList.nextElement()); generatedXML.writeElement(null, "href", XMLWriter.CLOSING); generatedXML.writeElement(null, "status", @@ -1182,7 +1181,7 @@ locksList = collectionLocks.elements(); while (locksList.hasMoreElements()) { - LockInfo currentLock = (LockInfo) locksList.nextElement(); + LockInfo currentLock = locksList.nextElement(); if (currentLock.path.equals(lock.path)) { if (currentLock.isExclusive()) { @@ -1213,7 +1212,7 @@ // Locking a single resource // Retrieving an already existing lock on that resource - LockInfo presentLock = (LockInfo) resourceLocks.get(lock.path); + LockInfo presentLock = resourceLocks.get(lock.path); if (presentLock != null) { if ((presentLock.isExclusive()) || (lock.isExclusive())) { @@ -1272,7 +1271,7 @@ // Checking resource locks - LockInfo toRenew = (LockInfo) resourceLocks.get(path); + LockInfo toRenew = resourceLocks.get(path); Enumeration<String> tokenList = null; if (lock != null) { @@ -1280,7 +1279,7 @@ tokenList = toRenew.tokens.elements(); while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (ifHeader.indexOf(token) != -1) { toRenew.expiresAt = lock.expiresAt; lock = toRenew; @@ -1294,12 +1293,12 @@ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { - toRenew = (LockInfo) collectionLocksList.nextElement(); + toRenew = collectionLocksList.nextElement(); if (path.equals(toRenew.path)) { tokenList = toRenew.tokens.elements(); while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (ifHeader.indexOf(token) != -1) { toRenew.expiresAt = lock.expiresAt; lock = toRenew; @@ -1362,7 +1361,7 @@ // Checking resource locks - LockInfo lock = (LockInfo) resourceLocks.get(path); + LockInfo lock = resourceLocks.get(path); Enumeration<String> tokenList = null; if (lock != null) { @@ -1370,7 +1369,7 @@ tokenList = lock.tokens.elements(); while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (lockTokenHeader.indexOf(token) != -1) { lock.tokens.removeElement(token); } @@ -1388,12 +1387,12 @@ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { - lock = (LockInfo) collectionLocksList.nextElement(); + lock = collectionLocksList.nextElement(); if (path.equals(lock.path)) { tokenList = lock.tokens.elements(); while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (lockTokenHeader.indexOf(token) != -1) { lock.tokens.removeElement(token); break; @@ -1430,9 +1429,6 @@ // Create a place for the normalized path String normalized = path; - if (normalized == null) - return (null); - if (normalized.equals("/.")) return "/"; @@ -1528,7 +1524,7 @@ // Checking resource locks - LockInfo lock = (LockInfo) resourceLocks.get(path); + LockInfo lock = resourceLocks.get(path); Enumeration<String> tokenList = null; if ((lock != null) && (lock.hasExpired())) { resourceLocks.remove(path); @@ -1539,7 +1535,7 @@ tokenList = lock.tokens.elements(); boolean tokenMatch = false; while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (ifHeader.indexOf(token) != -1) tokenMatch = true; } @@ -1552,7 +1548,7 @@ Enumeration<LockInfo> collectionLocksList = collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { - lock = (LockInfo) collectionLocksList.nextElement(); + lock = collectionLocksList.nextElement(); if (lock.hasExpired()) { collectionLocks.removeElement(lock); } else if (path.startsWith(lock.path)) { @@ -1560,7 +1556,7 @@ tokenList = lock.tokens.elements(); boolean tokenMatch = false; while (tokenList.hasMoreElements()) { - String token = (String) tokenList.nextElement(); + String token = tokenList.nextElement(); if (ifHeader.indexOf(token) != -1) tokenMatch = true; } @@ -1760,6 +1756,7 @@ try { object = resources.lookup(source); } catch (NamingException e) { + // Ignore } if (object instanceof DirContext) { @@ -1776,7 +1773,7 @@ NamingEnumeration<NameClassPair> enumeration = resources.list(source); while (enumeration.hasMoreElements()) { - NameClassPair ncPair = (NameClassPair) enumeration.nextElement(); + NameClassPair ncPair = enumeration.nextElement(); String childDest = dest; if (!childDest.equals("/")) childDest += "/"; @@ -1958,7 +1955,7 @@ } while (enumeration.hasMoreElements()) { - NameClassPair ncPair = (NameClassPair) enumeration.nextElement(); + NameClassPair ncPair = enumeration.nextElement(); String childName = path; if (!childName.equals("/")) childName += "/"; @@ -2026,8 +2023,8 @@ Enumeration<String> pathList = errorList.keys(); while (pathList.hasMoreElements()) { - String errorPath = (String) pathList.nextElement(); - int errorCode = ((Integer) errorList.get(errorPath)).intValue(); + String errorPath = pathList.nextElement(); + int errorCode = errorList.get(errorPath).intValue(); generatedXML.writeElement(null, "response", XMLWriter.OPENING); @@ -2217,7 +2214,7 @@ while (properties.hasMoreElements()) { - String property = (String) properties.nextElement(); + String property = properties.nextElement(); if (property.equals("creationdate")) { generatedXML.writeProperty @@ -2324,7 +2321,7 @@ while (propertiesNotFoundList.hasMoreElements()) { generatedXML.writeElement - (null, (String) propertiesNotFoundList.nextElement(), + (null, propertiesNotFoundList.nextElement(), XMLWriter.NO_CONTENT); } @@ -2367,7 +2364,7 @@ return; // Retrieving the lock associated with the lock-null resource - LockInfo lock = (LockInfo) resourceLocks.get(path); + LockInfo lock = resourceLocks.get(path); if (lock == null) return; @@ -2495,7 +2492,7 @@ while (properties.hasMoreElements()) { - String property = (String) properties.nextElement(); + String property = properties.nextElement(); if (property.equals("creationdate")) { generatedXML.writeProperty @@ -2573,7 +2570,7 @@ while (propertiesNotFoundList.hasMoreElements()) { generatedXML.writeElement - (null, (String) propertiesNotFoundList.nextElement(), + (null, propertiesNotFoundList.nextElement(), XMLWriter.NO_CONTENT); } @@ -2604,7 +2601,7 @@ private boolean generateLockDiscovery (String path, XMLWriter generatedXML) { - LockInfo resourceLock = (LockInfo) resourceLocks.get(path); + LockInfo resourceLock = resourceLocks.get(path); Enumeration<LockInfo> collectionLocksList = collectionLocks.elements(); boolean wroteStart = false; @@ -2617,8 +2614,7 @@ } while (collectionLocksList.hasMoreElements()) { - LockInfo currentLock = - (LockInfo) collectionLocksList.nextElement(); + LockInfo currentLock = collectionLocksList.nextElement(); if (path.startsWith(currentLock.path)) { if (!wroteStart) { wroteStart = true; @@ -2721,7 +2717,7 @@ * Constructor. */ public LockInfo() { - + // Ignore } @@ -2850,7 +2846,7 @@ new StringReader("Ignored external entity")); } } -}; +} // -------------------------------------------------------- WebdavStatus Class @@ -3151,7 +3147,7 @@ if (!mapStatusCodes.containsKey(intKey)) { return ""; } else { - return (String) mapStatusCodes.get(intKey); + return mapStatusCodes.get(intKey); } } @@ -3170,6 +3166,6 @@ mapStatusCodes.put(new Integer(nKey), strVal); } -}; +} --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org