This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push: new 68041d3d0a Code clean-up - formatting. No functional change. 68041d3d0a is described below commit 68041d3d0abffedf2be5f9df108cf85ee4891fc5 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri May 23 11:49:12 2025 +0100 Code clean-up - formatting. No functional change. --- .../util/security/ConcurrentMessageDigest.java | 18 +++----- java/org/apache/tomcat/util/security/Escape.java | 52 +++++++++------------- 2 files changed, 29 insertions(+), 41 deletions(-) diff --git a/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java b/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java index 45dc4ae48c..9404f55044 100644 --- a/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java +++ b/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java @@ -28,9 +28,8 @@ import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.res.StringManager; /** - * A thread safe wrapper around {@link MessageDigest} that does not make use - * of ThreadLocal and - broadly - only creates enough MessageDigest objects - * to satisfy the concurrency requirements. + * A thread safe wrapper around {@link MessageDigest} that does not make use of ThreadLocal and - broadly - only creates + * enough MessageDigest objects to satisfy the concurrency requirements. */ public class ConcurrentMessageDigest { @@ -40,8 +39,7 @@ public class ConcurrentMessageDigest { private static final String MD5 = "MD5"; private static final String SHA1 = "SHA-1"; - private static final Map<String,Queue<MessageDigest>> queues = - new ConcurrentHashMap<>(); + private static final Map<String,Queue<MessageDigest>> queues = new ConcurrentHashMap<>(); private ConcurrentMessageDigest() { @@ -56,7 +54,7 @@ public class ConcurrentMessageDigest { log.warn(sm.getString("concurrentMessageDigest.noDigest"), e); } try { - init(SHA1); + init(SHA1); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(sm.getString("concurrentMessageDigest.noDigest"), e); } @@ -114,14 +112,12 @@ public class ConcurrentMessageDigest { /** - * Ensures that {@link #digest(String, byte[][])} will support the specified - * algorithm. This method <b>must</b> be called and return successfully - * before using {@link #digest(String, byte[][])}. + * Ensures that {@link #digest(String, byte[][])} will support the specified algorithm. This method <b>must</b> be + * called and return successfully before using {@link #digest(String, byte[][])}. * * @param algorithm The message digest algorithm to be supported * - * @throws NoSuchAlgorithmException If the algorithm is not supported by the - * JVM + * @throws NoSuchAlgorithmException If the algorithm is not supported by the JVM */ public static void init(String algorithm) throws NoSuchAlgorithmException { if (!queues.containsKey(algorithm)) { diff --git a/java/org/apache/tomcat/util/security/Escape.java b/java/org/apache/tomcat/util/security/Escape.java index 54e3835cae..5bdf8b8276 100644 --- a/java/org/apache/tomcat/util/security/Escape.java +++ b/java/org/apache/tomcat/util/security/Escape.java @@ -17,9 +17,8 @@ package org.apache.tomcat.util.security; /** - * Provides utility methods to escape content for different contexts. It is - * critical that the escaping used is correct for the context in which the data - * is to be used. + * Provides utility methods to escape content for different contexts. It is critical that the escaping used is correct + * for the context in which the data is to be used. */ public class Escape { @@ -29,19 +28,16 @@ public class Escape { /** - * Escape content for use in HTML. This escaping is suitable for the - * following uses: + * Escape content for use in HTML. This escaping is suitable for the following uses: * <ul> - * <li>Element content when the escaped data will be placed directly inside - * tags such as <p>, <td> etc.</li> - * <li>Attribute values when the attribute value is quoted with " or - * '.</li> + * <li>Element content when the escaped data will be placed directly inside tags such as <p>, <td> + * etc.</li> + * <li>Attribute values when the attribute value is quoted with " or '.</li> * </ul> * - * @param content The content to escape + * @param content The content to escape * - * @return The escaped content or {@code null} if the content was - * {@code null} + * @return The escaped content or {@code null} if the content was {@code null} */ public static String htmlElementContent(String content) { if (content == null) { @@ -74,13 +70,12 @@ public class Escape { /** - * Convert the object to a string via {@link Object#toString()} and HTML - * escape the resulting string for use in HTML content. + * Convert the object to a string via {@link Object#toString()} and HTML escape the resulting string for use in HTML + * content. * - * @param obj The object to convert to String and then escape + * @param obj The object to convert to String and then escape * - * @return The escaped content or <code>"?"</code> if obj is - * {@code null} + * @return The escaped content or <code>"?"</code> if obj is {@code null} */ public static String htmlElementContent(Object obj) { if (obj == null) { @@ -93,10 +88,9 @@ public class Escape { /** * Escape content for use in XML. * - * @param content The content to escape + * @param content The content to escape * - * @return The escaped content or {@code null} if the content was - * {@code null} + * @return The escaped content or {@code null} if the content was {@code null} */ public static String xml(String content) { return xml(null, content); @@ -106,11 +100,10 @@ public class Escape { /** * Escape content for use in XML. * - * @param ifNull The value to return if content is {@code null} - * @param content The content to escape + * @param ifNull The value to return if content is {@code null} + * @param content The content to escape * - * @return The escaped content or the value of {@code ifNull} if the - * content was {@code null} + * @return The escaped content or the value of {@code ifNull} if the content was {@code null} */ public static String xml(String ifNull, String content) { return xml(ifNull, false, content); @@ -120,12 +113,11 @@ public class Escape { /** * Escape content for use in XML. * - * @param ifNull The value to return if content is {@code null} - * @param escapeCRLF Should CR and LF also be escaped? - * @param content The content to escape + * @param ifNull The value to return if content is {@code null} + * @param escapeCRLF Should CR and LF also be escaped? + * @param content The content to escape * - * @return The escaped content or the value of ifNull if the content was - * {@code null} + * @return The escaped content or the value of ifNull if the content was {@code null} */ public static String xml(String ifNull, boolean escapeCRLF, String content) { if (content == null) { @@ -155,6 +147,6 @@ public class Escape { } } - return (sb.length() > content.length()) ? sb.toString(): content; + return (sb.length() > content.length()) ? sb.toString() : content; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org