From 483fc8169659a3ae5a83eb5fabecc17db98c40a4 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Fri, 22 Nov 2024 22:05:06 +0000 Subject: [PATCH] Re-apply code formatting. No functional change. --- java/org/apache/catalina/WebResource.java | 4 +- .../catalina/manager/StatusTransformer.java | 44 +++++------- .../catalina/servlets/WebdavServlet.java | 70 ++++++++++--------- .../org/apache/catalina/startup/Catalina.java | 3 +- 4 files changed, 58 insertions(+), 63 deletions(-) diff --git a/java/org/apache/catalina/WebResource.java b/java/org/apache/catalina/WebResource.java index ba5adec5e6b5..692674d48731 100644 --- a/java/org/apache/catalina/WebResource.java +++ b/java/org/apache/catalina/WebResource.java @@ -99,8 +99,8 @@ public interface WebResource { String getETag(); /** - * Return the strong ETag if available else return the weak ETag calculated from the - * content length and last modified. + * Return the strong ETag if available else return the weak ETag calculated from the content length and last + * modified. * * @return The ETag for this resource */ diff --git a/java/org/apache/catalina/manager/StatusTransformer.java b/java/org/apache/catalina/manager/StatusTransformer.java index 903d8803473c..685258eca745 100644 --- a/java/org/apache/catalina/manager/StatusTransformer.java +++ b/java/org/apache/catalina/manager/StatusTransformer.java @@ -451,12 +451,10 @@ public static void writeConnectorState(PrintWriter writer, ObjectName tpName, St } appendJSonValue(writer, "name", jsonName).append(',').println(); indent(writer, 3).append('"').append("threadInfo").append('"').append(':').append('{'); - appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads")) + appendJSonValue(writer, "maxThreads", mBeanServer.getAttribute(tpName, "maxThreads")).append(','); + appendJSonValue(writer, "currentThreadCount", mBeanServer.getAttribute(tpName, "currentThreadCount")) .append(','); - appendJSonValue(writer, "currentThreadCount", - mBeanServer.getAttribute(tpName, "currentThreadCount")).append(','); - appendJSonValue(writer, "currentThreadsBusy", - mBeanServer.getAttribute(tpName, "currentThreadsBusy")); + appendJSonValue(writer, "currentThreadsBusy", mBeanServer.getAttribute(tpName, "currentThreadsBusy")); writer.append('}'); ObjectName grpName = null; @@ -471,12 +469,10 @@ public static void writeConnectorState(PrintWriter writer, ObjectName tpName, St writer.append(',').println(); indent(writer, 3).append('"').append("requestInfo").append('"').append(':').append('{'); appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(grpName, "maxTime")).append(','); - appendJSonValue(writer, "processingTime", - mBeanServer.getAttribute(grpName, "processingTime")).append(','); - appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount")) - .append(','); - appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount")) + appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(grpName, "processingTime")) .append(','); + appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(grpName, "requestCount")).append(','); + appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(grpName, "errorCount")).append(','); appendJSonValue(writer, "bytesReceived", mBeanServer.getAttribute(grpName, "bytesReceived")) .append(','); appendJSonValue(writer, "bytesSent", mBeanServer.getAttribute(grpName, "bytesSent")); @@ -838,8 +834,7 @@ protected static void writeContext(PrintWriter writer, ObjectName objectName, MB appendJSonValue(writer, "startTime", new Date(((Long) mBeanServer.getAttribute(objectName, "startTime")).longValue()).toString()) .append(','); - appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime")) - .append(','); + appendJSonValue(writer, "startupTime", mBeanServer.getAttribute(objectName, "startupTime")).append(','); appendJSonValue(writer, "tldScanTime", mBeanServer.getAttribute(objectName, "tldScanTime")); if (managerON != null) { writeManager(writer, managerON, mBeanServer, mode); @@ -909,18 +904,16 @@ public static void writeManager(PrintWriter writer, ObjectName objectName, MBean .append(','); appendJSonValue(writer, "sessionCounter", mBeanServer.getAttribute(objectName, "sessionCounter")) .append(','); - appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive")) + appendJSonValue(writer, "maxActive", mBeanServer.getAttribute(objectName, "maxActive")).append(','); + appendJSonValue(writer, "rejectedSessions", mBeanServer.getAttribute(objectName, "rejectedSessions")) + .append(','); + appendJSonValue(writer, "expiredSessions", mBeanServer.getAttribute(objectName, "expiredSessions")) + .append(','); + appendJSonValue(writer, "sessionMaxAliveTime", mBeanServer.getAttribute(objectName, "sessionMaxAliveTime")) .append(','); - appendJSonValue(writer, "rejectedSessions", - mBeanServer.getAttribute(objectName, "rejectedSessions")).append(','); - appendJSonValue(writer, "expiredSessions", - mBeanServer.getAttribute(objectName, "expiredSessions")).append(','); - appendJSonValue(writer, "sessionMaxAliveTime", - mBeanServer.getAttribute(objectName, "sessionMaxAliveTime")).append(','); appendJSonValue(writer, "sessionAverageAliveTime", mBeanServer.getAttribute(objectName, "sessionAverageAliveTime")).append(','); - appendJSonValue(writer, "processingTime", - mBeanServer.getAttribute(objectName, "processingTime")); + appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime")); writer.append('}'); } @@ -1022,12 +1015,9 @@ public static void writeWrapper(PrintWriter writer, ObjectName objectName, MBean appendJSonValue(writer, "processingTime", mBeanServer.getAttribute(objectName, "processingTime")) .append(','); appendJSonValue(writer, "maxTime", mBeanServer.getAttribute(objectName, "maxTime")).append(','); - appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount")) - .append(','); - appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount")) - .append(','); - appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime")) - .append(','); + appendJSonValue(writer, "requestCount", mBeanServer.getAttribute(objectName, "requestCount")).append(','); + appendJSonValue(writer, "errorCount", mBeanServer.getAttribute(objectName, "errorCount")).append(','); + appendJSonValue(writer, "loadTime", mBeanServer.getAttribute(objectName, "loadTime")).append(','); appendJSonValue(writer, "classLoadTime", mBeanServer.getAttribute(objectName, "classLoadTime")); writer.append('}'); } diff --git a/java/org/apache/catalina/servlets/WebdavServlet.java b/java/org/apache/catalina/servlets/WebdavServlet.java index 8de9008314ef..6d4a8f33791e 100644 --- a/java/org/apache/catalina/servlets/WebdavServlet.java +++ b/java/org/apache/catalina/servlets/WebdavServlet.java @@ -78,9 +78,9 @@ * this configuration. *

