This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new a93e2db13d Code clean-up - formatting. No functional change. a93e2db13d is described below commit a93e2db13da19f7866c62cd98a63ef891006cef6 Author: Mark Thomas <ma...@apache.org> AuthorDate: Tue Oct 22 09:39:31 2024 +0100 Code clean-up - formatting. No functional change. --- .../apache/catalina/filters/RateLimitFilter.java | 18 ++++++++--------- .../apache/catalina/servlets/WebdavServlet.java | 23 ++++++++++++---------- java/org/apache/catalina/util/FastRateLimiter.java | 2 +- 3 files changed, 22 insertions(+), 21 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/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 4831358a7f..fe5fbfc123 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -265,7 +265,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("/*")) { @@ -1087,7 +1088,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen collectionLocksIterator.remove(); continue; } - if (currentLock.path.startsWith(lock.path + "/") && (currentLock.isExclusive() || lock.isExclusive())) { + if (currentLock.path.startsWith(lock.path + "/") && + (currentLock.isExclusive() || lock.isExclusive())) { // A child collection of this collection is locked lockPaths.add(currentLock.path); } @@ -1097,7 +1099,8 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen resourceLocks.remove(currentLock.path); continue; } - if (currentLock.path.startsWith(lock.path + "/") && (currentLock.isExclusive() || lock.isExclusive())) { + if (currentLock.path.startsWith(lock.path + "/") && + (currentLock.isExclusive() || lock.isExclusive())) { // A child resource of this collection is locked lockPaths.add(currentLock.path); } @@ -1343,7 +1346,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). @@ -1428,7 +1431,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 * @@ -1686,7 +1689,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 * @@ -1746,8 +1749,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) { /* @@ -1834,8 +1837,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) { /* 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