This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new e62fe4e7f2 Code clean-up - formatting. No functional change. e62fe4e7f2 is described below commit e62fe4e7f22b4720672909be6192214068cf6d6f Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Oct 22 09:27:13 2024 +0100 Code clean-up - formatting. No functional change. --- .../apache/catalina/filters/RateLimitFilter.java | 18 +-- .../servlets/TransientPropertiesWebdavServlet.java | 14 +- .../apache/catalina/servlets/WebdavServlet.java | 173 +++++++++++---------- .../catalina/tribes/util/ExecutorFactory.java | 4 +- .../apache/catalina/tribes/util/StringManager.java | 6 +- java/org/apache/catalina/util/FastRateLimiter.java | 2 +- 6 files changed, 114 insertions(+), 103 deletions(-) diff --git a/java/org/apache/catalina/filters/RateLimitFilter.java b/java/org/apache/catalina/filters/RateLimitFilter.java index c9f5c83c7c..6c002e1ef8 100644 --- a/java/org/apache/catalina/filters/RateLimitFilter.java +++ b/java/org/apache/catalina/filters/RateLimitFilter.java @@ -48,8 +48,8 @@ import org.apache.tomcat.util.res.StringManager; * some configured values to more efficient values. For example, a configuration of a 60 seconds time bucket is * converted to 65.536 seconds. That allows for very fast bucket calculation using bit shift arithmetic. In order to * remain true to the user intent, the configured number of requests is then multiplied by the same ratio, so a - * configuration of 100 Requests per 60 seconds, has the real values of 109 Requests per 65 seconds. You can specify - * a different class as long as it implements the <code>org.apache.catalina.util.RateLimiter</code> interface. + * configuration of 100 Requests per 60 seconds, has the real values of 109 Requests per 65 seconds. You can specify a + * different class as long as it implements the <code>org.apache.catalina.util.RateLimiter</code> interface. * </p> * <p> * It is common to set up different restrictions for different URIs. For example, a login page or authentication script @@ -164,7 +164,7 @@ public class RateLimitFilter extends FilterBase { super.init(filterConfig); try { - rateLimiter = (RateLimiter)Class.forName(rateLimitClassName).getConstructor().newInstance(); + rateLimiter = (RateLimiter) Class.forName(rateLimitClassName).getConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new ServletException(e); } @@ -175,10 +175,9 @@ public class RateLimitFilter extends FilterBase { filterName = filterConfig.getFilterName(); - log.info(sm.getString("rateLimitFilter.initialized", filterName, - Integer.valueOf(bucketRequests), Integer.valueOf(bucketDuration), - Integer.valueOf(rateLimiter.getRequests()), Integer.valueOf(rateLimiter.getDuration()), - (!enforce ? "Not " : "") + "enforcing")); + log.info(sm.getString("rateLimitFilter.initialized", filterName, Integer.valueOf(bucketRequests), + Integer.valueOf(bucketDuration), Integer.valueOf(rateLimiter.getRequests()), + Integer.valueOf(rateLimiter.getDuration()), (!enforce ? "Not " : "") + "enforcing")); } @Override @@ -192,9 +191,8 @@ public class RateLimitFilter extends FilterBase { if (reqCount > rateLimiter.getRequests()) { - log.warn(sm.getString("rateLimitFilter.maxRequestsExceeded", filterName, - Integer.valueOf(reqCount), ipAddr, Integer.valueOf(rateLimiter.getRequests()), - Integer.valueOf(rateLimiter.getDuration()))); + log.warn(sm.getString("rateLimitFilter.maxRequestsExceeded", filterName, Integer.valueOf(reqCount), ipAddr, + Integer.valueOf(rateLimiter.getRequests()), Integer.valueOf(rateLimiter.getDuration()))); if (enforce) { ((HttpServletResponse) response).sendError(statusCode, statusMessage); diff --git a/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java b/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java index 0ab6310ed9..efa02d23cb 100644 --- a/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java +++ b/java/org/apache/catalina/servlets/TransientPropertiesWebdavServlet.java @@ -83,7 +83,8 @@ public class TransientPropertiesWebdavServlet extends WebdavServlet { if (!found) { properties.add(node); } - } if (operation.getUpdateType() == PropertyUpdateType.REMOVE) { + } + if (operation.getUpdateType() == PropertyUpdateType.REMOVE) { Node node = operation.getPropertyNode(); for (int i = 0; i < properties.size(); i++) { Node propertyNode = properties.get(i); @@ -106,9 +107,8 @@ public class TransientPropertiesWebdavServlet extends WebdavServlet { if (nameOnly) { // Add the names of all properties for (Node node : properties) { - generatedXML.writeElement(node.getPrefix(), - node.getNamespaceURI(), - node.getLocalName(), XMLWriter.NO_CONTENT); + generatedXML.writeElement(node.getPrefix(), node.getNamespaceURI(), node.getLocalName(), + XMLWriter.NO_CONTENT); } } else if (property != null) { // Add a single property @@ -176,9 +176,9 @@ public class TransientPropertiesWebdavServlet extends WebdavServlet { } private boolean propertyEquals(Node node1, Node node2) { - if (node1.getLocalName().equals(node2.getLocalName()) - && ((node1.getNamespaceURI() == null && node2.getNamespaceURI() == null) - || (node1.getNamespaceURI() != null && node1.getNamespaceURI().equals(node2.getNamespaceURI())))) { + if (node1.getLocalName().equals(node2.getLocalName()) && + ((node1.getNamespaceURI() == null && node2.getNamespaceURI() == null) || + (node1.getNamespaceURI() != null && node1.getNamespaceURI().equals(node2.getNamespaceURI())))) { return true; } return false; diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index dca17bfe15..eab484be32 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -135,8 +135,8 @@ import org.xml.sax.SAXException; * http://host:port/context/webdavedit/content * <p> * There are some known limitations of this Servlet due to it not implementing PROPPATCH and PROPFIND methods support - * for dead properties. The Servlet does provide extension points to add support for some as required by user. Details of these - * limitations and progress towards addressing them are being tracked under + * for dead properties. The Servlet does provide extension points to add support for some as required by user. Details + * of these limitations and progress towards addressing them are being tracked under * <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=69046">bug 69046</a>. * </p> * @@ -209,15 +209,9 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** * Supported locks. */ - protected static final String SUPPORTED_LOCKS = - "<D:lockentry>" + - "<D:lockscope><D:exclusive/></D:lockscope>" + - "<D:locktype><D:write/></D:locktype>" + - "</D:lockentry>" + - "<D:lockentry>" + - "<D:lockscope><D:shared/></D:lockscope>" + - "<D:locktype><D:write/></D:locktype>" + - "</D:lockentry>"; + protected static final String SUPPORTED_LOCKS = "<D:lockentry>" + "<D:lockscope><D:exclusive/></D:lockscope>" + + "<D:locktype><D:write/></D:locktype>" + "</D:lockentry>" + "<D:lockentry>" + + "<D:lockscope><D:shared/></D:lockscope>" + "<D:locktype><D:write/></D:locktype>" + "</D:lockentry>"; /** * Simple date format for the creation date ISO representation (partial). @@ -231,13 +225,13 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** * Repository of all locks, keyed by path. */ - private final ConcurrentHashMap<String, LockInfo> resourceLocks = new ConcurrentHashMap<>(); + private final ConcurrentHashMap<String,LockInfo> resourceLocks = new ConcurrentHashMap<>(); /** * Map of all shared locks, keyed by lock token. */ - private final ConcurrentHashMap<String, LockInfo> sharedLocks = new ConcurrentHashMap<>(); + private final ConcurrentHashMap<String,LockInfo> sharedLocks = new ConcurrentHashMap<>(); /** @@ -273,7 +267,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen // Validate that the Servlet is only mapped to wildcard mappings String servletName = getServletConfig().getServletName(); - ServletRegistration servletRegistration = getServletConfig().getServletContext().getServletRegistration(servletName); + ServletRegistration servletRegistration = + getServletConfig().getServletContext().getServletRegistration(servletName); Collection<String> servletMappings = servletRegistration.getMappings(); for (String mapping : servletMappings) { if (!mapping.endsWith("/*")) { @@ -486,7 +481,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen for (String token : parentLock.sharedTokens) { LockInfo sharedLock = sharedLocks.get(token); if (sharedLock != null) { - if ((parentPath != currentPath && sharedLock.depth > 0) || parentPath == currentPath) { + if ((parentPath != currentPath && sharedLock.depth > 0) || + parentPath == currentPath) { lockTokens.add("opaquelocktoken:" + token); } } @@ -518,7 +514,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } while (true); return false; - } + } return true; } @@ -529,8 +525,9 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen * because the WebDAV servlet has been mapped to a url other than /* to configure editing at different url than * normal viewing. * - * @param request The servlet request we are processing + * @param request The servlet request we are processing * @param allowEmptyPath Used only to identify a call from DefaultServlet, to avoid removing the trailing slash + * * @return the relative path */ @Override @@ -765,9 +762,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen generatedXML.writeElement("D", DEFAULT_NAMESPACE, "multistatus", XMLWriter.OPENING); if (depth == 0) { - propfindResource(generatedXML, getEncodedPath(path, resource, req), - path, type, properties, resource.isFile(), - resource.getCreation(), resource.getLastModified(), resource.getContentLength(), + propfindResource(generatedXML, getEncodedPath(path, resource, req), path, type, properties, + resource.isFile(), resource.getCreation(), resource.getLastModified(), resource.getContentLength(), getServletContext().getMimeType(resource.getName()), generateETag(resource)); } else { // The stack always contains the object of the current level @@ -790,10 +786,10 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen // File is in directory listing but doesn't appear to exist // Broken symlink or odd permission settings? if (resource.exists()) { - propfindResource(generatedXML, getEncodedPath(currentPath, resource, req), - currentPath, type, properties, resource.isFile(), - resource.getCreation(), resource.getLastModified(), resource.getContentLength(), - getServletContext().getMimeType(resource.getName()), generateETag(resource)); + propfindResource(generatedXML, getEncodedPath(currentPath, resource, req), currentPath, type, + properties, resource.isFile(), resource.getCreation(), resource.getLastModified(), + resource.getContentLength(), getServletContext().getMimeType(resource.getName()), + generateETag(resource)); } if (resource.isDirectory() && (depth > 0)) { @@ -835,7 +831,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen * @param resp The Servlet response * * @throws ServletException If an error occurs - * @throws IOException If an IO error occurs + * @throws IOException If an IO error occurs */ protected void doProppatch(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -904,7 +900,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } } if (property != null) { - operations.add(new ProppatchOperation(PropertyUpdateType.SET, property)); + operations + .add(new ProppatchOperation(PropertyUpdateType.SET, property)); } else { resp.sendError(WebdavStatus.SC_BAD_REQUEST); return; @@ -936,7 +933,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } } if (property != null) { - operations.add(new ProppatchOperation(PropertyUpdateType.REMOVE, property)); + operations.add( + new ProppatchOperation(PropertyUpdateType.REMOVE, property)); } else { resp.sendError(WebdavStatus.SC_BAD_REQUEST); return; @@ -976,8 +974,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen for (ProppatchOperation operation : operations) { generatedXML.writeElement("D", "propstat", XMLWriter.OPENING); generatedXML.writeElement("D", "prop", XMLWriter.OPENING); - generatedXML.writeElement(operation.propertyNode.getPrefix(), - operation.propertyNode.getNamespaceURI(), + generatedXML.writeElement(operation.propertyNode.getPrefix(), operation.propertyNode.getNamespaceURI(), operation.propertyNode.getLocalName(), XMLWriter.NO_CONTENT); generatedXML.writeElement("D", "prop", XMLWriter.CLOSING); generatedXML.writeElement("D", "status", XMLWriter.OPENING); @@ -1000,12 +997,13 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** - * Apply proppatch to the specified path. This should be overridden by subclasses to provide - * useful behavior. The default implementation prevents setting protected properties - * (anything from the DAV: namespace), and sets 507 for a set attempt on dead properties. + * Apply proppatch to the specified path. This should be overridden by subclasses to provide useful behavior. The + * default implementation prevents setting protected properties (anything from the DAV: namespace), and sets 507 for + * a set attempt on dead properties. * - * @param path the resource path on which to apply the proppatch - * @param operations the set and remove to apply, the final status codes of the result should be set on each operation + * @param path the resource path on which to apply the proppatch + * @param operations the set and remove to apply, the final status codes of the result should be set on each + * operation */ protected void proppatchResource(String path, ArrayList<ProppatchOperation> operations) { boolean setProperty = false; @@ -1416,14 +1414,16 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen // Checking if a child resource of this collection is // already locked - // Note: it is likely faster in many cases to go over the full lock list than trying to go over all the children (recursively) + // Note: it is likely faster in many cases to go over the full lock list than trying to go over all the + // children (recursively) List<String> lockPaths = new ArrayList<>(); for (LockInfo currentLock : resourceLocks.values()) { if (currentLock.hasExpired()) { resourceLocks.remove(currentLock.path); continue; } - if ((currentLock.isExclusive() || lock.isExclusive()) && currentLock.path.startsWith(lock.path + "/")) { + if ((currentLock.isExclusive() || lock.isExclusive()) && + currentLock.path.startsWith(lock.path + "/")) { // A child resource of this collection is locked lockPaths.add(currentLock.lockroot); } @@ -1528,8 +1528,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } else { if ((parentPath != path && parentLock.depth > 0) || parentPath == path) { if (parentLock.isExclusive()) { - if (ifHeader.contains(parentLock.token) - && (parentLock.principal == null || parentLock.principal.equals(req.getRemoteUser()))) { + if (ifHeader.contains(parentLock.token) && (parentLock.principal == null || + parentLock.principal.equals(req.getRemoteUser()))) { toRenew = parentLock; break; } @@ -1537,8 +1537,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen for (String token : parentLock.sharedTokens) { if (ifHeader.contains(token)) { LockInfo sharedLock = sharedLocks.get(token); - if (sharedLock != null - && (sharedLock.principal == null || sharedLock.principal.equals(req.getRemoteUser()))) { + if (sharedLock != null && (sharedLock.principal == null || + sharedLock.principal.equals(req.getRemoteUser()))) { if ((parentPath != path && sharedLock.depth > 0) || parentPath == path) { toRenew = sharedLock; break; @@ -1628,8 +1628,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } else { if ((parentPath != path && parentLock.depth > 0) || parentPath == path) { if (parentLock.isExclusive()) { - if (lockTokenHeader.contains(parentLock.token) - && (parentLock.principal == null || parentLock.principal.equals(req.getRemoteUser()))) { + if (lockTokenHeader.contains(parentLock.token) && (parentLock.principal == null || + parentLock.principal.equals(req.getRemoteUser()))) { resourceLocks.remove(parentPath); unlocked = true; break; @@ -1642,8 +1642,10 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen for (String token : parentLock.sharedTokens) { if (lockTokenHeader.contains(token)) { LockInfo lock = sharedLocks.get(token); - if (lock == null || lock.principal == null || lock.principal.equals(req.getRemoteUser())) { - if ((parentPath != path && lock != null && lock.depth > 0) || parentPath == path) { + if (lock == null || lock.principal == null || + lock.principal.equals(req.getRemoteUser())) { + if ((parentPath != path && lock != null && lock.depth > 0) || + parentPath == path) { parentLock.sharedTokens.remove(token); if (parentLock.sharedTokens.isEmpty()) { resourceLocks.remove(parentPath); @@ -1680,7 +1682,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen * client has demonstrated knowledge of the appropriate lock tokens. * * @param path The relative path - * @param req Servlet request + * @param req Servlet request * * @return <code>true</code> if the resource is locked (and no appropriate lock token has been found for at least * one of the non-shared locks which are present on the resource). @@ -1709,9 +1711,9 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** * Check to see if a resource is currently write locked. * - * @param path Path of the resource + * @param path Path of the resource * @param principal The authenticated principal name - * @param ifHeader "If" HTTP header which was included in the request + * @param ifHeader "If" HTTP header which was included in the request * * @return <code>true</code> if the resource is locked (and no appropriate lock token has been found for at least * one of the non-shared locks which are present on the resource). @@ -1729,8 +1731,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } else { if ((parentPath != path && parentLock.depth > 0) || parentPath == path) { if (parentLock.isExclusive()) { - if (ifHeader.contains(":" + parentLock.token + ">") - && (parentLock.principal == null || parentLock.principal.equals(principal))) { + if (ifHeader.contains(":" + parentLock.token + ">") && + (parentLock.principal == null || parentLock.principal.equals(principal))) { return false; } return true; @@ -1739,8 +1741,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen LockInfo lock = sharedLocks.get(token); if (lock != null) { if ((parentPath != path && lock.depth > 0) || parentPath == path) { - if (ifHeader.contains(":" + token + ">") - && (lock.principal == null || lock.principal.equals(principal))) { + if (ifHeader.contains(":" + token + ">") && + (lock.principal == null || lock.principal.equals(principal))) { return false; } unmatchedSharedLock = true; @@ -1765,7 +1767,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** * Copy a resource. * - * @param path Path of the resource to copy + * @param path Path of the resource to copy * @param req Servlet request * @param resp Servlet response * @@ -2025,12 +2027,12 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } /** - * Copy resource. This should be overridden by subclasses to provide - * useful behavior. The default implementation prevents setting protected properties - * (anything from the DAV: namespace), and sets 507 for a set attempt on dead properties. + * Copy resource. This should be overridden by subclasses to provide useful behavior. The default implementation + * prevents setting protected properties (anything from the DAV: namespace), and sets 507 for a set attempt on dead + * properties. * * @param source the copy source path - * @param dest the copy destination path + * @param dest the copy destination path */ protected void copyResource(String source, String dest) { } @@ -2038,7 +2040,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** * Delete a resource. * - * @param path Path of the resource which is to be deleted + * @param path Path of the resource which is to be deleted * @param req Servlet request * @param resp Servlet response * @@ -2099,8 +2101,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen * See RFC 4918, section 9.6.1, last paragraph. * * If a child resource can't be deleted then the parent resource SHOULD NOT be included in the - * multi-status response since the notice of the failure to delete the child implies that all - * parent resources could also not be deleted. + * multi-status response since the notice of the failure to delete the child implies that all parent + * resources could also not be deleted. */ if (resources.list(path).length == 0) { /* @@ -2126,9 +2128,9 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } /** - * Delete specified resource. This should be overridden by subclasses to provide - * useful behavior. The default implementation prevents setting protected properties - * (anything from the DAV: namespace), and sets 507 for a set attempt on dead properties. + * Delete specified resource. This should be overridden by subclasses to provide useful behavior. The default + * implementation prevents setting protected properties (anything from the DAV: namespace), and sets 507 for a set + * attempt on dead properties. * * @param path the path of the resource to delete */ @@ -2211,8 +2213,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen * See RFC 4918, section 9.6.1, last paragraph. * * If a child resource can't be deleted then the parent resource SHOULD NOT be included in the - * multi-status response since the notice of the failure to delete the child implies that all - * parent resources could also not be deleted. + * multi-status response since the notice of the failure to delete the child implies that all parent + * resources could also not be deleted. */ if (!childResource.isDirectory() || resources.list(childName).length == 0) { /* @@ -2274,8 +2276,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } - private void sendReport(HttpServletRequest req, HttpServletResponse resp, String errorPath, int errorCode, String error) - throws IOException { + private void sendReport(HttpServletRequest req, HttpServletResponse resp, String errorPath, int errorCode, + String error) throws IOException { resp.setStatus(errorCode); XMLWriter generatedXML = new XMLWriter(); @@ -2302,8 +2304,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen private void propfindResource(XMLWriter generatedXML, String rewrittenUrl, String path, int propFindType, - List<Node> properties, boolean isFile, long created, long lastModified, - long contentLength, String contentType, String eTag) { + List<Node> properties, boolean isFile, long created, long lastModified, long contentLength, + String contentType, String eTag) { generatedXML.writeElement("D", "response", XMLWriter.OPENING); String status = "HTTP/1.1 " + WebdavStatus.SC_OK + " "; @@ -2472,8 +2474,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen generatedXML.writeElement("D", propertyNotFound, XMLWriter.NO_CONTENT); } else { generatedXML.writeElement(propertyNotFoundNode.getPrefix(), - propertyNotFoundNode.getNamespaceURI(), - propertyNotFoundNode.getLocalName(), XMLWriter.NO_CONTENT); + propertyNotFoundNode.getNamespaceURI(), propertyNotFoundNode.getLocalName(), + XMLWriter.NO_CONTENT); } } @@ -2492,15 +2494,17 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen /** - * Generate propfind XML fragments for dead properties. This should be overridden by subclasses to provide - * useful behavior. The default implementation prevents setting protected properties - * (anything from the DAV: namespace), and sets 507 for a set attempt on dead properties. + * Generate propfind XML fragments for dead properties. This should be overridden by subclasses to provide useful + * behavior. The default implementation prevents setting protected properties (anything from the DAV: namespace), + * and sets 507 for a set attempt on dead properties. * - * @param path the resource path - * @param property the dead property, if null then all dead properties must be written - * @param nameOnly true if only the property name element should be generated + * @param path the resource path + * @param property the dead property, if null then all dead properties must be written + * @param nameOnly true if only the property name element should be generated * @param generatedXML the current generated XML for the PROPFIND response - * @return true if property was specified and a corresponding dead property was found on the resource, false otherwise + * + * @return true if property was specified and a corresponding dead property was found on the resource, false + * otherwise */ protected boolean propfindResource(String path, Node property, boolean nameOnly, XMLWriter generatedXML) { if (nameOnly) { @@ -2771,44 +2775,53 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen } } - enum PropertyUpdateType { SET, REMOVE } + enum PropertyUpdateType { + SET, + REMOVE + } protected static class ProppatchOperation { private final PropertyUpdateType updateType; private final Node propertyNode; private final boolean protectedProperty; private int statusCode = HttpServletResponse.SC_OK; + public ProppatchOperation(PropertyUpdateType updateType, Node propertyNode) { this.updateType = updateType; this.propertyNode = propertyNode; String davName = getDAVNode(propertyNode); - protectedProperty = davName != null - && (!(davName.equals("displayname") || davName.equals("getcontentlanguage"))); + protectedProperty = + davName != null && (!(davName.equals("displayname") || davName.equals("getcontentlanguage"))); } + /** * @return the updateType */ public PropertyUpdateType getUpdateType() { return this.updateType; } + /** * @return the propertyNode */ public Node getPropertyNode() { return this.propertyNode; } + /** * @return the statusCode */ public int getStatusCode() { return this.statusCode; } + /** * @param statusCode the statusCode to set */ public void setStatusCode(int statusCode) { this.statusCode = statusCode; } + /** * @return the protectedProperty */ diff --git a/java/org/apache/catalina/tribes/util/ExecutorFactory.java b/java/org/apache/catalina/tribes/util/ExecutorFactory.java index 2f2cdfdcc5..a2c64c168e 100644 --- a/java/org/apache/catalina/tribes/util/ExecutorFactory.java +++ b/java/org/apache/catalina/tribes/util/ExecutorFactory.java @@ -38,8 +38,8 @@ public class ExecutorFactory { public static ExecutorService newThreadPool(int minThreads, int maxThreads, long maxIdleTime, TimeUnit unit, ThreadFactory threadFactory) { TaskQueue taskqueue = new TaskQueue(); - ThreadPoolExecutor service = new TribesThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit, taskqueue, - threadFactory); + ThreadPoolExecutor service = + new TribesThreadPoolExecutor(minThreads, maxThreads, maxIdleTime, unit, taskqueue, threadFactory); taskqueue.setParent(service); return service; } diff --git a/java/org/apache/catalina/tribes/util/StringManager.java b/java/org/apache/catalina/tribes/util/StringManager.java index c3096263f7..d2b6623068 100644 --- a/java/org/apache/catalina/tribes/util/StringManager.java +++ b/java/org/apache/catalina/tribes/util/StringManager.java @@ -170,7 +170,7 @@ public class StringManager { // STATIC SUPPORT METHODS // -------------------------------------------------------------- - private static final Map<String, Map<Locale, StringManager>> managers = new HashMap<>(); + private static final Map<String,Map<Locale,StringManager>> managers = new HashMap<>(); /** @@ -210,7 +210,7 @@ public class StringManager { */ public static final synchronized StringManager getManager(String packageName, Locale locale) { - Map<Locale, StringManager> map = managers.get(packageName); + Map<Locale,StringManager> map = managers.get(packageName); if (map == null) { /* * Don't want the HashMap size to exceed LOCALE_CACHE_SIZE. Expansion occurs when size() exceeds capacity. @@ -221,7 +221,7 @@ public class StringManager { private static final long serialVersionUID = 1L; @Override - protected boolean removeEldestEntry(Map.Entry<Locale, StringManager> eldest) { + protected boolean removeEldestEntry(Map.Entry<Locale,StringManager> eldest) { if (size() > (LOCALE_CACHE_SIZE - 1)) { return true; } diff --git a/java/org/apache/catalina/util/FastRateLimiter.java b/java/org/apache/catalina/util/FastRateLimiter.java index 25c6546663..a3aabf00c9 100644 --- a/java/org/apache/catalina/util/FastRateLimiter.java +++ b/java/org/apache/catalina/util/FastRateLimiter.java @@ -72,7 +72,7 @@ public class FastRateLimiter implements RateLimiter { public void setFilterConfig(FilterConfig filterConfig) { ScheduledExecutorService executorService = (ScheduledExecutorService) filterConfig.getServletContext() - .getAttribute(ScheduledThreadPoolExecutor.class.getName()); + .getAttribute(ScheduledThreadPoolExecutor.class.getName()); if (executorService == null) { executorService = new java.util.concurrent.ScheduledThreadPoolExecutor(1); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org