(tomcat) branch 9.0.x updated: Revert "Further locking harmonizations for main components"

2024-04-04 Thread remm
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 9.0.x updated: Revert compression refactoring

2023-10-11 Thread remm
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 ca29f6d8fd Revert compression refactoring
ca29f6d8fd is described below

commit ca29f6d8fdaf0a75b1d283405b92324c3c5dfa04
Author: remm 
AuthorDate: Wed Oct 11 09:41:14 2023 +0200

Revert compression refactoring

BZ 67670
Add test case to verify content-length is not present when using the
connector compression (also that checks DefaultServlet is working with
it).
---
 java/org/apache/coyote/http11/Http11Processor.java | 13 +---
 .../catalina/servlets/TestDefaultServlet.java  | 38 ++
 webapps/docs/changelog.xml |  8 +
 3 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 6b88365dbd..d3bc2a8f37 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -914,6 +914,12 @@ public class Http11Processor extends AbstractProcessor {
 prepareSendfile(outputFilters);
 }
 
+// Check for compression
+boolean useCompression = false;
+if (entityBody && sendfileData == null) {
+useCompression = protocol.useCompression(request, response);
+}
+
 MimeHeaders headers = response.getMimeHeaders();
 // A SC_NO_CONTENT response may include entity headers
 if (entityBody || statusCode == HttpServletResponse.SC_NO_CONTENT) {
@@ -950,11 +956,8 @@ public class Http11Processor extends AbstractProcessor {
 }
 }
 
