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 163952922a Code clean-up - formatting. No functional change. 163952922a is described below commit 163952922a0d93f1a3e8f666e156eecf6816037d Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu May 22 12:02:20 2025 +0100 Code clean-up - formatting. No functional change. --- java/org/apache/tomcat/util/buf/AbstractChunk.java | 21 ++++++++++++++------- java/org/apache/tomcat/util/buf/ByteChunk.java | 22 ++++++++++------------ java/org/apache/tomcat/util/buf/HexUtils.java | 6 +++--- java/org/apache/tomcat/util/buf/StringCache.java | 2 +- java/org/apache/tomcat/util/buf/StringUtils.java | 6 +++--- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/java/org/apache/tomcat/util/buf/AbstractChunk.java b/java/org/apache/tomcat/util/buf/AbstractChunk.java index e26204b762..1c4bea9ede 100644 --- a/java/org/apache/tomcat/util/buf/AbstractChunk.java +++ b/java/org/apache/tomcat/util/buf/AbstractChunk.java @@ -87,6 +87,7 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** * Set the start position of the data in the buffer. + * * @param start the new start position */ public void setStart(int start) { @@ -107,6 +108,7 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** * Set the end position of the data in the buffer. + * * @param end the new end position */ public void setEnd(int end) { @@ -116,6 +118,7 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** * @return start + * * @deprecated Unused. This method will be removed in Tomcat 12. */ @Deprecated @@ -125,7 +128,9 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** * Set start. + * * @param off the new start + * * @deprecated Unused. This method will be removed in Tomcat 12. */ @Deprecated @@ -157,15 +162,15 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** - * Return the index of the first occurrence of the subsequence of - * the given String, or -1 if it is not found. + * Return the index of the first occurrence of the subsequence of the given String, or -1 if it is not found. * - * @param src the String to look for + * @param src the String to look for * @param srcStart the subsequence start in the String - * @param srcLen the subsequence length in the String + * @param srcLen the subsequence length in the String * @param myOffset the index on which to start the search in the buffer - * @return the position of the first character of the first occurrence - * of the subsequence in the buffer, or -1 if not found + * + * @return the position of the first character of the first occurrence of the subsequence in the buffer, or -1 if + * not found */ public int indexOf(String src, int srcStart, int srcLen, int myOffset) { char first = src.charAt(srcStart); @@ -173,7 +178,8 @@ public abstract class AbstractChunk implements Cloneable, Serializable { // Look for first char int srcEnd = srcStart + srcLen; - mainLoop: for (int i = myOffset + start; i <= (end - srcLen); i++) { + mainLoop: + for (int i = myOffset + start; i <= (end - srcLen); i++) { if (getBufferElement(i) != first) { continue; } @@ -227,6 +233,7 @@ public abstract class AbstractChunk implements Cloneable, Serializable { /** * @param index the element location in the buffer + * * @return the element */ protected abstract int getBufferElement(int index); diff --git a/java/org/apache/tomcat/util/buf/ByteChunk.java b/java/org/apache/tomcat/util/buf/ByteChunk.java index eb8870794e..b4aa88a2e0 100644 --- a/java/org/apache/tomcat/util/buf/ByteChunk.java +++ b/java/org/apache/tomcat/util/buf/ByteChunk.java @@ -42,17 +42,13 @@ import java.nio.charset.StandardCharsets; * chars and Strings until the strings are needed. In addition, the charset is determined later, from headers or user * code. * <p> - * In a server it is very important to be able to operate on - * the original byte[] without converting everything to chars. - * Some protocols are ASCII only, and some allow different - * non-UNICODE encodings. The encoding is not known beforehand, - * and can even change during the execution of the protocol. - * ( for example a multipart message may have parts with different - * encoding ) + * In a server it is very important to be able to operate on the original byte[] without converting everything to chars. + * Some protocols are ASCII only, and some allow different non-UNICODE encodings. The encoding is not known beforehand, + * and can even change during the execution of the protocol. ( for example a multipart message may have parts with + * different encoding ) * <p> - * For HTTP, it is not very clear how the encoding of RequestURI - * and mime values can be determined, but it is a great advantage - * to be able to parse the request without converting to string. + * For HTTP, it is not very clear how the encoding of RequestURI and mime values can be determined, but it is a great + * advantage to be able to parse the request without converting to string. * * @author d...@sun.com * @author James Todd [go...@sun.com] @@ -552,7 +548,8 @@ public final class ByteChunk extends AbstractChunk { // entire byte array. This is expensive if only a small subset of the // bytes will be used. The code below is from Apache Harmony. CharBuffer cb; - if (malformedInputAction == CodingErrorAction.REPLACE && unmappableCharacterAction == CodingErrorAction.REPLACE) { + if (malformedInputAction == CodingErrorAction.REPLACE && + unmappableCharacterAction == CodingErrorAction.REPLACE) { cb = charset.decode(ByteBuffer.wrap(buff, start, end - start)); } else { cb = charset.newDecoder().onMalformedInput(malformedInputAction) @@ -687,9 +684,10 @@ public final class ByteChunk extends AbstractChunk { * <p> * NOTE: This only works for characters in the range 0-127. * - * @param c2 the array to compare to + * @param c2 the array to compare to * @param off2 offset * @param len2 length + * * @return <code>true</code> if the comparison succeeded, <code>false</code> otherwise */ public boolean equals(char[] c2, int off2, int len2) { diff --git a/java/org/apache/tomcat/util/buf/HexUtils.java b/java/org/apache/tomcat/util/buf/HexUtils.java index 55fe2107c4..949de67448 100644 --- a/java/org/apache/tomcat/util/buf/HexUtils.java +++ b/java/org/apache/tomcat/util/buf/HexUtils.java @@ -33,9 +33,9 @@ public final class HexUtils { /** * Table for HEX to DEC byte translation. */ - private static final int[] DEC = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, - 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 10, 11, 12, 13, 14, 15, }; + private static final int[] DEC = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, + 11, 12, 13, 14, 15, }; /** diff --git a/java/org/apache/tomcat/util/buf/StringCache.java b/java/org/apache/tomcat/util/buf/StringCache.java index d36582f952..1cf36ea406 100644 --- a/java/org/apache/tomcat/util/buf/StringCache.java +++ b/java/org/apache/tomcat/util/buf/StringCache.java @@ -484,7 +484,7 @@ public class StringCache { * @return the corresponding value */ protected static String find(ByteChunk name, CodingErrorAction malformedInputAction, - CodingErrorAction unmappableCharacterAction) { + CodingErrorAction unmappableCharacterAction) { int pos = findClosest(name, bcCache, bcCache.length); if ((pos < 0) || (compare(name, bcCache[pos].name) != 0) || !(name.getCharset().equals(bcCache[pos].charset)) || !malformedInputAction.equals(bcCache[pos].malformedInputAction) || diff --git a/java/org/apache/tomcat/util/buf/StringUtils.java b/java/org/apache/tomcat/util/buf/StringUtils.java index 9419ee6dd7..0460053c17 100644 --- a/java/org/apache/tomcat/util/buf/StringUtils.java +++ b/java/org/apache/tomcat/util/buf/StringUtils.java @@ -101,11 +101,11 @@ public final class StringUtils { } /** - * Splits a comma-separated string into an array of String values. - * Whitespace around the commas is removed. - * Null or empty values will return a zero-element array. + * Splits a comma-separated string into an array of String values. Whitespace around the commas is removed. Null or + * empty values will return a zero-element array. * * @param s The string to split by commas. + * * @return An array of String values. */ public static String[] splitCommaSeparated(String s) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org