* Mapping a subpath (e.g. /webdav/* to this servlet has the effect of re-mounting the entire web - * application under that sub-path, with WebDAV access to all the resources. To restore the DefaultServlet - * behavior set serveSubpathOnly to true. The WEB-INF and - * META-INF directories are protected in this re-mounted resource tree. + * application under that sub-path, with WebDAV access to all the resources. To restore the DefaultServlet behavior set + * serveSubpathOnly to true. The WEB-INF and META-INF directories + * are protected in this re-mounted resource tree. *

* To enable WebDAV for a context add the following to web.xml: * @@ -135,14 +135,13 @@ * access will be able to edit content available via http://host:port/context/content using * http://host:port/context/webdavedit/content *

- * The Servlet provides support for arbitrary dead properties on all resources (dead properties are properties - * whose values are not protected by the server, such as the content length of a resource). By default the Servlet - * will use non persistent memory storage for them. Persistence can be achieved by implementing - * the PropertyStore interface and configuring the Servlet to use that store. - * The propertyStore init-param allows configuring the classname of the store to use, while the - * parameters in the form of store.xxx will be set on the store object as bean properties. - * For example, this would configure a store with class com.MyPropertyStore, and set its field - * myName to value myValue: + * The Servlet provides support for arbitrary dead properties on all resources (dead properties are properties whose + * values are not protected by the server, such as the content length of a resource). By default the Servlet will use + * non persistent memory storage for them. Persistence can be achieved by implementing the PropertyStore + * interface and configuring the Servlet to use that store. The propertyStore init-param allows configuring + * the classname of the store to use, while the parameters in the form of store.xxx will be set on the + * store object as bean properties. For example, this would configure a store with class + * com.MyPropertyStore, and set its field myName to value myValue: * *

  *  <init-param>
@@ -203,7 +202,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
      */
     protected static final String SUPPORTED_LOCKS =
             "\n  \n" +
-            "  \n";
+                    "  \n";
 
     /**
      * Simple date format for the creation date ISO representation (partial).
@@ -249,8 +248,7 @@ public class WebdavServlet extends DefaultServlet implements PeriodicEventListen
     private boolean strictIfProcessing = true;
 
     /**
-     * Serve resources from the mounted subpath only, restoring the behavior of
-     * {@code DefaultServlet}.
+     * Serve resources from the mounted subpath only, restoring the behavior of {@code DefaultServlet}.
      */
     private boolean serveSubpathOnly = false;
 
@@ -364,10 +362,9 @@ public void periodicEvent() {
 
 
     /**
-     * Handling of dead properties on resources. This interface allows
-     * providing storage for dead properties. Store configuration is done
-     * through the propertyStore init parameter of the WebDAV
-     * Servlet, which should contain the class name of the store.
+     * Handling of dead properties on resources. This interface allows providing storage for dead properties. Store
+     * configuration is done through the propertyStore init parameter of the WebDAV Servlet, which should
+     * contain the class name of the store.
      */
     public interface PropertyStore {
 
@@ -389,7 +386,7 @@ public interface PropertyStore {
         /**
          * Copy resource. Dead properties should be copied to the destination path.
          *
-         * @param source the copy source path
+         * @param source      the copy source path
          * @param destination the copy destination path
          */
         void copy(String source, String destination);
@@ -404,19 +401,20 @@ public interface PropertyStore {
         /**
          * Generate propfind XML fragments for dead properties.
          *
-         * @param resource 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 resource     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 a property was specified and a corresponding dead property was found on the resource,
-         *     false otherwise
+         *
+         * @return true if a property was specified and a corresponding dead property was found on the resource, false
+         *             otherwise
          */
         boolean propfind(String resource, Node property, boolean nameOnly, XMLWriter generatedXML);
 
         /**
          * Apply proppatch to the specified resource.
          *
-         * @param resource the resource path on which to apply the proppatch
+         * @param resource   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
          */
@@ -438,7 +436,8 @@ public static class ProppatchOperation {
 
         /**
          * PROPPATCH operation constructor.
-         * @param updateType the update type, either SET or REMOVE
+         *
+         * @param updateType   the update type, either SET or REMOVE
          * @param propertyNode the XML node that contains the property name (and value if SET)
          */
         public ProppatchOperation(PropertyUpdateType updateType, Node propertyNode) {
@@ -490,7 +489,9 @@ public boolean getProtectedProperty() {
      * Type of PROPFIND request.
      */
     enum PropfindType {
-        FIND_BY_PROPERTY, FIND_ALL_PROP, FIND_PROPERTY_NAMES
+        FIND_BY_PROPERTY,
+        FIND_ALL_PROP,
+        FIND_PROPERTY_NAMES
     }
 
 
@@ -498,7 +499,8 @@ enum PropfindType {
      * Type of property update in a PROPPATCH.
      */
     enum PropertyUpdateType {
-        SET, REMOVE
+        SET,
+        REMOVE
     }
 
 
@@ -1758,8 +1760,9 @@ protected void doUnlock(HttpServletRequest req, HttpServletResponse resp) throws
                 } 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;
@@ -1959,7 +1962,8 @@ private boolean isLocked(String path, String principal, String ifHeader) {
                                                 (lock.principal == null || lock.principal.equals(principal))) {
                                             return false;
                                         }
-                                        // Since it is a shared lock, continue to look up the tree but note that there was a lock
+                                        // Since it is a shared lock, continue to look up the tree but note that there
+                                        // was a lock
                                         unmatchedSharedLock = true;
                                     }
                                 }
@@ -2576,8 +2580,8 @@ private void propfindResource(XMLWriter generatedXML, String rewrittenUrl, Strin
 
                 for (Node propertyNode : properties) {
                     String property = getDAVNode(propertyNode);
-                    boolean protectedProperty =
-                            property != null && (!(property.equals("displayname") || property.equals("getcontentlanguage")));
+                    boolean protectedProperty = property != null &&
+                            (!(property.equals("displayname") || property.equals("getcontentlanguage")));
                     if (property == null || !protectedProperty) {
                         if (!store.propfind(path, propertyNode, false, generatedXML)) {
                             propertiesNotFound.add(propertyNode);
diff --git a/java/org/apache/catalina/startup/Catalina.java b/java/org/apache/catalina/startup/Catalina.java
index 8d33f85a9cf5..e659be32c112 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -930,7 +930,8 @@ protected void generateClassHeader(Digester digester, boolean start) {
         code.append(" implements ");
         code.append(ServerXml.class.getName().replace('$', '.')).append(" {").append(System.lineSeparator());
         code.append("public void load(").append(Catalina.class.getName());
-        code.append(' ').append(digester.toVariableName(this)).append(") throws Exception {").append(System.lineSeparator());
+        code.append(' ').append(digester.toVariableName(this)).append(") throws Exception {")
+                .append(System.lineSeparator());
     }