From: markt Date: Mon, 19 Nov 2007 22:49:15 +0000 (+0000) Subject: Code cleanup. Fix warnings in webdav servlet. No functional change. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=476049b692041f9c56a5dc4472de1d426fe35538;p=tomcat7.0 Code cleanup. Fix warnings in webdav servlet. No functional change. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@596473 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index d451e9c9f..6ceee1f8c 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -80,7 +80,6 @@ public class WebdavServlet // -------------------------------------------------------------- Constants - private static final String METHOD_HEAD = "HEAD"; private static final String METHOD_PROPFIND = "PROPFIND"; private static final String METHOD_PROPPATCH = "PROPPATCH"; private static final String METHOD_MKCOL = "MKCOL"; @@ -490,10 +489,10 @@ public class WebdavServlet int slash = path.lastIndexOf('/'); if (slash != -1) { String parentPath = path.substring(0, slash); - Vector currentLockNullResources = - (Vector) lockNullResources.get(parentPath); + Vector currentLockNullResources = + lockNullResources.get(parentPath); if (currentLockNullResources != null) { - Enumeration lockNullResourcesList = + Enumeration lockNullResourcesList = currentLockNullResources.elements(); while (lockNullResourcesList.hasMoreElements()) { String lockNullPath = (String) @@ -565,7 +564,8 @@ public class WebdavServlet if ((object instanceof DirContext) && (depth > 0)) { try { - NamingEnumeration enumeration = resources.list(currentPath); + NamingEnumeration enumeration = + resources.list(currentPath); while (enumeration.hasMoreElements()) { NameClassPair ncPair = (NameClassPair) enumeration.nextElement(); @@ -588,10 +588,10 @@ public class WebdavServlet if (lockPath.endsWith("/")) lockPath = lockPath.substring(0, lockPath.length() - 1); - Vector currentLockNullResources = - (Vector) lockNullResources.get(lockPath); + Vector currentLockNullResources = + lockNullResources.get(lockPath); if (currentLockNullResources != null) { - Enumeration lockNullResourcesList = + Enumeration lockNullResourcesList = currentLockNullResources.elements(); while (lockNullResourcesList.hasMoreElements()) { String lockNullPath = (String) @@ -670,9 +670,8 @@ public class WebdavServlet } boolean exists = true; - Object object = null; try { - object = resources.lookup(path); + resources.lookup(path); } catch (NamingException e) { exists = false; } @@ -693,8 +692,8 @@ public class WebdavServlet if (req.getInputStream().available() > 0) { DocumentBuilder documentBuilder = getDocumentBuilder(); try { - Document document = documentBuilder.parse - (new InputSource(req.getInputStream())); + // Document document = + documentBuilder.parse(new InputSource(req.getInputStream())); // TODO : Process this request body resp.sendError(WebdavStatus.SC_NOT_IMPLEMENTED); return; @@ -1037,7 +1036,7 @@ public class WebdavServlet exists = false; } - Enumeration locksList = null; + Enumeration locksList = null; if (lockRequestType == LOCK_CREATION) { @@ -1092,7 +1091,7 @@ public class WebdavServlet // One of the child paths was locked // We generate a multistatus error report - Enumeration lockPathsList = lockPaths.elements(); + Enumeration lockPathsList = lockPaths.elements(); resp.setStatus(WebdavStatus.SC_CONFLICT); @@ -1233,7 +1232,7 @@ public class WebdavServlet // Checking resource locks LockInfo toRenew = (LockInfo) resourceLocks.get(path); - Enumeration tokenList = null; + Enumeration tokenList = null; if (lock != null) { // At least one of the tokens of the locks must have been given @@ -1251,7 +1250,8 @@ public class WebdavServlet // Checking inheritable collection locks - Enumeration collectionLocksList = collectionLocks.elements(); + Enumeration collectionLocksList = + collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { toRenew = (LockInfo) collectionLocksList.nextElement(); if (path.equals(toRenew.path)) { @@ -1322,7 +1322,7 @@ public class WebdavServlet // Checking resource locks LockInfo lock = (LockInfo) resourceLocks.get(path); - Enumeration tokenList = null; + Enumeration tokenList = null; if (lock != null) { // At least one of the tokens of the locks must have been given @@ -1345,7 +1345,7 @@ public class WebdavServlet // Checking inheritable collection locks - Enumeration collectionLocksList = collectionLocks.elements(); + Enumeration collectionLocksList = collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { lock = (LockInfo) collectionLocksList.nextElement(); if (path.equals(lock.path)) { @@ -1488,7 +1488,7 @@ public class WebdavServlet // Checking resource locks LockInfo lock = (LockInfo) resourceLocks.get(path); - Enumeration tokenList = null; + Enumeration tokenList = null; if ((lock != null) && (lock.hasExpired())) { resourceLocks.remove(path); } else if (lock != null) { @@ -1509,7 +1509,7 @@ public class WebdavServlet // Checking inheritable collection locks - Enumeration collectionLocksList = collectionLocks.elements(); + Enumeration collectionLocksList = collectionLocks.elements(); while (collectionLocksList.hasMoreElements()) { lock = (LockInfo) collectionLocksList.nextElement(); if (lock.hasExpired()) { @@ -1729,7 +1729,8 @@ public class WebdavServlet } try { - NamingEnumeration enumeration = resources.list(source); + NamingEnumeration enumeration = + resources.list(source); while (enumeration.hasMoreElements()) { NameClassPair ncPair = (NameClassPair) enumeration.nextElement(); String childDest = dest; @@ -1903,7 +1904,7 @@ public class WebdavServlet if (lockTokenHeader == null) lockTokenHeader = ""; - Enumeration enumeration = null; + Enumeration enumeration = null; try { enumeration = resources.list(path); } catch (NamingException e) { @@ -1963,7 +1964,7 @@ public class WebdavServlet * @param errorList List of error to be displayed */ private void sendReport(HttpServletRequest req, HttpServletResponse resp, - Hashtable errorList) + Hashtable errorList) throws ServletException, IOException { resp.setStatus(WebdavStatus.SC_MULTI_STATUS); @@ -1978,7 +1979,7 @@ public class WebdavServlet + generateNamespaceDeclarations(), XMLWriter.OPENING); - Enumeration pathList = errorList.keys(); + Enumeration pathList = errorList.keys(); while (pathList.hasMoreElements()) { String errorPath = (String) pathList.nextElement(); @@ -2265,7 +2266,8 @@ public class WebdavServlet generatedXML.writeElement(null, "status", XMLWriter.CLOSING); generatedXML.writeElement(null, "propstat", XMLWriter.CLOSING); - Enumeration propertiesNotFoundList = propertiesNotFound.elements(); + Enumeration propertiesNotFoundList = + propertiesNotFound.elements(); if (propertiesNotFoundList.hasMoreElements()) { @@ -2312,7 +2314,7 @@ public class WebdavServlet private void parseLockNullProperties(HttpServletRequest req, XMLWriter generatedXML, String path, int type, - Vector propertiesVector) { + Vector propertiesVector) { // Exclude any resource in the /WEB-INF and /META-INF subdirectories // (the "toUpperCase()" avoids problems on Windows systems) @@ -2445,7 +2447,7 @@ public class WebdavServlet generatedXML.writeElement(null, "propstat", XMLWriter.OPENING); generatedXML.writeElement(null, "prop", XMLWriter.OPENING); - Enumeration properties = propertiesVector.elements(); + Enumeration properties = propertiesVector.elements(); while (properties.hasMoreElements()) { @@ -2514,7 +2516,7 @@ public class WebdavServlet generatedXML.writeElement(null, "status", XMLWriter.CLOSING); generatedXML.writeElement(null, "propstat", XMLWriter.CLOSING); - Enumeration propertiesNotFoundList = propertiesNotFound.elements(); + Enumeration propertiesNotFoundList = propertiesNotFound.elements(); if (propertiesNotFoundList.hasMoreElements()) { @@ -2559,7 +2561,7 @@ public class WebdavServlet (String path, XMLWriter generatedXML) { LockInfo resourceLock = (LockInfo) resourceLocks.get(path); - Enumeration collectionLocksList = collectionLocks.elements(); + Enumeration collectionLocksList = collectionLocks.elements(); boolean wroteStart = false; @@ -2706,7 +2708,7 @@ public class WebdavServlet result += "Owner:" + owner + "\n"; result += "Expiration:" + FastHttpDateFormat.formatDate(expiresAt, null) + "\n"; - Enumeration tokensList = tokens.elements(); + Enumeration tokensList = tokens.elements(); while (tokensList.hasMoreElements()) { result += "Token:" + tokensList.nextElement() + "\n"; } @@ -2767,7 +2769,7 @@ public class WebdavServlet generatedXML.writeElement(null, "timeout", XMLWriter.CLOSING); generatedXML.writeElement(null, "locktoken", XMLWriter.OPENING); - Enumeration tokensList = tokens.elements(); + Enumeration tokensList = tokens.elements(); while (tokensList.hasMoreElements()) { generatedXML.writeElement(null, "href", XMLWriter.OPENING); generatedXML.writeText("opaquelocktoken:" diff --git a/java/org/apache/naming/resources/ProxyDirContext.java b/java/org/apache/naming/resources/ProxyDirContext.java index 509c0e2ed..05cb7a3e4 100644 --- a/java/org/apache/naming/resources/ProxyDirContext.java +++ b/java/org/apache/naming/resources/ProxyDirContext.java @@ -23,8 +23,10 @@ import java.io.IOException; import java.io.InputStream; import java.util.Hashtable; +import javax.naming.Binding; import javax.naming.Context; import javax.naming.Name; +import javax.naming.NameClassPair; import javax.naming.NameNotFoundException; import javax.naming.NameParser; import javax.naming.NamingEnumeration; @@ -462,7 +464,7 @@ public class ProxyDirContext implements DirContext { * this context. Each element of the enumeration is of type NameClassPair. * @exception NamingException if a naming exception is encountered */ - public NamingEnumeration list(Name name) + public NamingEnumeration list(Name name) throws NamingException { return dirContext.list(parseName(name)); } @@ -477,7 +479,7 @@ public class ProxyDirContext implements DirContext { * this context. Each element of the enumeration is of type NameClassPair. * @exception NamingException if a naming exception is encountered */ - public NamingEnumeration list(String name) + public NamingEnumeration list(String name) throws NamingException { return dirContext.list(parseName(name)); } @@ -496,7 +498,7 @@ public class ProxyDirContext implements DirContext { * Each element of the enumeration is of type Binding. * @exception NamingException if a naming exception is encountered */ - public NamingEnumeration listBindings(Name name) + public NamingEnumeration listBindings(Name name) throws NamingException { return dirContext.listBindings(parseName(name)); } @@ -511,7 +513,7 @@ public class ProxyDirContext implements DirContext { * Each element of the enumeration is of type Binding. * @exception NamingException if a naming exception is encountered */ - public NamingEnumeration listBindings(String name) + public NamingEnumeration listBindings(String name) throws NamingException { return dirContext.listBindings(parseName(name)); }