Re: (tomcat) 01/06: Remove unused code - thanks to UCDetector
Mark, Can't this entire class be replaced with calls to java.util.Base64.get*Encoder and java.util.Base64.get*Decoder wherever necessary? Now that 9.0.x is oldest, we should be able to use java.util.Base64 from Java 1.8+ ? -chris On 4/4/24 15:52, ma...@apache.org wrote: 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 commit 1a2f722e405ec17c5dab5fac43ae2fe63eb8fbce Author: Mark Thomas AuthorDate: Fri Jun 17 12:29:10 2022 +0100 Remove unused code - thanks to UCDetector --- .../apache/tomcat/util/codec/binary/Base64.java| 155 - .../tomcat/util/codec/binary/BaseNCodec.java | 88 2 files changed, 243 deletions(-) diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java index a733df9937..e38bf3df17 100644 --- a/java/org/apache/tomcat/util/codec/binary/Base64.java +++ b/java/org/apache/tomcat/util/codec/binary/Base64.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.codec.binary; -import java.math.BigInteger; -import java.util.Objects; - /** * Provides Base64 encoding and decoding as defined by http://www.ietf.org/rfc/rfc2045.txt;>RFC 2045. * @@ -141,20 +138,6 @@ public class Base64 extends BaseNCodec { // The private member fields below are used with the new streaming approach, which requires // some state be preserved between calls of encode() and decode(). -/** - * Decodes Base64 data into octets. - * - * Note: this method seamlessly handles data encoded in URL-safe or normal mode. - * - * - * @param base64Data - *Byte array containing Base64 data - * @return Array containing decoded data. - */ -public static byte[] decodeBase64(final byte[] base64Data) { -return decodeBase64(base64Data, 0, base64Data.length); -} - public static byte[] decodeBase64( final byte[] base64Data, final int off, final int len) { return new Base64().decode(base64Data, off, len); @@ -180,29 +163,6 @@ public class Base64 extends BaseNCodec { } // Implementation of integer encoding used for crypto -/** - * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. - * - * @param pArray - *a byte array containing base64 character data - * @return A BigInteger - * @since 1.4 - */ -public static BigInteger decodeInteger(final byte[] pArray) { -return new BigInteger(1, decodeBase64(pArray)); -} - -/** - * Encodes binary data using the base64 algorithm but does not chunk the output. - * - * @param binaryData - *binary data to encode - * @return byte[] containing Base64 characters in their UTF-8 representation. - */ -public static byte[] encodeBase64(final byte[] binaryData) { -return encodeBase64(binaryData, false); -} - /** * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. * @@ -272,17 +232,6 @@ public class Base64 extends BaseNCodec { return b64.encode(binaryData); } -/** - * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks - * - * @param binaryData - *binary data to encode - * @return Base64 characters chunked in 76 character blocks - */ -public static byte[] encodeBase64Chunked(final byte[] binaryData) { -return encodeBase64(binaryData, true); -} - /** * Encodes binary data using the base64 algorithm but does not chunk the output. * @@ -298,19 +247,6 @@ public class Base64 extends BaseNCodec { return StringUtils.newStringUsAscii(encodeBase64(binaryData, false)); } -/** - * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The - * url-safe variation emits - and _ instead of + and / characters. - * Note: no padding is added. - * @param binaryData - *binary data to encode - * @return byte[] containing Base64 characters in their UTF-8 representation. - * @since 1.4 - */ -public static byte[] encodeBase64URLSafe(final byte[] binaryData) { -return encodeBase64(binaryData, false, true); -} - /** * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The * url-safe variation emits - and _ instead of + and / characters. @@ -324,97 +260,6 @@ public class Base64 extends BaseNCodec { return StringUtils.newStringUsAscii(encodeBase64(binaryData, false, true)); } -/** - * Encodes to a byte64-encoded integer according to crypto standards
(tomcat) 04/06: Align with Commons File Upload 1.x and make @since tags project specific
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 commit 46f8078384b1616811723a741047f719b5791f69 Author: Mark Thomas AuthorDate: Thu Apr 4 12:48:27 2024 +0100 Align with Commons File Upload 1.x and make @since tags project specific --- java/org/apache/tomcat/util/http/fileupload/FileItem.java | 2 +- .../tomcat/util/http/fileupload/FileItemHeaders.java | 2 +- .../util/http/fileupload/FileItemHeadersSupport.java | 2 +- java/org/apache/tomcat/util/http/fileupload/FileUtils.java | 4 ++-- java/org/apache/tomcat/util/http/fileupload/IOUtils.java | 14 +++--- .../tomcat/util/http/fileupload/MultipartStream.java | 3 +-- .../apache/tomcat/util/http/fileupload/RequestContext.java | 2 +- .../apache/tomcat/util/http/fileupload/UploadContext.java | 4 ++-- .../tomcat/util/http/fileupload/disk/DiskFileItem.java | 2 +- .../util/http/fileupload/disk/DiskFileItemFactory.java | 2 +- .../http/fileupload/impl/InvalidContentTypeException.java | 2 +- .../tomcat/util/http/fileupload/impl/SizeException.java| 4 ++-- .../http/fileupload/servlet/ServletRequestContext.java | 2 +- .../util/http/fileupload/util/FileItemHeadersImpl.java | 2 +- .../tomcat/util/http/fileupload/util/mime/MimeUtility.java | 2 +- .../util/http/fileupload/util/mime/ParseException.java | 2 +- .../http/fileupload/util/mime/QuotedPrintableDecoder.java | 2 +- 17 files changed, 26 insertions(+), 27 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItem.java b/java/org/apache/tomcat/util/http/fileupload/FileItem.java index d1e0523f12..e6f035fc7b 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItem.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItem.java @@ -43,7 +43,7 @@ import java.io.UnsupportedEncodingException; * implementation of this interface to also implement * {@code javax.activation.DataSource} with minimal additional work. * - * @since 1.3 additionally implements FileItemHeadersSupport + * @since FileUpload 1.3 additionally implements FileItemHeadersSupport */ public interface FileItem extends FileItemHeadersSupport { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java index bcfd40c588..890f4397ae 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java @@ -23,7 +23,7 @@ import java.util.Iterator; * item that was received within a {@code multipart/form-data} POST * request. * - * @since 1.2.1 + * @since FileUpload 1.2.1 */ public interface FileItemHeaders { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java index 3e98dbb2f0..e5858c7177 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java @@ -20,7 +20,7 @@ package org.apache.tomcat.util.http.fileupload; * Interface that will indicate that {@link FileItem} or {@link FileItemStream} * implementations will accept the headers read for the item. * - * @since 1.2.1 + * @since FileUpload 1.2.1 * * @see FileItem * @see FileItemStream diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java index 53e0489cf7..a325fb62a6 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java @@ -258,7 +258,7 @@ public class FileUtils { * @param file file with parent to create, must not be {@code null} * @throws NullPointerException if the file is {@code null} * @throws IOException if the parent directory cannot be created - * @since 2.5 + * @since IO 2.5 */ public static void forceMkdirParent(final File file) throws IOException { final File parent = file.getParentFile(); @@ -282,7 +282,7 @@ public class FileUtils { * @param file the file to check * @return true if the file is a Symbolic Link * @throws IOException if an IO error occurs while checking the file - * @since 2.0 + * @since IO 2.0 */ public static boolean isSymlink(File file) throws IOException { if (file == null) { diff --git a/java/org/apache/tomcat/util/http/fileupload/IOUtils.java b/java/org/apache/tomcat/util/http/fileupload/IOUtils.java index 069b0aeb00..0941653ebd 100644 --- a/java/org/apache/tomcat/util/http/fileupload/IOUtils.java +++ b/java/org/apache/tomcat/util/http/fileupload/IOUtils.java @@ -60,7 +60,7 @@ public class IOUtils { /** * Represents the end-of-file (or stream). - * @since 2.5 (made
(tomcat) 01/06: Remove unused code - thanks to UCDetector
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 commit 1a2f722e405ec17c5dab5fac43ae2fe63eb8fbce Author: Mark Thomas AuthorDate: Fri Jun 17 12:29:10 2022 +0100 Remove unused code - thanks to UCDetector --- .../apache/tomcat/util/codec/binary/Base64.java| 155 - .../tomcat/util/codec/binary/BaseNCodec.java | 88 2 files changed, 243 deletions(-) diff --git a/java/org/apache/tomcat/util/codec/binary/Base64.java b/java/org/apache/tomcat/util/codec/binary/Base64.java index a733df9937..e38bf3df17 100644 --- a/java/org/apache/tomcat/util/codec/binary/Base64.java +++ b/java/org/apache/tomcat/util/codec/binary/Base64.java @@ -16,9 +16,6 @@ */ package org.apache.tomcat.util.codec.binary; -import java.math.BigInteger; -import java.util.Objects; - /** * Provides Base64 encoding and decoding as defined by http://www.ietf.org/rfc/rfc2045.txt;>RFC 2045. * @@ -141,20 +138,6 @@ public class Base64 extends BaseNCodec { // The private member fields below are used with the new streaming approach, which requires // some state be preserved between calls of encode() and decode(). -/** - * Decodes Base64 data into octets. - * - * Note: this method seamlessly handles data encoded in URL-safe or normal mode. - * - * - * @param base64Data - *Byte array containing Base64 data - * @return Array containing decoded data. - */ -public static byte[] decodeBase64(final byte[] base64Data) { -return decodeBase64(base64Data, 0, base64Data.length); -} - public static byte[] decodeBase64( final byte[] base64Data, final int off, final int len) { return new Base64().decode(base64Data, off, len); @@ -180,29 +163,6 @@ public class Base64 extends BaseNCodec { } // Implementation of integer encoding used for crypto -/** - * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. - * - * @param pArray - *a byte array containing base64 character data - * @return A BigInteger - * @since 1.4 - */ -public static BigInteger decodeInteger(final byte[] pArray) { -return new BigInteger(1, decodeBase64(pArray)); -} - -/** - * Encodes binary data using the base64 algorithm but does not chunk the output. - * - * @param binaryData - *binary data to encode - * @return byte[] containing Base64 characters in their UTF-8 representation. - */ -public static byte[] encodeBase64(final byte[] binaryData) { -return encodeBase64(binaryData, false); -} - /** * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. * @@ -272,17 +232,6 @@ public class Base64 extends BaseNCodec { return b64.encode(binaryData); } -/** - * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks - * - * @param binaryData - *binary data to encode - * @return Base64 characters chunked in 76 character blocks - */ -public static byte[] encodeBase64Chunked(final byte[] binaryData) { -return encodeBase64(binaryData, true); -} - /** * Encodes binary data using the base64 algorithm but does not chunk the output. * @@ -298,19 +247,6 @@ public class Base64 extends BaseNCodec { return StringUtils.newStringUsAscii(encodeBase64(binaryData, false)); } -/** - * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The - * url-safe variation emits - and _ instead of + and / characters. - * Note: no padding is added. - * @param binaryData - *binary data to encode - * @return byte[] containing Base64 characters in their UTF-8 representation. - * @since 1.4 - */ -public static byte[] encodeBase64URLSafe(final byte[] binaryData) { -return encodeBase64(binaryData, false, true); -} - /** * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The * url-safe variation emits - and _ instead of + and / characters. @@ -324,97 +260,6 @@ public class Base64 extends BaseNCodec { return StringUtils.newStringUsAscii(encodeBase64(binaryData, false, true)); } -/** - * Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. - * - * @param bigInteger - *a BigInteger - * @return A byte array containing base64 character data - * @throws NullPointerException - * if null is passed in - * @since 1.4 - */ -public static byte[] encodeInteger(final BigInteger
(tomcat) 05/06: Update merge info. FileUpload was manually synchronized with 1.x.
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 commit 29a5b0e37bf19e3ddd0f0d5adf89839652947cc0 Author: Mark Thomas AuthorDate: Thu Apr 4 13:06:19 2024 +0100 Update merge info. FileUpload was manually synchronized with 1.x. --- MERGE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MERGE.txt b/MERGE.txt index 8404019433..c3e81ab842 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -51,10 +51,11 @@ Note: Only classes required for Base64 encoding/decoding. The rest are removed. FileUpload -- Unused code is removed +Branch: 1.x Sub-tree: src/main/java/org/apache/commons/fileupload2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: -34eb241c051b02eca3b0b1b04f67b3b4e6c3a24d (2023-01-03) +7a8c3241cfa8d036452cd4fc3f92d57cff189bca (2023-09-16) Note: Tomcat's copy of fileupload also includes classes copied manually from Commons IO. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 02/06: Remove unused code - thanks to UCDetector
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 commit 9ba3b0c57fff311cd898716db19e508183545b28 Author: Mark Thomas AuthorDate: Fri Jun 17 12:46:38 2022 +0100 Remove unused code - thanks to UCDetector --- MERGE.txt | 3 + java/org/apache/catalina/connector/Request.java| 4 +- .../http/fileupload/ByteArrayOutputStream.java | 29 - .../tomcat/util/http/fileupload/FileUpload.java| 13 -- .../util/http/fileupload/FileUploadBase.java | 53 .../util/http/fileupload/FileUploadException.java | 10 -- .../http/fileupload/servlet/ServletFileUpload.java | 136 - .../tomcat/util/http/fileupload/util/Streams.java | 35 -- 8 files changed, 5 insertions(+), 278 deletions(-) diff --git a/MERGE.txt b/MERGE.txt index b73dfeeb8e..0ee5ce424b 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -33,6 +33,7 @@ the patch file has been applied and committed BCEL +Unused code is removed Sub-tree: src/main/java/org/apache/bcel The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: @@ -40,6 +41,7 @@ rel/commons-bcel-6.8.2 (2024-02-25) Codec - +Unused code is removed Sub-tree: src/main/java/org/apache/commons/codec The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: @@ -48,6 +50,7 @@ Note: Only classes required for Base64 encoding/decoding. The rest are removed. FileUpload -- +Unused code is removed Sub-tree: src/main/java/org/apache/commons/fileupload2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 67ad9e5ca3..c28a9bf216 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -109,10 +109,10 @@ import org.apache.tomcat.util.http.Rfc6265CookieProcessor; import org.apache.tomcat.util.http.ServerCookie; import org.apache.tomcat.util.http.ServerCookies; import org.apache.tomcat.util.http.fileupload.FileItem; +import org.apache.tomcat.util.http.fileupload.FileUpload; import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory; import org.apache.tomcat.util.http.fileupload.impl.InvalidContentTypeException; import org.apache.tomcat.util.http.fileupload.impl.SizeException; -import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload; import org.apache.tomcat.util.http.fileupload.servlet.ServletRequestContext; import org.apache.tomcat.util.http.parser.AcceptLanguage; import org.apache.tomcat.util.http.parser.Upgrade; @@ -2607,7 +2607,7 @@ public class Request implements HttpServletRequest { } factory.setSizeThreshold(mce.getFileSizeThreshold()); -ServletFileUpload upload = new ServletFileUpload(); +FileUpload upload = new FileUpload(); upload.setFileItemFactory(factory); upload.setFileSizeMax(mce.getMaxFileSize()); upload.setSizeMax(mce.getMaxRequestSize()); diff --git a/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java b/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java index 5cc26df6ef..aaee63f112 100644 --- a/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java +++ b/java/org/apache/tomcat/util/http/fileupload/ByteArrayOutputStream.java @@ -17,7 +17,6 @@ package org.apache.tomcat.util.http.fileupload; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; @@ -167,34 +166,6 @@ public class ByteArrayOutputStream extends OutputStream { count++; } -/** - * Writes the entire contents of the specified input stream to this - * byte stream. Bytes from the input stream are read directly into the - * internal buffers of this streams. - * - * @param in the input stream to read from - * @return total number of bytes read from the input stream - * (and written to this stream) - * @throws IOException if an I/O error occurs while reading the input stream - * @since 1.4 - */ -public synchronized int write(final InputStream in) throws IOException { -int readCount = 0; -int inBufferPos = count - filledBufferSum; -int n = in.read(currentBuffer, inBufferPos, currentBuffer.length - inBufferPos); -while (n != -1) { -readCount += n; -inBufferPos += n; -count += n; -if (inBufferPos == currentBuffer.length) { -needNewBuffer(currentBuffer.length); -inBufferPos = 0; -} -n = in.read(currentBuffer, inBufferPos, currentBuffer.length - inBufferPos); -} -return readCount; -} -
(tomcat) 03/06: Remove unused code - Thanks to UCDetector
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 commit a24dfb9ffc5e6f8e7886b3d7c726b0ceabd9d96c Author: Mark Thomas AuthorDate: Fri Jun 17 14:01:45 2022 +0100 Remove unused code - Thanks to UCDetector --- MERGE.txt | 2 + .../dbcp/pool2/BaseKeyedPooledObjectFactory.java | 124 - .../tomcat/dbcp/pool2/BasePooledObjectFactory.java | 105 - .../dbcp/pool2/KeyedPooledObjectFactory.java | 1 - 4 files changed, 2 insertions(+), 230 deletions(-) diff --git a/MERGE.txt b/MERGE.txt index 0ee5ce424b..8404019433 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -62,12 +62,14 @@ Note: Tomcat's copy of fileupload also includes classes copied manually from DBCP Pool2 +Unused classes removed Sub-tree src/main/java/org/apache/commons/pool2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: rel/commons-pool-2.12.0 (2023-09-30) DBCP2 +No unused code removed Sub-tree src/main/java/org/apache/commons/dbcp2 src/main/resources/org/apache/commons/dbcp2 diff --git a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java b/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java deleted file mode 100644 index a9877f12b6..00 --- a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tomcat.dbcp.pool2; - -/** - * A base implementation of {@code KeyedPooledObjectFactory}. - * - * All operations defined here are essentially no-op's. - * - * - * This class is immutable, and therefore thread-safe. - * - * - * @see KeyedPooledObjectFactory - * - * @param The type of keys managed by this factory. - * @param Type of element managed by this factory. - * - * @since 2.0 - */ -public abstract class BaseKeyedPooledObjectFactory extends BaseObject -implements KeyedPooledObjectFactory { - -/** - * Reinitialize an instance to be returned by the pool. - * - * The default implementation is a no-op. - * - * - * @param key the key used when selecting the object - * @param p a {@code PooledObject} wrapping the instance to be activated - */ -@Override -public void activateObject(final K key, final PooledObject p) -throws Exception { -// The default implementation is a no-op. -} - -/** - * Create an instance that can be served by the pool. - * - * @param key the key used when constructing the object - * @return an instance that can be served by the pool - * - * @throws Exception if there is a problem creating a new instance, - *this will be propagated to the code requesting an object. - */ -public abstract V create(K key) -throws Exception; - -/** - * Destroy an instance no longer needed by the pool. - * - * The default implementation is a no-op. - * - * - * @param key the key used when selecting the instance - * @param p a {@code PooledObject} wrapping the instance to be destroyed - */ -@Override -public void destroyObject(final K key, final PooledObject p) -throws Exception { -// The default implementation is a no-op. -} - -@Override -public PooledObject makeObject(final K key) throws Exception { -return wrap(create(key)); -} - -/** - * Uninitialize an instance to be returned to the idle object pool. - * - * The default implementation is a no-op. - * - * - * @param key the key used when selecting the object - * @param p a {@code PooledObject} wrapping the instance to be passivated - */ -@Override -public void passivateObject(final K key, final PooledObject p) -throws Exception { -// The default implementation is a no-op. -} - -/** - * Ensures that the instance is safe to be returned by the pool. - * - * The default implementation always returns {@code true}. - * - * - * @param key the key used
(tomcat) 06/06: Align with 10.1.x
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 commit 264f5abd609caf7df02483567c8238a7d1e4b339 Author: Mark Thomas AuthorDate: Thu Apr 4 14:01:58 2024 +0100 Align with 10.1.x --- java/org/apache/tomcat/util/http/fileupload/disk/package-info.java | 3 +-- java/org/apache/tomcat/util/http/fileupload/package-info.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java b/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java index 6e9599a82d..c82f4342d4 100644 --- a/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java +++ b/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java @@ -28,8 +28,7 @@ * {@link org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory DiskFileItemFactory} * would be created, configured, and then passed to a * {@link org.apache.tomcat.util.http.fileupload.FileUpload FileUpload} - * implementation such as - * {@link org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload ServletFileUpload}. + * implementation. * * * The following code fragment demonstrates this usage. diff --git a/java/org/apache/tomcat/util/http/fileupload/package-info.java b/java/org/apache/tomcat/util/http/fileupload/package-info.java index f13b5983f5..dee2bb19fc 100644 --- a/java/org/apache/tomcat/util/http/fileupload/package-info.java +++ b/java/org/apache/tomcat/util/http/fileupload/package-info.java @@ -30,8 +30,7 @@ * While this package provides the generic functionality for file uploads, * these classes are not typically used directly. Instead, normal usage * involves one of the provided extensions of - * {@link org.apache.tomcat.util.http.fileupload.FileUpload FileUpload} such as - * {@link org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload ServletFileUpload} + * {@link org.apache.tomcat.util.http.fileupload.FileUpload FileUpload} * together with a factory for * {@link org.apache.tomcat.util.http.fileupload.FileItem FileItem} instances, * such as - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 9.0.x updated (a202a68cb3 -> 264f5abd60)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git from a202a68cb3 Revert "Further locking harmonizations for main components" new 1a2f722e40 Remove unused code - thanks to UCDetector new 9ba3b0c57f Remove unused code - thanks to UCDetector new a24dfb9ffc Remove unused code - Thanks to UCDetector new 46f8078384 Align with Commons File Upload 1.x and make @since tags project specific new 29a5b0e37b Update merge info. FileUpload was manually synchronized with 1.x. new 264f5abd60 Align with 10.1.x The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: MERGE.txt | 8 +- java/org/apache/catalina/connector/Request.java| 4 +- .../dbcp/pool2/BaseKeyedPooledObjectFactory.java | 124 - .../tomcat/dbcp/pool2/BasePooledObjectFactory.java | 105 -- .../dbcp/pool2/KeyedPooledObjectFactory.java | 1 - .../apache/tomcat/util/codec/binary/Base64.java| 155 - .../tomcat/util/codec/binary/BaseNCodec.java | 88 .../http/fileupload/ByteArrayOutputStream.java | 29 .../tomcat/util/http/fileupload/FileItem.java | 2 +- .../util/http/fileupload/FileItemHeaders.java | 2 +- .../http/fileupload/FileItemHeadersSupport.java| 2 +- .../tomcat/util/http/fileupload/FileUpload.java| 13 -- .../util/http/fileupload/FileUploadBase.java | 53 --- .../util/http/fileupload/FileUploadException.java | 10 -- .../tomcat/util/http/fileupload/FileUtils.java | 4 +- .../tomcat/util/http/fileupload/IOUtils.java | 14 +- .../util/http/fileupload/MultipartStream.java | 3 +- .../util/http/fileupload/RequestContext.java | 2 +- .../tomcat/util/http/fileupload/UploadContext.java | 4 +- .../util/http/fileupload/disk/DiskFileItem.java| 2 +- .../http/fileupload/disk/DiskFileItemFactory.java | 2 +- .../util/http/fileupload/disk/package-info.java| 3 +- .../impl/InvalidContentTypeException.java | 2 +- .../util/http/fileupload/impl/SizeException.java | 4 +- .../tomcat/util/http/fileupload/package-info.java | 3 +- .../http/fileupload/servlet/ServletFileUpload.java | 136 -- .../fileupload/servlet/ServletRequestContext.java | 2 +- .../http/fileupload/util/FileItemHeadersImpl.java | 2 +- .../tomcat/util/http/fileupload/util/Streams.java | 35 - .../http/fileupload/util/mime/MimeUtility.java | 2 +- .../http/fileupload/util/mime/ParseException.java | 2 +- .../util/mime/QuotedPrintableDecoder.java | 2 +- 32 files changed, 37 insertions(+), 783 deletions(-) delete mode 100644 java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java delete mode 100644 java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java delete mode 100644 java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch main updated: Further locking harmonizations for main components
On Thu, Apr 4, 2024 at 3:58 PM Konstantin Kolinko wrote: > > чт, 4 апр. 2024 г. в 15:45, : > > > > This is an automated email from the ASF dual-hosted git repository. > > > > remm pushed a commit to branch main > > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > > > > The following commit(s) were added to refs/heads/main by this push: > > new fba89a Further locking harmonizations for main components > > fba89a is described below > > > > commit fba89a6f05223768e7d7026cd886d7f8356d > > Author: remm > > AuthorDate: Thu Apr 4 14:43:02 2024 +0200 > > > > Further locking harmonizations for main components > > > > Also for lifecycle operations. > > --- > > java/org/apache/catalina/core/ContainerBase.java | 86 > > +- > > java/org/apache/catalina/core/StandardService.java | 22 +++--- > > webapps/docs/changelog.xml | 5 +- > > 3 files changed, 66 insertions(+), 47 deletions(-) > > > > diff --git a/java/org/apache/catalina/core/ContainerBase.java > > b/java/org/apache/catalina/core/ContainerBase.java > > index 4edd4edf9d..846f4e27d8 100644 > > --- a/java/org/apache/catalina/core/ContainerBase.java > > +++ b/java/org/apache/catalina/core/ContainerBase.java > > @@ -129,6 +129,7 @@ public abstract class ContainerBase extends > > LifecycleMBeanBase implements Contai > > * The child Containers belonging to this Container, keyed by name. > > */ > > protected final HashMap children = new HashMap<>(); > > +private final ReadWriteLock childrenLock = new > > ReentrantReadWriteLock(); > > It is useless to have the above "children" field as protected. > Nobody will be able to access it in a safe manner, because they have > no access to childrenLock. > > > @@ -632,26 +633,30 @@ public abstract class ContainerBase extends > > LifecycleMBeanBase implements Contai > > log.debug(sm.getString("containerBase.child.add", child, > > this)); > > } > > > > -synchronized (children) { > > +childrenLock.writeLock().lock(); > > +try { > > if (children.get(child.getName()) != null) { > > throw new > > IllegalArgumentException(sm.getString("containerBase.child.notUnique", > > child.getName())); > > } > > child.setParent(this); // May throw IAE > > children.put(child.getName(), child); > > -} > > Change of behaviour! > The old sync block ended with the "}" above. > > > -fireContainerEvent(ADD_CHILD_EVENT, child); > > +fireContainerEvent(ADD_CHILD_EVENT, child); > > > > -// Start child > > -// Don't do this inside sync block - start can be a slow process > > and > > -// locking the children object can cause problems elsewhere > > -try { > > -if ((getState().isAvailable() || > > LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { > > -child.start(); > > +// Start child > > +// Don't do this inside sync block - start can be a slow > > process and > > The above says "Don't do this inside sync block", > but your change puts it into a sync block. > > (And I see similar changes of behaviour further in this commit.) > > The lock was intended to protect changes of the "children" hash table, > but now it starts to protect > a) state changes of those children (start/stop/destroy) > b) notifications. > > I think that the state changes (in LifecycleBase) already have their > own protection. Yes, it's all synced. This is rather inconsistent overall, and I thought first about harmonizing the other way. I don't understand why the lifecycle operation needs to be under the sync (and the notification also seemed like a bad idea) so it could be better. Rémy > While stating/stopping/destroying is in progress, > that child still remains ours and findChildren() etc. should be > allowed to be called by other threads. > A write lock prevents other threads from reading the value. > > https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html > > Thus I am -1. > I think it is easier to revert and work on a new patch rather than try > to amend this one. > > > +// locking the children object can cause problems elsewhere > > +try { > > +if ((getState().isAvailable() || > > LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { > > +child.start(); > > +} > > +} catch (LifecycleException e) { > > +throw new > > IllegalStateException(sm.getString("containerBase.child.start"), e); > > } > > -} catch (LifecycleException e) { > > -throw new > > IllegalStateException(sm.getString("containerBase.child.start"), e); > > +} finally { > > +childrenLock.writeLock().unlock(); > > } > > + > > } > > >
(tomcat) branch 9.0.x updated: Revert "Further locking harmonizations for main components"
This is an automated email from the ASF dual-hosted git repository. remm 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 a202a68cb3 Revert "Further locking harmonizations for main components" a202a68cb3 is described below commit a202a68cb3d32c40e2f8886455777075e28887ef Author: remm AuthorDate: Thu Apr 4 16:03:58 2024 +0200 Revert "Further locking harmonizations for main components" This reverts commit 63eb105bf14fed5fdf29dc9171e46f73fae28128. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 5 +- 3 files changed, 47 insertions(+), 66 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index fd295cb52f..c15298a359 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -152,7 +152,6 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); -private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -666,30 +665,26 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -childrenLock.writeLock().lock(); -try { +synchronized (children) { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); +} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); -} -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); } -} finally { -childrenLock.writeLock().unlock(); +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } - } @@ -726,11 +721,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.get(name); -} finally { -childrenLock.readLock().unlock(); } } @@ -741,11 +733,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.values().toArray(new Container[0]); -} finally { -childrenLock.readLock().unlock(); } } @@ -772,40 +761,36 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } -childrenLock.writeLock().lock(); try { -try { -if (child.getState().isAvailable()) { -child.stop(); -} -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); +if (child.getState().isAvailable()) { +child.stop(); } +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); +} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if
(tomcat) branch 10.1.x updated: Revert "Further locking harmonizations for main components"
This is an automated email from the ASF dual-hosted git repository. remm 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 7ee8ca1f0e Revert "Further locking harmonizations for main components" 7ee8ca1f0e is described below commit 7ee8ca1f0ea6a0984aba1ecf34b24f717886f329 Author: remm AuthorDate: Thu Apr 4 16:03:33 2024 +0200 Revert "Further locking harmonizations for main components" This reverts commit b241b08c9d5b92a183eb686886e8c5bbed9b9835. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 7 +- 3 files changed, 48 insertions(+), 67 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index fd295cb52f..c15298a359 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -152,7 +152,6 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); -private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -666,30 +665,26 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -childrenLock.writeLock().lock(); -try { +synchronized (children) { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); +} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); -} -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); } -} finally { -childrenLock.writeLock().unlock(); +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } - } @@ -726,11 +721,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.get(name); -} finally { -childrenLock.readLock().unlock(); } } @@ -741,11 +733,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.values().toArray(new Container[0]); -} finally { -childrenLock.readLock().unlock(); } } @@ -772,40 +761,36 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } -childrenLock.writeLock().lock(); try { -try { -if (child.getState().isAvailable()) { -child.stop(); -} -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); +if (child.getState().isAvailable()) { +child.stop(); } +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); +} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if
(tomcat) branch main updated: Revert "Further locking harmonizations for main components"
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new cf05b38e5e Revert "Further locking harmonizations for main components" cf05b38e5e is described below commit cf05b38e5ede77bc46ca02128b8a1fe0d0168494 Author: remm AuthorDate: Thu Apr 4 16:02:45 2024 +0200 Revert "Further locking harmonizations for main components" This reverts commit fba89a6f05223768e7d7026cd886d7f8356d. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 5 +- 3 files changed, 47 insertions(+), 66 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index 846f4e27d8..4edd4edf9d 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -129,7 +129,6 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); -private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -633,30 +632,26 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -childrenLock.writeLock().lock(); -try { +synchronized (children) { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); +} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); -} -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); } -} finally { -childrenLock.writeLock().unlock(); +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } - } @@ -693,11 +688,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.get(name); -} finally { -childrenLock.readLock().unlock(); } } @@ -708,11 +700,8 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -childrenLock.readLock().lock(); -try { +synchronized (children) { return children.values().toArray(new Container[0]); -} finally { -childrenLock.readLock().unlock(); } } @@ -739,40 +728,36 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } -childrenLock.writeLock().lock(); try { -try { -if (child.getState().isAvailable()) { -child.stop(); -} -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); +if (child.getState().isAvailable()) { +child.stop(); } +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); +} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if
Re: (tomcat) branch main updated: Further locking harmonizations for main components
чт, 4 апр. 2024 г. в 15:45, : > > This is an automated email from the ASF dual-hosted git repository. > > remm pushed a commit to branch main > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > The following commit(s) were added to refs/heads/main by this push: > new fba89a Further locking harmonizations for main components > fba89a is described below > > commit fba89a6f05223768e7d7026cd886d7f8356d > Author: remm > AuthorDate: Thu Apr 4 14:43:02 2024 +0200 > > Further locking harmonizations for main components > > Also for lifecycle operations. > --- > java/org/apache/catalina/core/ContainerBase.java | 86 > +- > java/org/apache/catalina/core/StandardService.java | 22 +++--- > webapps/docs/changelog.xml | 5 +- > 3 files changed, 66 insertions(+), 47 deletions(-) > > diff --git a/java/org/apache/catalina/core/ContainerBase.java > b/java/org/apache/catalina/core/ContainerBase.java > index 4edd4edf9d..846f4e27d8 100644 > --- a/java/org/apache/catalina/core/ContainerBase.java > +++ b/java/org/apache/catalina/core/ContainerBase.java > @@ -129,6 +129,7 @@ public abstract class ContainerBase extends > LifecycleMBeanBase implements Contai > * The child Containers belonging to this Container, keyed by name. > */ > protected final HashMap children = new HashMap<>(); > +private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); It is useless to have the above "children" field as protected. Nobody will be able to access it in a safe manner, because they have no access to childrenLock. > @@ -632,26 +633,30 @@ public abstract class ContainerBase extends > LifecycleMBeanBase implements Contai > log.debug(sm.getString("containerBase.child.add", child, this)); > } > > -synchronized (children) { > +childrenLock.writeLock().lock(); > +try { > if (children.get(child.getName()) != null) { > throw new > IllegalArgumentException(sm.getString("containerBase.child.notUnique", > child.getName())); > } > child.setParent(this); // May throw IAE > children.put(child.getName(), child); > -} Change of behaviour! The old sync block ended with the "}" above. > -fireContainerEvent(ADD_CHILD_EVENT, child); > +fireContainerEvent(ADD_CHILD_EVENT, child); > > -// Start child > -// Don't do this inside sync block - start can be a slow process and > -// locking the children object can cause problems elsewhere > -try { > -if ((getState().isAvailable() || > LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { > -child.start(); > +// Start child > +// Don't do this inside sync block - start can be a slow process > and The above says "Don't do this inside sync block", but your change puts it into a sync block. (And I see similar changes of behaviour further in this commit.) The lock was intended to protect changes of the "children" hash table, but now it starts to protect a) state changes of those children (start/stop/destroy) b) notifications. I think that the state changes (in LifecycleBase) already have their own protection. While stating/stopping/destroying is in progress, that child still remains ours and findChildren() etc. should be allowed to be called by other threads. A write lock prevents other threads from reading the value. https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html Thus I am -1. I think it is easier to revert and work on a new patch rather than try to amend this one. > +// locking the children object can cause problems elsewhere > +try { > +if ((getState().isAvailable() || > LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { > +child.start(); > +} > +} catch (LifecycleException e) { > +throw new > IllegalStateException(sm.getString("containerBase.child.start"), e); > } > -} catch (LifecycleException e) { > -throw new > IllegalStateException(sm.getString("containerBase.child.start"), e); > +} finally { > +childrenLock.writeLock().unlock(); > } > + > } > > > @@ -688,8 +693,11 @@ public abstract class ContainerBase extends > LifecycleMBeanBase implements Contai > if (name == null) { > return null; > } > -synchronized (children) { > +childrenLock.readLock().lock(); > +try { > return children.get(name); > +} finally { > +childrenLock.readLock().unlock(); > } > } > > @@ -700,8 +708,11 @@ public abstract class ContainerBase extends > LifecycleMBeanBase implements Contai > */ > @Override > public
(tomcat) branch 9.0.x updated: Further locking harmonizations for main components
This is an automated email from the ASF dual-hosted git repository. remm 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 63eb105bf1 Further locking harmonizations for main components 63eb105bf1 is described below commit 63eb105bf14fed5fdf29dc9171e46f73fae28128 Author: remm AuthorDate: Thu Apr 4 14:43:02 2024 +0200 Further locking harmonizations for main components Also for lifecycle operations. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 5 +- 3 files changed, 66 insertions(+), 47 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index c15298a359..fd295cb52f 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -152,6 +152,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); +private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -665,26 +666,30 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -synchronized (children) { +childrenLock.writeLock().lock(); +try { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); -} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); +} +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +} finally { +childrenLock.writeLock().unlock(); } + } @@ -721,8 +726,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.get(name); +} finally { +childrenLock.readLock().unlock(); } } @@ -733,8 +741,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.values().toArray(new Container[0]); +} finally { +childrenLock.readLock().unlock(); } } @@ -761,36 +772,40 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } +childrenLock.writeLock().lock(); try { -if (child.getState().isAvailable()) { -child.stop(); +try { +if (child.getState().isAvailable()) { +child.stop(); +} +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); } -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); -} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if (!LifecycleState.DESTROYING.equals(child.getState())) { -
(tomcat) branch 10.1.x updated: Further locking harmonizations for main components
This is an automated email from the ASF dual-hosted git repository. remm 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 b241b08c9d Further locking harmonizations for main components b241b08c9d is described below commit b241b08c9d5b92a183eb686886e8c5bbed9b9835 Author: remm AuthorDate: Thu Apr 4 14:43:02 2024 +0200 Further locking harmonizations for main components Also for lifecycle operations. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 7 +- 3 files changed, 67 insertions(+), 48 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index c15298a359..fd295cb52f 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -152,6 +152,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); +private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -665,26 +666,30 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -synchronized (children) { +childrenLock.writeLock().lock(); +try { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); -} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); +} +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +} finally { +childrenLock.writeLock().unlock(); } + } @@ -721,8 +726,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.get(name); +} finally { +childrenLock.readLock().unlock(); } } @@ -733,8 +741,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.values().toArray(new Container[0]); +} finally { +childrenLock.readLock().unlock(); } } @@ -761,36 +772,40 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } +childrenLock.writeLock().lock(); try { -if (child.getState().isAvailable()) { -child.stop(); +try { +if (child.getState().isAvailable()) { +child.stop(); +} +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); } -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); -} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if (!LifecycleState.DESTROYING.equals(child.getState())) { -
(tomcat) branch main updated: Further locking harmonizations for main components
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new fba89a Further locking harmonizations for main components fba89a is described below commit fba89a6f05223768e7d7026cd886d7f8356d Author: remm AuthorDate: Thu Apr 4 14:43:02 2024 +0200 Further locking harmonizations for main components Also for lifecycle operations. --- java/org/apache/catalina/core/ContainerBase.java | 86 +- java/org/apache/catalina/core/StandardService.java | 22 +++--- webapps/docs/changelog.xml | 5 +- 3 files changed, 66 insertions(+), 47 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index 4edd4edf9d..846f4e27d8 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -129,6 +129,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai * The child Containers belonging to this Container, keyed by name. */ protected final HashMap children = new HashMap<>(); +private final ReadWriteLock childrenLock = new ReentrantReadWriteLock(); /** @@ -632,26 +633,30 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai log.debug(sm.getString("containerBase.child.add", child, this)); } -synchronized (children) { +childrenLock.writeLock().lock(); +try { if (children.get(child.getName()) != null) { throw new IllegalArgumentException(sm.getString("containerBase.child.notUnique", child.getName())); } child.setParent(this); // May throw IAE children.put(child.getName(), child); -} -fireContainerEvent(ADD_CHILD_EVENT, child); +fireContainerEvent(ADD_CHILD_EVENT, child); -// Start child -// Don't do this inside sync block - start can be a slow process and -// locking the children object can cause problems elsewhere -try { -if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { -child.start(); +// Start child +// Don't do this inside sync block - start can be a slow process and +// locking the children object can cause problems elsewhere +try { +if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { +child.start(); +} +} catch (LifecycleException e) { +throw new IllegalStateException(sm.getString("containerBase.child.start"), e); } -} catch (LifecycleException e) { -throw new IllegalStateException(sm.getString("containerBase.child.start"), e); +} finally { +childrenLock.writeLock().unlock(); } + } @@ -688,8 +693,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai if (name == null) { return null; } -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.get(name); +} finally { +childrenLock.readLock().unlock(); } } @@ -700,8 +708,11 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai */ @Override public Container[] findChildren() { -synchronized (children) { +childrenLock.readLock().lock(); +try { return children.values().toArray(new Container[0]); +} finally { +childrenLock.readLock().unlock(); } } @@ -728,36 +739,40 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai return; } +childrenLock.writeLock().lock(); try { -if (child.getState().isAvailable()) { -child.stop(); +try { +if (child.getState().isAvailable()) { +child.stop(); +} +} catch (LifecycleException e) { +log.error(sm.getString("containerBase.child.stop"), e); } -} catch (LifecycleException e) { -log.error(sm.getString("containerBase.child.stop"), e); -} -boolean destroy = false; -try { -// child.destroy() may have already been called which would have -// triggered this call. If that is the case, no need to destroy the -// child again. -if (!LifecycleState.DESTROYING.equals(child.getState())) { -
(tomcat) branch 10.1.x updated: Update merge info. FileUpload was manually synchronized with 1.x.
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 907906b83a Update merge info. FileUpload was manually synchronized with 1.x. 907906b83a is described below commit 907906b83ad60eb7fc561f9d73e7b87445c18fd5 Author: Mark Thomas AuthorDate: Thu Apr 4 13:06:19 2024 +0100 Update merge info. FileUpload was manually synchronized with 1.x. --- MERGE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MERGE.txt b/MERGE.txt index 8404019433..c3e81ab842 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -51,10 +51,11 @@ Note: Only classes required for Base64 encoding/decoding. The rest are removed. FileUpload -- Unused code is removed +Branch: 1.x Sub-tree: src/main/java/org/apache/commons/fileupload2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: -34eb241c051b02eca3b0b1b04f67b3b4e6c3a24d (2023-01-03) +7a8c3241cfa8d036452cd4fc3f92d57cff189bca (2023-09-16) Note: Tomcat's copy of fileupload also includes classes copied manually from Commons IO. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Update merge info. FileUpload was manually synchronized with 1.x.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 3c22524516 Update merge info. FileUpload was manually synchronized with 1.x. 3c22524516 is described below commit 3c225245161c5481aeb5eda4d1d77fa434bab3ac Author: Mark Thomas AuthorDate: Thu Apr 4 13:06:19 2024 +0100 Update merge info. FileUpload was manually synchronized with 1.x. --- MERGE.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MERGE.txt b/MERGE.txt index 8404019433..c3e81ab842 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -51,10 +51,11 @@ Note: Only classes required for Base64 encoding/decoding. The rest are removed. FileUpload -- Unused code is removed +Branch: 1.x Sub-tree: src/main/java/org/apache/commons/fileupload2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: -34eb241c051b02eca3b0b1b04f67b3b4e6c3a24d (2023-01-03) +7a8c3241cfa8d036452cd4fc3f92d57cff189bca (2023-09-16) Note: Tomcat's copy of fileupload also includes classes copied manually from Commons IO. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 10.1.x updated: Align with Commons File Upload 1.x and make @since tags project specific
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 047d00304b Align with Commons File Upload 1.x and make @since tags project specific 047d00304b is described below commit 047d00304b60656d32173b4c80182116c31d6838 Author: Mark Thomas AuthorDate: Thu Apr 4 12:48:27 2024 +0100 Align with Commons File Upload 1.x and make @since tags project specific --- java/org/apache/tomcat/util/http/fileupload/FileItem.java | 2 +- .../tomcat/util/http/fileupload/FileItemHeaders.java | 2 +- .../util/http/fileupload/FileItemHeadersSupport.java | 2 +- java/org/apache/tomcat/util/http/fileupload/FileUtils.java | 4 ++-- java/org/apache/tomcat/util/http/fileupload/IOUtils.java | 14 +++--- .../tomcat/util/http/fileupload/MultipartStream.java | 3 +-- .../apache/tomcat/util/http/fileupload/RequestContext.java | 2 +- .../apache/tomcat/util/http/fileupload/UploadContext.java | 4 ++-- .../tomcat/util/http/fileupload/disk/DiskFileItem.java | 2 +- .../util/http/fileupload/disk/DiskFileItemFactory.java | 2 +- .../http/fileupload/impl/InvalidContentTypeException.java | 2 +- .../tomcat/util/http/fileupload/impl/SizeException.java| 4 ++-- .../http/fileupload/servlet/ServletRequestContext.java | 2 +- .../util/http/fileupload/util/FileItemHeadersImpl.java | 2 +- .../tomcat/util/http/fileupload/util/mime/MimeUtility.java | 2 +- .../util/http/fileupload/util/mime/ParseException.java | 2 +- .../http/fileupload/util/mime/QuotedPrintableDecoder.java | 2 +- 17 files changed, 26 insertions(+), 27 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItem.java b/java/org/apache/tomcat/util/http/fileupload/FileItem.java index d1e0523f12..e6f035fc7b 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItem.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItem.java @@ -43,7 +43,7 @@ import java.io.UnsupportedEncodingException; * implementation of this interface to also implement * {@code javax.activation.DataSource} with minimal additional work. * - * @since 1.3 additionally implements FileItemHeadersSupport + * @since FileUpload 1.3 additionally implements FileItemHeadersSupport */ public interface FileItem extends FileItemHeadersSupport { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java index bcfd40c588..890f4397ae 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java @@ -23,7 +23,7 @@ import java.util.Iterator; * item that was received within a {@code multipart/form-data} POST * request. * - * @since 1.2.1 + * @since FileUpload 1.2.1 */ public interface FileItemHeaders { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java index 3e98dbb2f0..e5858c7177 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java @@ -20,7 +20,7 @@ package org.apache.tomcat.util.http.fileupload; * Interface that will indicate that {@link FileItem} or {@link FileItemStream} * implementations will accept the headers read for the item. * - * @since 1.2.1 + * @since FileUpload 1.2.1 * * @see FileItem * @see FileItemStream diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java index 53e0489cf7..a325fb62a6 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java @@ -258,7 +258,7 @@ public class FileUtils { * @param file file with parent to create, must not be {@code null} * @throws NullPointerException if the file is {@code null} * @throws IOException if the parent directory cannot be created - * @since 2.5 + * @since IO 2.5 */ public static void forceMkdirParent(final File file) throws IOException { final File parent = file.getParentFile(); @@ -282,7 +282,7 @@ public class FileUtils { * @param file the file to check * @return true if the file is a Symbolic Link * @throws IOException if an IO error occurs while checking the file - * @since 2.0 + * @since IO 2.0 */ public static boolean isSymlink(File file) throws IOException { if (file == null) { diff --git a/java/org/apache/tomcat/util/http/fileupload/IOUtils.java b/java/org/apache/tomcat/util/http/fileupload/IOUtils.java index 069b0aeb00..0941653ebd 100644 ---
(tomcat) branch main updated: Align with Commons File Upload 1.x and make @since tags project specific
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/main by this push: new 6e0385bb59 Align with Commons File Upload 1.x and make @since tags project specific 6e0385bb59 is described below commit 6e0385bb59d457cacfa7fb63ad44ef5e45a86351 Author: Mark Thomas AuthorDate: Thu Apr 4 12:48:27 2024 +0100 Align with Commons File Upload 1.x and make @since tags project specific --- java/org/apache/tomcat/util/http/fileupload/FileItem.java | 2 +- .../tomcat/util/http/fileupload/FileItemHeaders.java | 2 +- .../util/http/fileupload/FileItemHeadersSupport.java | 2 +- java/org/apache/tomcat/util/http/fileupload/FileUtils.java | 4 ++-- java/org/apache/tomcat/util/http/fileupload/IOUtils.java | 14 +++--- .../tomcat/util/http/fileupload/MultipartStream.java | 3 +-- .../apache/tomcat/util/http/fileupload/RequestContext.java | 2 +- .../apache/tomcat/util/http/fileupload/UploadContext.java | 4 ++-- .../tomcat/util/http/fileupload/disk/DiskFileItem.java | 2 +- .../util/http/fileupload/disk/DiskFileItemFactory.java | 2 +- .../http/fileupload/impl/InvalidContentTypeException.java | 2 +- .../tomcat/util/http/fileupload/impl/SizeException.java| 4 ++-- .../http/fileupload/servlet/ServletRequestContext.java | 2 +- .../util/http/fileupload/util/FileItemHeadersImpl.java | 2 +- .../tomcat/util/http/fileupload/util/mime/MimeUtility.java | 2 +- .../util/http/fileupload/util/mime/ParseException.java | 2 +- .../http/fileupload/util/mime/QuotedPrintableDecoder.java | 2 +- 17 files changed, 26 insertions(+), 27 deletions(-) diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItem.java b/java/org/apache/tomcat/util/http/fileupload/FileItem.java index d1e0523f12..e6f035fc7b 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItem.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItem.java @@ -43,7 +43,7 @@ import java.io.UnsupportedEncodingException; * implementation of this interface to also implement * {@code javax.activation.DataSource} with minimal additional work. * - * @since 1.3 additionally implements FileItemHeadersSupport + * @since FileUpload 1.3 additionally implements FileItemHeadersSupport */ public interface FileItem extends FileItemHeadersSupport { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java index bcfd40c588..890f4397ae 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java @@ -23,7 +23,7 @@ import java.util.Iterator; * item that was received within a {@code multipart/form-data} POST * request. * - * @since 1.2.1 + * @since FileUpload 1.2.1 */ public interface FileItemHeaders { diff --git a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java index 3e98dbb2f0..e5858c7177 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileItemHeadersSupport.java @@ -20,7 +20,7 @@ package org.apache.tomcat.util.http.fileupload; * Interface that will indicate that {@link FileItem} or {@link FileItemStream} * implementations will accept the headers read for the item. * - * @since 1.2.1 + * @since FileUpload 1.2.1 * * @see FileItem * @see FileItemStream diff --git a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java index 53e0489cf7..a325fb62a6 100644 --- a/java/org/apache/tomcat/util/http/fileupload/FileUtils.java +++ b/java/org/apache/tomcat/util/http/fileupload/FileUtils.java @@ -258,7 +258,7 @@ public class FileUtils { * @param file file with parent to create, must not be {@code null} * @throws NullPointerException if the file is {@code null} * @throws IOException if the parent directory cannot be created - * @since 2.5 + * @since IO 2.5 */ public static void forceMkdirParent(final File file) throws IOException { final File parent = file.getParentFile(); @@ -282,7 +282,7 @@ public class FileUtils { * @param file the file to check * @return true if the file is a Symbolic Link * @throws IOException if an IO error occurs while checking the file - * @since 2.0 + * @since IO 2.0 */ public static boolean isSymlink(File file) throws IOException { if (file == null) { diff --git a/java/org/apache/tomcat/util/http/fileupload/IOUtils.java b/java/org/apache/tomcat/util/http/fileupload/IOUtils.java index 069b0aeb00..0941653ebd 100644 ---
[Bug 68858] version.sh only working if tomcat is stopped
https://bz.apache.org/bugzilla/show_bug.cgi?id=68858 --- Comment #2 from Stephan Weintritt --- Thank you for your help. I just did not see prometheus in the stacktrace. Sorry. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68858] version.sh only working if tomcat is stopped
https://bz.apache.org/bugzilla/show_bug.cgi?id=68858 Konstantin Kolinko changed: What|Removed |Added Resolution|--- |INVALID Status|NEW |RESOLVED --- Comment #1 from Konstantin Kolinko --- In your stack trace: Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:461) at sun.nio.ch.Net.bind(Net.java:453) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) at sun.net.httpserver.ServerImpl.(ServerImpl.java:141) at sun.net.httpserver.HttpServerImpl.(HttpServerImpl.java:50) at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35) at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130) at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer$Builder.build(HTTPServer.java:365) at io.prometheus.jmx.common.http.HTTPServerFactory.createHTTPServer(HTTPServerFactory.java:123) at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:60) ... 6 more There is no Tomcat code involved here. Some thing "io.prometheus.jmx.JavaAgent" starts its own web server (or backdoor?) and fails due to one already have been started. In the following lines where does that "-javaagent" argument come from?: FATAL ERROR in native method: processing of -javaagent failed /opt/tomcat/bin/catalina.sh: line 659: 2368874 Aborted (core dumped) "/usr/lib/jvm/jre-1.8.0-openjdk/bin/java" -Xms2048M -Xmx2048M -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:/dev/./urandom -javaagent:/opt/jmx_exporter/jmx_exporter-0.20.0.jar=9404:/opt/jmx_exporter/jmx_exporter.yaml - If you really need the javaagent when staring Tomcat, create a setenv.sh file and put the value into CATALINA_OPTS environment variable instead of JAVA_OPTS one. (Read RUNNING.txt for more details about setenv.sh file. Environment variables recognized by Tomcat startup scripts are documented in a comment at the top of the catalina.sh file.) I am resolving this issue as INVALID. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 68858] New: version.sh only working if tomcat is stopped
https://bz.apache.org/bugzilla/show_bug.cgi?id=68858 Bug ID: 68858 Summary: version.sh only working if tomcat is stopped Product: Tomcat 9 Version: 9.0.86 Hardware: PC OS: Linux Status: NEW Severity: minor Priority: P2 Component: Util Assignee: dev@tomcat.apache.org Reporter: stephan.weintr...@gmail.com Target Milestone: - version.sh only shows the version if, the server is stopped: $ /opt/tomcat/bin/version.sh Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:/usr/lib/jvm/jre-1.8.0-openjdk Using CLASSPATH: /opt/tomcat/log4j2/lib/*:/opt/tomcat/log4j2/conf:/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Using CATALINA_OPTS:-Djava.awt.headless=true -server -XX:+UseParallelGC Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:386) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:401) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:461) at sun.nio.ch.Net.bind(Net.java:453) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) at sun.net.httpserver.ServerImpl.(ServerImpl.java:141) at sun.net.httpserver.HttpServerImpl.(HttpServerImpl.java:50) at sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35) at com.sun.net.httpserver.HttpServer.create(HttpServer.java:130) at io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer$Builder.build(HTTPServer.java:365) at io.prometheus.jmx.common.http.HTTPServerFactory.createHTTPServer(HTTPServerFactory.java:123) at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:60) ... 6 more FATAL ERROR in native method: processing of -javaagent failed /opt/tomcat/bin/catalina.sh: line 659: 2368874 Aborted (core dumped) "/usr/lib/jvm/jre-1.8.0-openjdk/bin/java" -Xms2048M -Xmx2048M -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:/dev/./urandom -javaagent:/opt/jmx_exporter/jmx_exporter-0.20.0.jar=9404:/opt/jmx_exporter/jmx_exporter.yaml -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 -classpath "/opt/tomcat/lib/catalina.jar" org.apache.catalina.util.ServerInfo $ sudo systemctl stop tomcat.service $ /opt/tomcat/bin/version.sh Using CATALINA_BASE: /opt/tomcat Using CATALINA_HOME: /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:/usr/lib/jvm/jre-1.8.0-openjdk Using CLASSPATH: /opt/tomcat/log4j2/lib/*:/opt/tomcat/log4j2/conf:/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Using CATALINA_OPTS:-Djava.awt.headless=true -server -XX:+UseParallelGC Server version: Apache Tomcat/9.0.86 Server built: Feb 14 2024 08:15:12 UTC Server number: 9.0.86.0 OS Name:Linux OS Version: 5.14.0-362.24.1.el9_3.x86_64 Architecture: amd64 JVM Version:1.8.0_402-b06 JVM Vendor: Red Hat, Inc. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org