-// Check for compression
-if (entityBody && sendfileData == null) {
-if (protocol.useCompression(request, response)) {
-
outputBuffer.addActiveFilter(outputFilters[Constants.GZIP_FILTER]);
-}
+if (useCompression) {
+outputBuffer.addActiveFilter(outputFilters[Constants.GZIP_FILTER]);
 }
 
 // Add date header unless application has already set one (e.g. in a
diff --git a/test/org/apache/catalina/servlets/TestDefaultServlet.java 
b/test/org/apache/catalina/servlets/TestDefaultServlet.java
index a3fdc0904c..889f7909c6 100644
--- a/test/org/apache/catalina/servlets/TestDefaultServlet.java
+++ b/test/org/apache/catalina/servlets/TestDefaultServlet.java
@@ -40,6 +40,7 @@ import org.apache.catalina.Wrapper;
 import org.apache.catalina.startup.SimpleHttpClient;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.coyote.http11.AbstractHttp11Protocol;
 import org.apache.tomcat.util.buf.ByteChunk;
 import org.apache.tomcat.util.descriptor.web.ErrorPage;
 import org.apache.tomcat.websocket.server.WsContextListener;
@@ -86,6 +87,43 @@ public class TestDefaultServlet extends TomcatBaseTest {
 
 }
 
+@Test
+public void testDefaultCompression() throws Exception {
+
+Tomcat tomcat = getTomcatInstance();
+((AbstractHttp11Protocol) 
tomcat.getConnector().getProtocolHandler()).setCompression("force");
+
+File appDir = new File("test/webapp");
+
+// app dir is relative to server home
+Context ctxt = tomcat.addContext("", appDir.getAbsolutePath());
+Wrapper defaultServlet = Tomcat.addServlet(ctxt, "default",
+"org.apache.catalina.servlets.DefaultServlet");
+defaultServlet.addInitParameter("fileEncoding", "ISO-8859-1");
+ctxt.addServletMappingDecoded("/", "default");
+
+ctxt.addMimeMapping("html", "text/html");
+
+tomcat.start();
+
+TestCompressedClient gzipClient = new TestCompressedClient(getPort());
+
+gzipClient.reset();
+gzipClient.setRequest(new String[] {
+"GET /index.html HTTP/1.1" + CRLF +
+"Host: localhost" + CRLF +
+"Connection: Close" + CRLF +
+"Accept-Encoding: gzip" + CRLF + CRLF });
+gzipClient.connect();
+gzipClient.processRequest();
+Assert.assertTrue(gzipClient.isResponse200());
+List responseHeaders = gzipClient.getResponseHeaders();
+Assert.assertTrue(responseHeaders.contains("Content-Encoding: gzip"));
+for (String header : responseHeaders) {
+Assert.assertFalse(header.startsWith("Content-Length: "));
+}
+}
+
 /*
  * Verify serving of gzipped resources from context root.
  */
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2d834a157b..23d01da0ce 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 
+  
+
+  
+67670: Fix regression with HTTP compression after code
+ 

[tomcat] branch 9.0.x updated: Revert "Bump OpenSSL version."

2023-05-30 Thread schultz
This is an automated email from the ASF dual-hosted git repository.

schultz 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 554eda4fa7 Revert "Bump OpenSSL version."
554eda4fa7 is described below

commit 554eda4fa7121bf0d17f78b1577b0b34b27aeff6
Author: Christopher Schultz 
AuthorDate: Tue May 30 13:15:25 2023 -0400

Revert "Bump OpenSSL version."

This reverts commit b666cc1a8cc03dfb213984167e3878bc5af3d4d1.
---
 build.properties.default | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.properties.default b/build.properties.default
index cac84e74ff..765ad173d9 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -163,7 +163,7 @@ 
jdt.loc.2=http://download.eclipse.org/eclipse/downloads/drops4/${jdt.release}/ec
 
 # - Tomcat native library -
 tomcat-native.version=1.2.36
-tomcat-native-openssl.version=1.1.1u
+tomcat-native-openssl.version=1.1.1t
 tomcat-native.src.checksum.enabled=true
 tomcat-native.src.checksum.algorithm=SHA-512
 
tomcat-native.src.checksum.value=ae89a872b8331035e01387665539a0c08096ae1abdb5dc7a25a197650a641ba3637f01437f1bee27b442c1c59c4d2fe2e5679d1595e8c5d121b9b219da2fb094


-
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: Revert "Clear SocketWrapper reference to help GC"

2023-05-20 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 02ea99c869 Revert "Clear SocketWrapper reference to help GC"
02ea99c869 is described below

commit 02ea99c86923c6ac544a5a9289bdc233c04e08f3
Author: lihan 
AuthorDate: Sun May 21 09:29:32 2023 +0800

Revert "Clear SocketWrapper reference to help GC"

This reverts commit 2cb6f8e4681359087a2a52b6950a315383a8d422.
---
 java/org/apache/coyote/AbstractProcessor.java  | 3 ---
 java/org/apache/coyote/http11/Http11Processor.java | 1 +
 java/org/apache/coyote/http2/StreamProcessor.java  | 6 +-
 java/org/apache/tomcat/util/net/Nio2Channel.java   | 1 -
 java/org/apache/tomcat/util/net/NioChannel.java| 1 -
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/AbstractProcessor.java 
b/java/org/apache/coyote/AbstractProcessor.java
index 0230a5d442..a49bc921cf 100644
--- a/java/org/apache/coyote/AbstractProcessor.java
+++ b/java/org/apache/coyote/AbstractProcessor.java
@@ -716,9 +716,6 @@ public abstract class AbstractProcessor extends 
AbstractProcessorLight implement
 public void recycle() {
 errorState = ErrorState.NONE;
 asyncStateMachine.recycle();
-// Clear fields that can be cleared to aid GC and trigger NPEs if this
-// is reused
-socketWrapper = null;
 }
 
 
diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 9070b9727c..aab2290407 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -1419,6 +1419,7 @@ public class Http11Processor extends AbstractProcessor {
 inputBuffer.recycle();
 outputBuffer.recycle();
 upgradeToken = null;
+socketWrapper = null;
 sendfileData = null;
 sslSupport = null;
 }
diff --git a/java/org/apache/coyote/http2/StreamProcessor.java 
b/java/org/apache/coyote/http2/StreamProcessor.java
index e1ed635e8d..fd1e011bea 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -391,8 +391,8 @@ class StreamProcessor extends AbstractProcessor {
 
 @Override
 public final void recycle() {
-super.recycle();
 // StreamProcessor instances are not re-used.
+
 // Calling removeRequestProcessor even though the RequestProcesser was
 // never added will add the values from the RequestProcessor to the
 // running total for the GlobalRequestProcessor
@@ -400,6 +400,10 @@ class StreamProcessor extends AbstractProcessor {
 if (global != null) {
 global.removeRequestProcessor(request.getRequestProcessor());
 }
+
+// Clear fields that can be cleared to aid GC and trigger NPEs if this
+// is reused
+setSocketWrapper(null);
 }
 
 
diff --git a/java/org/apache/tomcat/util/net/Nio2Channel.java 
b/java/org/apache/tomcat/util/net/Nio2Channel.java
index 6040b8855e..a2612fd0c1 100644
--- a/java/org/apache/tomcat/util/net/Nio2Channel.java
+++ b/java/org/apache/tomcat/util/net/Nio2Channel.java
@@ -79,7 +79,6 @@ public class Nio2Channel implements AsynchronousByteChannel {
 @Override
 public void close() throws IOException {
 sc.close();
-reset(this.sc, null);
 }
 
 
diff --git a/java/org/apache/tomcat/util/net/NioChannel.java 
b/java/org/apache/tomcat/util/net/NioChannel.java
index 777880d67d..8e3cb4f0e1 100644
--- a/java/org/apache/tomcat/util/net/NioChannel.java
+++ b/java/org/apache/tomcat/util/net/NioChannel.java
@@ -99,7 +99,6 @@ public class NioChannel implements ByteChannel, 
ScatteringByteChannel, Gathering
 @Override
 public void close() throws IOException {
 sc.close();
-reset(this.sc,null);
 }
 
 /**


-
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: Revert unintended change.

2023-03-14 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 5856dff3df Revert unintended change.
5856dff3df is described below

commit 5856dff3df93a322a7e3f7568557a5e87ddc643f
Author: Mark Thomas 
AuthorDate: Tue Mar 14 19:31:31 2023 +

Revert unintended change.

This was me testing things and I failed to revert this change before
committing.
---
 java/org/apache/catalina/startup/Tomcat.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/startup/Tomcat.java 
b/java/org/apache/catalina/startup/Tomcat.java
index 779ab28873..e43f4095d8 100644
--- a/java/org/apache/catalina/startup/Tomcat.java
+++ b/java/org/apache/catalina/startup/Tomcat.java
@@ -1258,7 +1258,7 @@ public class Tomcat {
 }
 
 protected URL getWebappConfigFile(String path, String contextName) {
-File docBase = new File(server.getCatalinaBase(), path);
+File docBase = new File(path);
 if (docBase.isDirectory()) {
 return getWebappConfigFileFromDirectory(docBase, contextName);
 } else {


-
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: Revert "Align with spec"

2023-03-06 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 1f81fd0367 Revert "Align with spec"
1f81fd0367 is described below

commit 1f81fd0367cd2a304873d5290e54dfbd2be447e7
Author: lihan 
AuthorDate: Tue Mar 7 15:22:39 2023 +0800

Revert "Align with spec"

This reverts commit e6cb59c0
---
 java/javax/servlet/http/HttpFilter.java | 130 +++-
 1 file changed, 44 insertions(+), 86 deletions(-)

diff --git a/java/javax/servlet/http/HttpFilter.java 
b/java/javax/servlet/http/HttpFilter.java
index f9b37eb635..40394a6343 100644
--- a/java/javax/servlet/http/HttpFilter.java
+++ b/java/javax/servlet/http/HttpFilter.java
@@ -25,105 +25,63 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
 /**
- *
- * 
- * Provides an abstract class to be subclassed to create an HTTP filter 
suitable for a Web site. A subclass of
- * HttpFilter should override
- * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain) }.
- * 
- *
- * 
- * Filters typically run on multithreaded servers, so be aware that a filter 
must handle concurrent requests and be
- * careful to synchronize access to shared resources. Shared resources include 
in-memory data such as instance or class
- * variables and external objects such as files, database connections, and 
network connections. See the
- * https://docs.oracle.com/javase/tutorial/essential/concurrency/;> 
Java Tutorial on Multithreaded
- * Programming for more information on handling multiple threads in a Java 
program.
- *
- * @author Various
- *
- * @since Servlet 4.0
+ * Provides a base class that implements the Filter interface and ensures that 
the Request and Response are of type
+ * HttpServletRequest and HttpServletResponse respectively.
  */
 public abstract class HttpFilter extends GenericFilter {
 
-private static final long serialVersionUID = 7478463438252262094L;
-
-/**
- * 
- * Does nothing, because this is an abstract class.
- * 
- *
- * @since Servlet 4.0
- */
-public HttpFilter() {
-}
+private static final long serialVersionUID = 1L;
 
 /**
+ * {@inheritDoc} This implementation tests the request and response to see 
if they are instances of
+ * {@link HttpServletRequest} and {@link HttpServletResponse} 
respectively. If they are then they are passed to
+ * {@link #doFilter(HttpServletRequest, HttpServletResponse, 
FilterChain)}. If not, a {@link ServletException} is
+ * thrown.
  *
- * 
- * The doFilter method of the Filter is called by the 
container each time a request/response pair is passed
- * through the chain due to a client request for a resource at the end of 
the chain. The FilterChain passed in to this
- * method allows the Filter to pass on the request and response to the 
next entity in the chain. There's no need to
- * override this method.
- * 
- *
- * 
- * The default implementation inspects the incoming {@code req} and {@code 
res} objects to determine if they are
- * instances of {@link HttpServletRequest} and {@link 
HttpServletResponse}, respectively. If not, a
- * {@link ServletException} is thrown. Otherwise, the protected
- * {@link #doFilter(javax.servlet.http.HttpServletRequest, 
javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)}
- * method is called.
- * 
- *
- * @param req a {@link ServletRequest} object that contains the request 
the client has made of the filter
- *
- * @param res a {@link ServletResponse} object that contains the response 
the filter sends to the client
- *
- * @param chain the FilterChain for invoking the next filter 
or the resource
- *
- * @throws IOException if an input or output error is detected when the 
filter handles the request
- *
- * @throws ServletException if the request for the could not be handled or 
either parameter is not an instance of the
- * respective {@link HttpServletRequest} or {@link HttpServletResponse}.
- *
- * @since Servlet 4.0
+ * @throws ServletException If either the request or response are not of 
the expected types or any other error
+ *  occurs
  */
 @Override
-public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
-throws IOException, ServletException {
-if (!(req instanceof HttpServletRequest && res instanceof 
HttpServletResponse)) {
-throw new ServletException("non-HTTP request or response");
+public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
+throws IOException, ServletException {
+if (!(request instanceof 

[tomcat] branch 9.0.x updated: Revert "Have 'pre-release' indicate the the release is in progress."

2023-03-01 Thread schultz
This is an automated email from the ASF dual-hosted git repository.

schultz 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 58f05a9534 Revert "Have 'pre-release' indicate the the release is in 
progress."
58f05a9534 is described below

commit 58f05a953482bd83eb95bb6bbaa29581e0876bca
Author: Christopher Schultz 
AuthorDate: Wed Mar 1 09:12:21 2023 -0500

Revert "Have 'pre-release' indicate the the release is in progress."

This reverts commit 626b48842ab68b0e55cbeffa7fb57241ddb849b2.
---
 build.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.xml b/build.xml
index 7300ae58ae..ef15f37441 100644
--- a/build.xml
+++ b/build.xml
@@ -2701,7 +2701,7 @@ asf.ldap.username=${release.asfusername}
 
+value="rtext=" />
   
 
   

[tomcat] branch 9.0.x updated: Revert TestAsyncContextImpl.

2023-02-10 Thread lihan
This is an automated email from the ASF dual-hosted git repository.

lihan 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 17e7c48348 Revert TestAsyncContextImpl.
17e7c48348 is described below

commit 17e7c483489ab25ad00262b93c5fb47235ee8754
Author: lihan 
AuthorDate: Fri Feb 10 17:24:03 2023 +0800

Revert TestAsyncContextImpl.
---
 test/org/apache/catalina/core/TestAsyncContextImpl.java | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/catalina/core/TestAsyncContextImpl.java 
b/test/org/apache/catalina/core/TestAsyncContextImpl.java
index 1066c51b02..1ce2eebb3e 100644
--- a/test/org/apache/catalina/core/TestAsyncContextImpl.java
+++ b/test/org/apache/catalina/core/TestAsyncContextImpl.java
@@ -1521,10 +1521,15 @@ public class TestAsyncContextImpl extends 
TomcatBaseTest {
 // Just for debugging
 async.setTimeout(10);
 
-try (ExecutorService executor = 
Executors.newSingleThreadExecutor()) {
-executor.submit(() -> async.dispatch("/ServletC"));
-executor.shutdown();
-}
+ExecutorService executor = Executors.newSingleThreadExecutor();
+executor.submit(new Runnable() {
+
+@Override
+public void run() {
+async.dispatch("/ServletC");
+}
+});
+executor.shutdown();
 }
 }
 


-
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: Revert accidental commit

2022-11-18 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 93d678369e Revert accidental commit
93d678369e is described below

commit 93d678369ee166fd238f628a8e59d0d4ecd2baea
Author: Mark Thomas 
AuthorDate: Fri Nov 18 15:51:43 2022 +

Revert accidental commit
---
 java/org/apache/coyote/http11/Http11Processor.java | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 83fbbf4e7c..3ed86daeb2 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -282,11 +282,11 @@ public class Http11Processor extends AbstractProcessor {
 // parse headers.
 prepareRequestProtocol();
 
-//if (protocol.isPaused()) {
-//// 503 - Service unavailable
-//response.setStatus(503);
-//setErrorState(ErrorState.CLOSE_CLEAN, null);
-//} else {
+if (protocol.isPaused()) {
+// 503 - Service unavailable
+response.setStatus(503);
+setErrorState(ErrorState.CLOSE_CLEAN, null);
+} else {
 keptAlive = true;
 // Set this every time in case limit has been changed via 
JMX
 
request.getMimeHeaders().setLimit(protocol.getMaxHeaderCount());
@@ -301,7 +301,7 @@ public class Http11Processor extends AbstractProcessor {
 if (!protocol.getDisableUploadTimeout()) {
 
socketWrapper.setReadTimeout(protocol.getConnectionUploadTimeout());
 }
-//}
+}
 } catch (IOException e) {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("http11processor.header.parse"), e);


-
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: Revert "Fix the typos in the XML schemas" due to license concerns

2022-09-28 Thread ebourg
This is an automated email from the ASF dual-hosted git repository.

ebourg 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 c4f80f968c Revert "Fix the typos in the XML schemas" due to license 
concerns
c4f80f968c is described below

commit c4f80f968c73b0552c7bc5edd8a9432e3630caeb
Author: Emmanuel Bourg 
AuthorDate: Wed Sep 28 16:09:45 2022 +0200

Revert "Fix the typos in the XML schemas" due to license concerns

This reverts commit 4cab8699492fbb0c79b61e0dc00469cf63b06ea1.
---
 java/javax/servlet/jsp/resources/jspxml.xsd | 2 +-
 java/javax/servlet/resources/javaee_web_services_1_2.xsd| 2 +-
 java/javax/servlet/resources/javaee_web_services_1_3.xsd| 2 +-
 java/javax/servlet/resources/javaee_web_services_1_4.xsd| 2 +-
 java/javax/servlet/resources/javaee_web_services_client_1_2.xsd | 2 +-
 java/javax/servlet/resources/javaee_web_services_client_1_3.xsd | 2 +-
 java/javax/servlet/resources/javaee_web_services_client_1_4.xsd | 2 +-
 java/javax/servlet/resources/web-app_3_0.xsd| 2 +-
 java/javax/servlet/resources/web-app_3_1.xsd| 2 +-
 java/javax/servlet/resources/web-app_4_0.xsd| 2 +-
 java/javax/servlet/resources/web-fragment_3_0.xsd   | 2 +-
 java/javax/servlet/resources/web-fragment_3_1.xsd   | 2 +-
 java/javax/servlet/resources/web-fragment_4_0.xsd   | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/java/javax/servlet/jsp/resources/jspxml.xsd 
b/java/javax/servlet/jsp/resources/jspxml.xsd
index 1634d208d9..0e5eba0b36 100644
--- a/java/javax/servlet/jsp/resources/jspxml.xsd
+++ b/java/javax/servlet/jsp/resources/jspxml.xsd
@@ -414,7 +414,7 @@
 jsp:useBean action or a custom action with an associated
 VariableInfo entry for this name.
 
-Exact valid combinations are not expressible in XML Schema.
+Exact valid combinations are not expressable in XML Schema.
 They are:
 
 name="Identifier" property="*"
diff --git a/java/javax/servlet/resources/javaee_web_services_1_2.xsd 
b/java/javax/servlet/resources/javaee_web_services_1_2.xsd
index ec5540dd6c..43914742ff 100644
--- a/java/javax/servlet/resources/javaee_web_services_1_2.xsd
+++ b/java/javax/servlet/resources/javaee_web_services_1_2.xsd
@@ -336,7 +336,7 @@
   com.wombat.empl.EmployeeService
 
   This may not be specified in case there is no Service
-  Endpoint Interface as is the case with directly using an
+  Enpoint Interface as is the case with directly using an
   implementation class with the @WebService annotation.
 
   When the port component is a Provider implementation
diff --git a/java/javax/servlet/resources/javaee_web_services_1_3.xsd 
b/java/javax/servlet/resources/javaee_web_services_1_3.xsd
index 71d4b33f73..d69d723e1d 100644
--- a/java/javax/servlet/resources/javaee_web_services_1_3.xsd
+++ b/java/javax/servlet/resources/javaee_web_services_1_3.xsd
@@ -332,7 +332,7 @@
   com.wombat.empl.EmployeeService
 
 This may not be specified in case there is no Service
-Endpoint Interface as is the case with directly using an
+Enpoint Interface as is the case with directly using an
 implementation class with the @WebService annotation.
 
 When the port component is a Provider implementation
diff --git a/java/javax/servlet/resources/javaee_web_services_1_4.xsd 
b/java/javax/servlet/resources/javaee_web_services_1_4.xsd
index 032e6b7492..e32c5b7d0c 100644
--- a/java/javax/servlet/resources/javaee_web_services_1_4.xsd
+++ b/java/javax/servlet/resources/javaee_web_services_1_4.xsd
@@ -332,7 +332,7 @@
   com.wombat.empl.EmployeeService
 
 This may not be specified in case there is no Service
-Endpoint Interface as is the case with directly using an
+Enpoint Interface as is the case with directly using an
 implementation class with the @WebService annotation.
 
 When the port component is a Provider implementation
diff --git a/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd 
b/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd
index e32af449b3..e95308a0a8 100644
--- a/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd
+++ b/java/javax/servlet/resources/javaee_web_services_client_1_2.xsd
@@ -260,7 +260,7 @@
   
 
 The service-qname element declares the specific WSDL service
-element that is being referred to.  It is not specified if no
+element that is being refered to.  It is not specified if no
 wsdl-file is declared.
 
   
diff --git 

[tomcat] branch 9.0.x updated: Revert the ja <-> Shift_JIS mapping

2022-04-28 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new da911ba1f3 Revert the ja <-> Shift_JIS mapping
da911ba1f3 is described below

commit da911ba1f348faee901a8ee0d37b363406fd4228
Author: Mark Thomas 
AuthorDate: Thu Apr 28 19:26:24 2022 +0100

Revert the ja <-> Shift_JIS mapping
---
 java/org/apache/catalina/util/CharsetMapperDefault.properties | 1 -
 webapps/docs/changelog.xml| 6 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/util/CharsetMapperDefault.properties 
b/java/org/apache/catalina/util/CharsetMapperDefault.properties
index d438bcf71e..6f8bf49493 100644
--- a/java/org/apache/catalina/util/CharsetMapperDefault.properties
+++ b/java/org/apache/catalina/util/CharsetMapperDefault.properties
@@ -15,4 +15,3 @@
 
 en=ISO-8859-1
 fr=ISO-8859-1
-ja=Shift_JIS
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1c602680ae..aa95b85ad0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -118,6 +118,12 @@
 retrieve a certificate DN, to match the output of the deprecated
 getSubjectDN().getName() that was used previously. (remm)
   
+  
+Revert the change in 9.0.59 that added a mapping of
+Shift_JIS for the ja locale to the default
+mappings used by ServletResponse.setLocale() as it
+caused regressions for applications using UTF-8. (markt)
+  
 
   
   


-
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: Revert "Temporary workaround for broken DigiCert ONE REST API"

2022-03-08 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 4cc304f  Revert "Temporary workaround for broken DigiCert ONE REST API"
4cc304f is described below

commit 4cc304f67736802ea140721eabdf14f68c36b822
Author: Mark Thomas 
AuthorDate: Tue Mar 8 16:42:46 2022 +

Revert "Temporary workaround for broken DigiCert ONE REST API"

This reverts commit 7c54e369e87f1eedd50e42f895c2b0cd058e30b8.
---
 build.properties.default | 12 ++--
 build.xml|  2 --
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index cf437c4..6f14d4b 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -81,19 +81,11 @@ gpg.exec=/path/to/gpg
 # Code signing of Windows installer
 # See https://infra.apache.org/digicert-use.html for setup instructions
 do.codesigning=false
-#codesigning.alias=Tomcat-PMC-cert-2021-11
+codesigning.alias=Tomcat-PMC-cert-2021-11
 codesigning.digest=SHA-512
-#codesigning.storetype=DIGICERTONE
+codesigning.storetype=DIGICERTONE
 # Set codesigning.storepass in build.properties with the following syntax
 #codesigning.storepass=|/path/to/Certificate_pkcs12.p12|
-# Once DigiCert fix the broken REST API
-# - Uncomment alias & storetype above
-# - Remove the four lines below
-# - Remove the keystore field from build.xml
-codesigning.keystore=${user.home}/.digicertone/pkcs11properties.cfg
-codesigning.storepass=NONE
-codesigning.storetype=PKCS11
-codesigning.alias=Tomcat-PMC-key-2021-11
 
 # - Settings to use when downloading files -
 trydownload.httpusecaches=true
diff --git a/build.xml b/build.xml
index 326d7b1..6e24ad4 100644
--- a/build.xml
+++ b/build.xml
@@ -2505,7 +2505,6 @@ skip.installer property in build.properties" />
   unless="skip.installer" 
depends="-installer-create-uninstaller,setup-jsign"
   if="${do.codesigning}">
 
   description="Builds and optionally signs the Windows installer"
   depends="-installer,setup-jsign" if="${do.codesigning}" >
 

[tomcat] branch 9.0.x updated: Revert "Fix BZ 65714 - previous fix was incomplete."

2021-12-09 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 9f0704c  Revert "Fix BZ 65714 - previous fix was incomplete."
9f0704c is described below

commit 9f0704c9a6b290c4bd975e5230ad78af7cc9526d
Author: Mark Thomas 
AuthorDate: Thu Dec 9 13:56:16 2021 +

Revert "Fix BZ 65714 - previous fix was incomplete."

This reverts commit e631f4455781d3054aab59749ab7d5a2ca00b00c.
---
 java/org/apache/catalina/security/SecurityClassLoad.java | 3 ---
 webapps/docs/changelog.xml   | 4 
 2 files changed, 7 deletions(-)

diff --git a/java/org/apache/catalina/security/SecurityClassLoad.java 
b/java/org/apache/catalina/security/SecurityClassLoad.java
index 452c2df..bf86414 100644
--- a/java/org/apache/catalina/security/SecurityClassLoad.java
+++ b/java/org/apache/catalina/security/SecurityClassLoad.java
@@ -190,9 +190,6 @@ public final class SecurityClassLoad {
 loader.loadClass(basePackage + 
"util.net.AprEndpoint$AprSocketWrapper$AprOperationState");
 loader.loadClass(basePackage + 
"util.net.NioEndpoint$NioSocketWrapper$NioOperationState");
 loader.loadClass(basePackage + 
"util.net.Nio2Endpoint$Nio2SocketWrapper$Nio2OperationState");
-loader.loadClass(basePackage + "util.net.SecureNio2Channel");
-loader.loadClass(basePackage + "util.net.SocketBufferHandler");
-loader.loadClass(basePackage + "util.net.SocketBufferHandler$1");
 loader.loadClass(basePackage + 
"util.net.SocketWrapperBase$BlockingMode");
 loader.loadClass(basePackage + 
"util.net.SocketWrapperBase$CompletionCheck");
 loader.loadClass(basePackage + 
"util.net.SocketWrapperBase$CompletionHandlerCall");
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ce0b5df..76786f5 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -112,10 +112,6 @@
 request includes a body. The maximum permitted size of the body is
 controlled by maxSavePostSize. (markt)
   
-  
-65714: The previous fix was incomplete. Fix additional 
issues
-when first using an NIO2 TLS enabled connector. (markt)
-  
 
   
   

-
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: Revert clean-up. definePackage always needs to be called.

2021-07-30 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 25d289b  Revert clean-up. definePackage always needs to be called.
25d289b is described below

commit 25d289ba53e5c514be854e78f777fc420c3b9d2f
Author: Mark Thomas 
AuthorDate: Fri Jul 30 08:20:28 2021 +0100

Revert clean-up. definePackage always needs to be called.
---
 .../catalina/loader/WebappClassLoaderBase.java | 68 --
 webapps/docs/changelog.xml | 10 +++-
 2 files changed, 46 insertions(+), 32 deletions(-)

diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java 
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 0d2bb7c..288d26e 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -2430,40 +2430,46 @@ public abstract class WebappClassLoaderBase extends 
URLClassLoader
 }
 }
 
-if (securityManager != null) {
-// Looking up the package
-int pos = name.lastIndexOf('.');
-if (pos != -1) {
-String packageName = name.substring(0, pos);
-Package pkg = getPackage(packageName);
-
-// Define the package (if null)
-if (pkg == null) {
-try {
-if (manifest == null) {
-definePackage(packageName, null, null, null, 
null, null, null, null);
-} else {
-definePackage(packageName, manifest, codeBase);
-}
-} catch (IllegalArgumentException e) {
-// Ignore: normal error due to dual definition of 
package
-}
-pkg = getPackage(packageName);
-}
+// Looking up the package
+String packageName = null;
+int pos = name.lastIndexOf('.');
+if (pos != -1) {
+packageName = name.substring(0, pos);
+}
+
+Package pkg = null;
 
-// Checking sealing
-if (pkg != null) {
-boolean sealCheck = true;
-if (pkg.isSealed()) {
-sealCheck = pkg.isSealed(codeBase);
+if (packageName != null) {
+pkg = getPackage(packageName);
+
+// Define the package (if null)
+if (pkg == null) {
+try {
+if (manifest == null) {
+definePackage(packageName, null, null, null, null, 
null, null, null);
 } else {
-sealCheck = (manifest == null) || 
!isPackageSealed(packageName, manifest);
-}
-if (!sealCheck) {
-throw new SecurityException
-("Sealing violation loading " + name + " : 
Package "
- + packageName + " is sealed.");
+definePackage(packageName, manifest, codeBase);
 }
+} catch (IllegalArgumentException e) {
+// Ignore: normal error due to dual definition of 
package
+}
+pkg = getPackage(packageName);
+}
+}
+
+if (securityManager != null) {
+// Checking sealing
+if (pkg != null) {
+boolean sealCheck = true;
+if (pkg.isSealed()) {
+sealCheck = pkg.isSealed(codeBase);
+} else {
+sealCheck = (manifest == null) || 
!isPackageSealed(packageName, manifest);
+}
+if (!sealCheck) {
+throw new SecurityException
+("Sealing violation loading " + name + " : Package 
"
+ + packageName + " is sealed.");
 }
 }
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3a3e3cd..b6a86b6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,8 +105,16 @@
   issues do not "pop up" wrt. others).
 -->
 
+  
+
+  
+Correct an error in some code clean-up that mean that web application
+classes were not configured with the correct package. (markt)
+  
+
+  
 
-
+
   
 
   

-
To 

[tomcat] branch 9.0.x updated: Revert "Remove unused file"

2021-06-25 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new d3d3365  Revert "Remove unused file"
d3d3365 is described below

commit d3d3365a43b92d751e0efc0014b6ea0401548e08
Author: Mark Thomas 
AuthorDate: Fri Jun 25 08:10:13 2021 +0100

Revert "Remove unused file"

This reverts commit 0dee371b82bf2ed18a7316430db8c25bdb3644e3.
---
 test/webapp/bug6/bug64872b-timeunit.jsp | 29 +
 1 file changed, 29 insertions(+)

diff --git a/test/webapp/bug6/bug64872b-timeunit.jsp 
b/test/webapp/bug6/bug64872b-timeunit.jsp
new file mode 100644
index 000..679925f
--- /dev/null
+++ b/test/webapp/bug6/bug64872b-timeunit.jsp
@@ -0,0 +1,29 @@
+<%--
+ 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.
+--%>
+<%@ taglib uri="http://tomcat.apache.org/tag-setters; prefix="ts" %>
+
+  Bug 64872b TimeUnit test case
+  
+  <%
+  for (int i=0; i < 10; i++) {
+  %>
+01 The value of foo is []
+  <%
+  }
+  %>
+  
+
\ No newline at end of file

-
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: Revert due to uncertainty about the behavior

2021-04-20 Thread remm
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 616d8a7  Revert due to uncertainty about the behavior
616d8a7 is described below

commit 616d8a736478083872819cf531039064b9914190
Author: remm 
AuthorDate: Tue Apr 20 20:49:01 2021 +0200

Revert due to uncertainty about the behavior
---
 java/org/apache/catalina/startup/ContextConfig.java | 7 +++
 webapps/docs/changelog.xml  | 4 
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/startup/ContextConfig.java 
b/java/org/apache/catalina/startup/ContextConfig.java
index 8018d70..8172a3b 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -2383,10 +2383,9 @@ public class ContextConfig implements LifecycleListener {
 return;
 }
 
-if ((javaClass.getAccessFlags()
-& (org.apache.tomcat.util.bcel.Const.ACC_ANNOTATION
-| org.apache.tomcat.util.bcel.Const.ACC_INTERFACE)) != 
0) {
-// Skip annotations or interfaces
+if ((javaClass.getAccessFlags() &
+org.apache.tomcat.util.bcel.Const.ACC_ANNOTATION) != 0) {
+// Skip annotations.
 return;
 }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index cbdbd8e..bf65ff6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,10 +129,6 @@
 resulting in one of the deployments failing and errors being reported.
 (markt)
   
-  
-65256: HandlesTypes class sets should not include
-interfaces. (remm)
-  
 
   
   

-
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: Revert stream memory footprint reduction and incomplete fixes

2020-09-08 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 7e26b57  Revert stream memory footprint reduction and incomplete fixes
7e26b57 is described below

commit 7e26b575f485413fca9a5491f081f509faf338b1
Author: Mark Thomas 
AuthorDate: Tue Sep 8 10:16:57 2020 +0100

Revert stream memory footprint reduction and incomplete fixes

Revert the changes due to the steady stream of regressions that are
being reported and.or found by the CI systems. A more robust solution is
required.
---
 java/org/apache/coyote/http2/Stream.java | 41 
 webapps/docs/changelog.xml   |  5 
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index b01ca01..c3139ab 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -300,19 +300,14 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 
 
 void doStreamCancel(String msg, Http2Error error) throws CloseNowException 
{
-// Avoid NPEs on duplicate cancellations
-StreamOutputBuffer streamOutputBuffer = this.streamOutputBuffer;
-Response coyoteResponse = this.coyoteResponse;
 StreamException se = new StreamException(msg, error, getIdAsInt());
-if (streamOutputBuffer != null && coyoteResponse != null) {
-// Prevent the application making further writes
-streamOutputBuffer.closed = true;
-// Prevent Tomcat's error handling trying to write
-coyoteResponse.setError();
-coyoteResponse.setErrorReported();
-// Trigger a reset once control returns to Tomcat
-streamOutputBuffer.reset = se;
-}
+// Prevent the application making further writes
+streamOutputBuffer.closed = true;
+// Prevent Tomcat's error handling trying to write
+coyoteResponse.setError();
+coyoteResponse.setErrorReported();
+// Trigger a reset once control returns to Tomcat
+streamOutputBuffer.reset = se;
 throw new CloseNowException(msg, se);
 }
 
@@ -475,12 +470,8 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 }
 
 if (headerState == HEADER_STATE_TRAILER) {
-// Avoid NPE if Stream has been closed on Stream specific 
thread
-Request coyoteRequest = this.coyoteRequest;
-if (coyoteRequest != null) {
-// HTTP/2 headers are already always lower case
-coyoteRequest.getTrailerFields().put(name, value);
-}
+// HTTP/2 headers are already always lower case
+coyoteRequest.getTrailerFields().put(name, value);
 } else {
 coyoteRequest.getMimeHeaders().addValue(name).setString(value);
 }
@@ -656,14 +647,9 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 
 
 final boolean isContentLengthInconsistent() {
-Request coyoteRequest = this.coyoteRequest;
-// May be null when processing trailer headers after stream has been
-// closed.
-if (coyoteRequest != null) {
-long contentLengthHeader = coyoteRequest.getContentLengthLong();
-if (contentLengthHeader > -1 && contentLengthReceived != 
contentLengthHeader) {
-return true;
-}
+long contentLengthHeader = coyoteRequest.getContentLengthLong();
+if (contentLengthHeader > -1 && contentLengthReceived != 
contentLengthHeader) {
+return true;
 }
 return false;
 }
@@ -765,12 +751,15 @@ class Stream extends AbstractStream implements 
HeaderEmitter {
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("stream.recycle", getConnectionId(), 
getIdentifier()));
 }
+/*
+ * Temporarily disabled due to multiple regressions (NPEs)
 coyoteRequest = null;
 cookieHeader = null;
 coyoteResponse = null;
 inputBuffer = null;
 streamOutputBuffer = null;
 http2OutputBuffer = null;
+*/
 }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index f9bcfd5..b835e53 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -172,6 +172,11 @@
 streams to account for DATA frames containing zero-length padding.
 (markt)
   
+  
+64710: Revert the changes to reduce the memory footprint of
+closed HTTP/2 streams as they triggered multiple regressions in the 
form
+of NullPointerExceptions. (markt)
+  
 
   
   



[tomcat] branch 9.0.x updated: Revert "Simpler way to determine Graal runtime"

2020-07-22 Thread fhanik
This is an automated email from the ASF dual-hosted git repository.

fhanik 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 87cbed1  Revert "Simpler way to determine Graal runtime"
87cbed1 is described below

commit 87cbed1244205fb112f421449482d02b56f6167b
Author: Filip Hanik 
AuthorDate: Wed Jul 22 11:40:14 2020 -0700

Revert "Simpler way to determine Graal runtime"

This reverts commit 6a73695fa6d024ed9fc4adeb32073cbd94309c51.

https://tomcat.markmail.org/search/?q=#query:%20list%3Aorg.apache.tomcat.dev+page:1+mid:7vo7ugmqjz2z7x5f+state:results
---
 java/org/apache/jasper/runtime/JspRuntimeLibrary.java | 16 +++-
 java/org/apache/naming/NamingContext.java | 15 ++-
 java/org/apache/tomcat/util/compat/GraalCompat.java   | 15 ++-
 3 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java 
b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
index d710f84..c0a7a63 100644
--- a/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
+++ b/java/org/apache/jasper/runtime/JspRuntimeLibrary.java
@@ -56,7 +56,21 @@ import org.apache.tomcat.InstanceManager;
  */
 public class JspRuntimeLibrary {
 
-public static final boolean GRAAL = 
System.getProperty("org.graalvm.nativeimage.imagecode") != null;
+public static final boolean GRAAL;
+
+static {
+boolean result = false;
+try {
+Class nativeImageClazz = 
Class.forName("org.graalvm.nativeimage.ImageInfo");
+result = nativeImageClazz.getMethod("inImageCode").invoke(null) != 
null;
+// Note: This will also be true for the Graal substrate VM
+} catch (ClassNotFoundException e) {
+// Must be Graal
+} catch (ReflectiveOperationException | IllegalArgumentException e) {
+// Should never happen
+}
+GRAAL = result;
+}
 
 /**
  * Returns the value of the javax.servlet.error.exception request
diff --git a/java/org/apache/naming/NamingContext.java 
b/java/org/apache/naming/NamingContext.java
index 40f4085..0471279 100644
--- a/java/org/apache/naming/NamingContext.java
+++ b/java/org/apache/naming/NamingContext.java
@@ -792,7 +792,20 @@ public class NamingContext implements Context {
 // -- Protected Methods
 
 
-private static final boolean GRAAL = 
System.getProperty("org.graalvm.nativeimage.imagecode") != null;
+private static final boolean GRAAL;
+
+static {
+boolean result = false;
+try {
+Class nativeImageClazz = 
Class.forName("org.graalvm.nativeimage.ImageInfo");
+result = 
Boolean.TRUE.equals(nativeImageClazz.getMethod("inImageCode").invoke(null));
+} catch (ClassNotFoundException e) {
+// Must be Graal
+} catch (ReflectiveOperationException | IllegalArgumentException e) {
+// Should never happen
+}
+GRAAL = result;
+}
 
 /**
  * Retrieves the named object.
diff --git a/java/org/apache/tomcat/util/compat/GraalCompat.java 
b/java/org/apache/tomcat/util/compat/GraalCompat.java
index e3cb09d..9fb835a 100644
--- a/java/org/apache/tomcat/util/compat/GraalCompat.java
+++ b/java/org/apache/tomcat/util/compat/GraalCompat.java
@@ -20,7 +20,20 @@ import java.io.IOException;
 
 class GraalCompat extends Jre9Compat {
 
-private static final boolean GRAAL = 
System.getProperty("org.graalvm.nativeimage.imagecode") != null;
+private static final boolean GRAAL;
+
+static {
+boolean result = false;
+try {
+Class nativeImageClazz = 
Class.forName("org.graalvm.nativeimage.ImageInfo");
+result = 
Boolean.TRUE.equals(nativeImageClazz.getMethod("inImageCode").invoke(null));
+} catch (ClassNotFoundException e) {
+// Must be Graal
+} catch (ReflectiveOperationException | IllegalArgumentException e) {
+// Should never happen
+}
+GRAAL = result;
+}
 
 static boolean isSupported() {
 // This property does not exist for a native image


-
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: Revert "Fixes OSGI bundling error"

2020-06-23 Thread fhanik
This is an automated email from the ASF dual-hosted git repository.

fhanik 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 7ec1d31  Revert "Fixes OSGI bundling error"
7ec1d31 is described below

commit 7ec1d3158461c50123092a96c7ca8f032721a314
Author: Filip Hanik 
AuthorDate: Tue Jun 23 14:17:46 2020 -0700

Revert "Fixes OSGI bundling error"

This reverts commit caed3194b48ccbbac0572417b0e60807683a8690.
---
 res/bnd/build-defaults.bnd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/res/bnd/build-defaults.bnd b/res/bnd/build-defaults.bnd
index a099b49..cdefb9c 100644
--- a/res/bnd/build-defaults.bnd
+++ b/res/bnd/build-defaults.bnd
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-Bundle-Version: ${version}
+Bundle-Version: ${version_cleanup;${version}}
 
 Specification-Title: Apache Tomcat
 Specification-Version: ${version.major.minor}


-
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: Revert

2020-05-13 Thread remm
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 c0796a1  Revert
c0796a1 is described below

commit c0796a1c283086d60d8a23212dab1d719bdb301d
Author: remm 
AuthorDate: Wed May 13 15:48:12 2020 +0200

Revert
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 606311f..8587bfd 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -72,8 +72,6 @@ public class CoyoteAdapter implements Adapter {
 System.getProperty("java.vm.vendor") + "/" +
 System.getProperty("java.runtime.version") + ")";
 
-private static final String INVALID_URI = "Invalid URI ";
-
 private static final EnumSet SSL_ONLY =
 EnumSet.of(SessionTrackingMode.SSL);
 
@@ -616,7 +614,7 @@ public class CoyoteAdapter implements Adapter {
 connector.getService().getContainer().logAccess(request, 
response, 0, true);
 return false;
 } else {
-response.sendError(400, INVALID_URI);
+response.sendError(400, "Invalid URI");
 }
 }
 
@@ -634,7 +632,7 @@ public class CoyoteAdapter implements Adapter {
 try {
 req.getURLDecoder().convert(decodedURI.getByteChunk(), 
connector.getEncodedSolidusHandlingInternal());
 } catch (IOException ioe) {
-response.sendError(400, INVALID_URI + ioe.getMessage());
+response.sendError(400, "Invalid URI: " + ioe.getMessage());
 }
 // Normalization
 if (normalize(req.decodedURI())) {
@@ -648,7 +646,7 @@ public class CoyoteAdapter implements Adapter {
 response.sendError(400, "Invalid URI");
 }
 } else {
-response.sendError(400, INVALID_URI);
+response.sendError(400, "Invalid URI");
 }
 } else {
 /* The URI is chars or String, and has been sent using an in-memory


-
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: Revert "Check for non-null 'methods'"

2020-02-20 Thread mgrigorov
This is an automated email from the ASF dual-hosted git repository.

mgrigorov 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 eb2ab3c  Revert "Check for non-null 'methods'"
eb2ab3c is described below

commit eb2ab3cd33e23b786685bb40f6c50e78f46c379b
Author: Martin Tzvetanov Grigorov 
AuthorDate: Thu Feb 20 13:25:21 2020 +0200

Revert "Check for non-null 'methods'"

This reverts commit f85638784471b80da82fc4ef89b3424698da981b.
---
 java/javax/servlet/http/HttpServlet.java | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/java/javax/servlet/http/HttpServlet.java 
b/java/javax/servlet/http/HttpServlet.java
index 2ac26cf..aedbee6 100644
--- a/java/javax/servlet/http/HttpServlet.java
+++ b/java/javax/servlet/http/HttpServlet.java
@@ -502,21 +502,19 @@ public abstract class HttpServlet extends GenericServlet {
 }
 // End of Tomcat specific hack
 
-if (methods != null) {
-for (int i = 0; i < methods.length; i++) {
-Method m = methods[i];
+for (int i=0; i