This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new df2f6a1f54 Code clean-up - formatting. No functional change.
df2f6a1f54 is described below
commit df2f6a1f54f3538d0f4ef17d1a13bc095ca20652
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Oct 22 09:44:16 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 44d70add50..0f457ef0e6 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 36e83eb5fe..8fc29b30c7 100644
--- a/java/org/apache/catalina/servlets/WebdavServlet.java
+++ b/java/org/apache/catalina/servlets/WebdavServlet.java
@@ -264,7 +264,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("/*")) {
@@ -1086,7 +1087,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);
}
@@ -1096,7 +1098,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);
}
@@ -1342,7 +1345,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).
@@ -1427,7 +1430,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
*
@@ -1685,7 +1688,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
*
@@ -1745,8 +1748,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) {
/*
@@ -1833,8 +1836,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 13cc6a2b59..93279802b4 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: [email protected]
For additional commands, e-mail: [email protected]