Re: Jakarta EE 11 may be changing minimum Java version to 17

2024-02-21 Thread Rémy Maucherat
On Wed, Feb 21, 2024 at 1:28 AM Paul Nicolucci  wrote:
>
> Hi,
>
> At a minimum could the Expression Language be built to Java 17 bytecode?
> There is nothing in the Expression Language that requires Java 21.
>
> I have a branch with some initial changes to get that working here:
> https://github.com/pnicolucci/tomcat/commit/cae7f1e02eaeaf16a75395d9bcdddc9a02e65580
>
> Some additional manifest updates will be required that I can work on if the
> community is open to this option.

Yes, this will be changed back to 17, along with almost everything else.

Overall I believe staying on 21 is not worth it as we would get tons
of requests for 17 support, just like yours.

Rémy

> Thanks,
>
> Paul Nicolucci
>
> On Tue, Feb 20, 2024 at 4:48 PM David Blevins 
> wrote:
>
> > > On Feb 20, 2024, at 8:08 AM, Mark Thomas  wrote:
> > >
> > > Looking at the latest version of the Jakarta EE 11 release plan, the
> > minimum Java version has been dropped to Java 17.
> > >
> > > https://jakartaee.github.io/platform/jakartaee11/JakartaEE11ReleasePlan
> > >
> > > On that basis I think we have no choice but to reduce the minimum Java
> > version for Tomcat 11 to Java 17.
> >
> > Implementations are not required to support Java 17, it is simply now one
> > of the allowed options.  We can absolutely continue with java 21 (or any
> > JDK 17 or up) if we like.
> >
> > The decision was made to allow implementations to certify with 17 support
> > if they wanted as none of the specs took advantage of Java 21 features, so
> > there is no real basis to reject their certification requests.  It is still
> > hoped there will be implementations that take advantage of Java 21 features
> > and brag publicly about them.
> >
> >
> > -David
> >
> >
> > -
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >
> >

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Jakarta EE 11 may be changing minimum Java version to 17

2024-02-21 Thread Mark Thomas

On 21/02/2024 09:02, Rémy Maucherat wrote:

On Wed, Feb 21, 2024 at 1:28 AM Paul Nicolucci  wrote:


Hi,

At a minimum could the Expression Language be built to Java 17 bytecode?
There is nothing in the Expression Language that requires Java 21.

I have a branch with some initial changes to get that working here:
https://github.com/pnicolucci/tomcat/commit/cae7f1e02eaeaf16a75395d9bcdddc9a02e65580

Some additional manifest updates will be required that I can work on if the
community is open to this option.


Yes, this will be changed back to 17, along with almost everything else.

Overall I believe staying on 21 is not worth it as we would get tons
of requests for 17 support, just like yours.


+1. As much as I don't like it.


Rémy


Thanks,

Paul Nicolucci

On Tue, Feb 20, 2024 at 4:48 PM David Blevins 
wrote:


On Feb 20, 2024, at 8:08 AM, Mark Thomas  wrote:

Looking at the latest version of the Jakarta EE 11 release plan, the

minimum Java version has been dropped to Java 17.


https://jakartaee.github.io/platform/jakartaee11/JakartaEE11ReleasePlan

On that basis I think we have no choice but to reduce the minimum Java

version for Tomcat 11 to Java 17.

Implementations are not required to support Java 17,


That is certainly an interesting interpretation of the statement


Java SE 17 will become the minimum runtime supported by compatible 
implementations of Jakarta EE.




it is simply now one
of the allowed options.  We can absolutely continue with java 21 (or any
JDK 17 or up) if we like.


It appears the fudge being employed to meet the "must target Java 21 
direction" from the Jakarta EE steering committee is that a compatible 
implementation has to pass on at least one of Java 17 or Java 21 and 
each spec must have at least one compatible implementation (not 
necessarily the same one) that passes on each of Java 17 and Java 21.


As stated elsewhere, this is a recipe for user confusion. The least 
worst option for Tomcat users is to use Java 17 as the baseline.



The decision was made to allow implementations to certify with 17 support
if they wanted as none of the specs took advantage of Java 21 features,


Some specifications had started to use Java > 17 features. Granted only 
in a minor way that was relatively easy to work-around but they were 
being used.



so
there is no real basis to reject their certification requests.


That is not the justification that was used when the issue was raised. 
The justification was (lack of) market adoption.



 It is still
hoped there will be implementations that take advantage of Java 21 features
and brag publicly about them.


We aren't dropping any functionality by lowering the minimum version. 
Support for virtual threads, for example, will remain. All my patch does 
(which I'll commit shortly) is re-introduce the necessary JreCompat 
classes to enable Tomcat 11 to run on Java 17 onwards and take advantage 
of the features we want to take advantage of when running on later versions.


Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



(tomcat) branch main updated: Remove unsued properties to align with EL 6.0 API

2024-02-21 Thread markt
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 82228cc139 Remove unsued properties to align with EL 6.0 API
82228cc139 is described below

commit 82228cc139fa78abc2d6d6f117571e03e063b20b
Author: Mark Thomas 
AuthorDate: Tue Feb 20 20:19:49 2024 +

Remove unsued properties to align with EL 6.0 API
---
 java/jakarta/el/ELResolver.java | 4 
 1 file changed, 4 deletions(-)

diff --git a/java/jakarta/el/ELResolver.java b/java/jakarta/el/ELResolver.java
index d8fb0a04b0..2bd3dd9280 100644
--- a/java/jakarta/el/ELResolver.java
+++ b/java/jakarta/el/ELResolver.java
@@ -21,10 +21,6 @@ package jakarta.el;
  */
 public abstract class ELResolver {
 
-public static final String TYPE = "type";
-
-public static final String RESOLVABLE_AT_DESIGN_TIME = 
"resolvableAtDesignTime";
-
 /**
  * Obtain the value of the given property on the given object using the 
given context.
  *


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



(tomcat) branch main updated: Reduce minimum Java version to 17

2024-02-21 Thread markt
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 d9def06167 Reduce minimum Java version to 17
d9def06167 is described below

commit d9def06167fe566674e00ebdbdce8591a228cce2
Author: Mark Thomas 
AuthorDate: Fri Jan 19 12:15:20 2024 +

Reduce minimum Java version to 17

Uses some API that is deprecated in Java 21 but not 17. JreCompat has
not been used to avoid the deprecated API if running on Java 21+.
---
 build.xml  |   8 +-
 conf/web.xml   |   4 +-
 .../authenticator/SpnegoAuthenticator.java |  65 +---
 .../core/ThreadLocalLeakPreventionListener.java|   1 -
 .../catalina/valves/StuckThreadDetectionValve.java |  10 +-
 .../catalina/webresources/CachedResource.java  |   3 -
 java/org/apache/coyote/Request.java|   4 +-
 java/org/apache/jasper/EmbeddedServletOptions.java |   4 +-
 java/org/apache/jasper/JspC.java   |   4 +-
 java/org/apache/jasper/compiler/JDTCompiler.java   |  14 +--
 .../tomcat/dbcp/dbcp2/DelegatingStatement.java |   2 +-
 java/org/apache/tomcat/util/Diagnostics.java   |   1 -
 .../org/apache/tomcat/util/compat/Jre19Compat.java |  84 +++
 .../org/apache/tomcat/util/compat/Jre21Compat.java |  82 ++
 .../org/apache/tomcat/util/compat/Jre22Compat.java |   2 +-
 java/org/apache/tomcat/util/compat/JreCompat.java  | 118 -
 .../apache/tomcat/util/net/AbstractEndpoint.java   |   1 -
 .../tomcat/util/threads/VirtualThreadExecutor.java |  11 +-
 .../TestAsyncContextImplListenerOnComplete.java|  31 +++---
 test/org/apache/juli/TestThreadNameCache.java  |   2 +-
 webapps/docs/changelog.xml |  12 +++
 webapps/docs/jasper-howto.xml  |   4 +-
 webapps/docs/tomcat-docs.xsl   |   4 +-
 23 files changed, 398 insertions(+), 73 deletions(-)

diff --git a/build.xml b/build.xml
index 22379895f9..76d1feb07c 100644
--- a/build.xml
+++ b/build.xml
@@ -104,11 +104,11 @@
   
   
 
-  
+  
   
-  
-  
-  
+  
+  
+  
   
 
   
diff --git a/conf/web.xml b/conf/web.xml
index 0a1261e3b3..788f411d48 100644
--- a/conf/web.xml
+++ b/conf/web.xml
@@ -160,9 +160,9 @@
   
   
   
-  
+  
   
-  
+  
   
   
   
diff --git a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java 
b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
index d76edb9ecf..6377416ea4 100644
--- a/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
+++ b/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
@@ -19,8 +19,10 @@ package org.apache.catalina.authenticator;
 import java.io.File;
 import java.io.IOException;
 import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.LinkedHashMap;
-import java.util.concurrent.CompletionException;
 import java.util.regex.Pattern;
 
 import javax.security.auth.Subject;
@@ -30,6 +32,7 @@ import javax.security.auth.login.LoginException;
 import jakarta.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.LifecycleException;
+import org.apache.catalina.Realm;
 import org.apache.catalina.connector.Request;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -205,16 +208,11 @@ public class SpnegoAuthenticator extends 
AuthenticatorBase {
 } else {
 credentialLifetime = GSSCredential.DEFAULT_LIFETIME;
 }
+final PrivilegedExceptionAction action = () -> 
manager.createCredential(null,
+credentialLifetime, new Oid("1.3.6.1.5.5.2"), 
GSSCredential.ACCEPT_ONLY);
+gssContext = manager.createContext(Subject.doAs(subject, action));
 
-gssContext = manager.createContext(Subject.callAs(subject, () -> {
-return manager.createCredential(null, credentialLifetime, new 
Oid("1.3.6.1.5.5.2"),
-GSSCredential.ACCEPT_ONLY);
-}));
-
-final GSSContext gssContextFinal = gssContext;
-outToken = Subject.callAs(subject, () -> {
-return gssContextFinal.acceptSecContext(decoded, 0, 
decoded.length);
-});
+outToken = Subject.doAs(lc.getSubject(), new 
AcceptAction(gssContext, decoded));
 
 if (outToken == null) {
 if (log.isDebugEnabled()) {
@@ -226,9 +224,8 @@ public class SpnegoAuthenticator extends AuthenticatorBase {
 return false;
 }
 
-principal = Subject.callAs(subject, () -> {
-return context.getRealm().authenticate(gssContextFinal, 
storeDelegatedCredential);
-   

(tomcat-tck) branch main updated: Note requirement to install additional dependency

2024-02-21 Thread markt
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-tck.git


The following commit(s) were added to refs/heads/main by this push:
 new ea3d7a9  Note requirement to install additional dependency
ea3d7a9 is described below

commit ea3d7a920bf45668a1cb93a0529257ef7189450d
Author: Mark Thomas 
AuthorDate: Tue Feb 20 17:28:58 2024 +

Note requirement to install additional dependency
---
 README.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.md b/README.md
index 0850418..f687d65 100644
--- a/README.md
+++ b/README.md
@@ -53,6 +53,9 @@ At the moment, you will need to build the TCK locally (see 
below).
 
cd $TCK/webartifacts/jsp
mvn install
+
+   cd $TCK/signaturetest
+   mvn install
 ```
 
 6. Install the TCKs Tomcat tests against


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



(tomcat-tck) branch main updated: Get the EL signature tests passing

2024-02-21 Thread markt
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-tck.git


The following commit(s) were added to refs/heads/main by this push:
 new d315c80  Get the EL signature tests passing
d315c80 is described below

commit d315c803ba197e356179351cd2d35182ac86d67e
Author: Mark Thomas 
AuthorDate: Wed Feb 21 13:07:42 2024 +

Get the EL signature tests passing
---
 el-tck/pom.xml | 12 +---
 pom.xml| 16 +---
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/el-tck/pom.xml b/el-tck/pom.xml
index d6e5fc0..a644a3b 100644
--- a/el-tck/pom.xml
+++ b/el-tck/pom.xml
@@ -34,7 +34,7 @@
 jakarta-expression-language-tck
 ${tck.el.version}
 
 
   
@@ -48,7 +48,7 @@
 tomcat-jasper-el
 ${tomcat.version}
 
 
+
${settings.localRepository}/org/apache/tomcat/tomcat-el-api/${tomcat.version}/tomcat-el-api-${tomcat.version}.jar:${env.JAVA_HOME}/jmods/java.base
+
+
 
 
 
diff --git a/pom.xml b/pom.xml
index 6336c6c..d80181a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,19 +27,21 @@
 pom
 
 
-21
-21
-
+17
+17
+
+
 11.0.0-M18-SNAPSHOT
-
+
+
 6.0.0-SNAPSHOT
+6.0.0-SNAPSHOT
 10.0.0-SNAPSHOT
-
+
+
 10.0.0-SNAPSHOT
-
 1.8.0.Final
 1.2.0.Final
-
 5.7.2
 
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



(tomcat) branch main updated: Clear out some fixmes

2024-02-21 Thread remm
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 7f9af2f1c6 Clear out some fixmes
7f9af2f1c6 is described below

commit 7f9af2f1c602346e8c825337008c63a738de8a16
Author: remm 
AuthorDate: Wed Feb 21 14:55:06 2024 +0100

Clear out some fixmes
---
 .../org/apache/catalina/valves/rewrite/RewriteValve.java |  4 ++--
 java/org/apache/coyote/http11/Http11Processor.java   |  6 +-
 java/org/apache/tomcat/util/compat/Jre22Compat.java  | 16 ++--
 java/org/apache/tomcat/util/modeler/BaseModelMBean.java  |  2 --
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java 
b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
index 8beb2ac3ae..492d45e26d 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
@@ -621,8 +621,8 @@ public class RewriteValve extends ValveBase {
 } else if (rewriteMapClassName.startsWith("rnd:")) {
 map = new 
RandomizedTextRewriteMap(rewriteMapClassName.substring("rnd:".length()), true);
 } else if (rewriteMapClassName.startsWith("prg:")) {
-// FIXME: 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
-// Likely not worth implementing further since this is a 
simpler CGI
+// 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
+// Not worth implementing further since this is a simpler 
CGI
 // piping stdin/stdout from an external native process
 // Instead assume a class and use the RewriteMap interface
 rewriteMapClassName = 
rewriteMapClassName.substring("prg:".length());
diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index 446c36abd9..9f144bb464 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -955,7 +955,11 @@ public class Http11Processor extends AbstractProcessor {
 
headers.addValue("Date").setString(FastHttpDateFormat.getCurrentDate());
 }
 
-// FIXME: Add transfer encoding header
+// Although using transfer-encoding for gzip would be doable and was
+// the original intent (which means the compression would be from an
+// endpoint to the next, so only for the current transmission), it
+// has been found that using content-encoding (which is end to end
+// compression) is more efficient and more reliable.
 
 if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
 // Disable keep-alive if:
diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java 
b/java/org/apache/tomcat/util/compat/Jre22Compat.java
index d685cd56ec..3bd43dd141 100644
--- a/java/org/apache/tomcat/util/compat/Jre22Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre22Compat.java
@@ -16,8 +16,6 @@
  */
 package org.apache.tomcat.util.compat;
 
-import java.lang.reflect.Method;
-
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -31,24 +29,14 @@ public class Jre22Compat extends Jre21Compat {
 
 
 static {
-// FIXME: Improve check using a new class in 22 later
 Class c1 = null;
-Class c2 = null;
-Method m1 = null;
-
 try {
-c1 = Class.forName("java.lang.foreign.MemorySegment");
-c2 = Class.forName("java.io.Console");
-m1 = c1.getMethod("getString", long.class);
-c2.getMethod("isTerminal");
+c1 = Class.forName("java.text.ListFormat");
 } catch (ClassNotFoundException e) {
 // Must be pre-Java 22
 log.debug(sm.getString("jre22Compat.javaPre22"), e);
-} catch (ReflectiveOperationException e) {
-// Likely a previous Panama API version
-log.debug(sm.getString("jre22Compat.unexpected"), e);
 }
-hasPanama = (m1 != null);
+hasPanama = (c1 != null);
 }
 
 static boolean isSupported() {
diff --git a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 
b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
index 30760700d5..27561b2cc2 100644
--- a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
+++ b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
@@ -197,7 +197,6 @@ public class BaseModelMBean implements DynamicMBean, 
MBeanRegistration,
 }
 
 // Return the results of this method invocation
-// FIXME - should we validate the return type?
 return result;
 }
 
@@ -3

(tomcat) branch 10.1.x updated: Clear out some fixmes

2024-02-21 Thread remm
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 b69a8a17be Clear out some fixmes
b69a8a17be is described below

commit b69a8a17be09bc316092a8b0ef726bea88d62bb4
Author: remm 
AuthorDate: Wed Feb 21 14:55:06 2024 +0100

Clear out some fixmes
---
 .../org/apache/catalina/valves/rewrite/RewriteValve.java |  4 ++--
 java/org/apache/coyote/http11/Http11Processor.java   |  6 +-
 java/org/apache/tomcat/util/compat/Jre22Compat.java  | 16 ++--
 java/org/apache/tomcat/util/modeler/BaseModelMBean.java  |  2 --
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java 
b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
index 8beb2ac3ae..492d45e26d 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
@@ -621,8 +621,8 @@ public class RewriteValve extends ValveBase {
 } else if (rewriteMapClassName.startsWith("rnd:")) {
 map = new 
RandomizedTextRewriteMap(rewriteMapClassName.substring("rnd:".length()), true);
 } else if (rewriteMapClassName.startsWith("prg:")) {
-// FIXME: 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
-// Likely not worth implementing further since this is a 
simpler CGI
+// 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
+// Not worth implementing further since this is a simpler 
CGI
 // piping stdin/stdout from an external native process
 // Instead assume a class and use the RewriteMap interface
 rewriteMapClassName = 
rewriteMapClassName.substring("prg:".length());
diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index b505ed691d..87aa0da734 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -966,7 +966,11 @@ public class Http11Processor extends AbstractProcessor {
 
headers.addValue("Date").setString(FastHttpDateFormat.getCurrentDate());
 }
 
-// FIXME: Add transfer encoding header
+// Although using transfer-encoding for gzip would be doable and was
+// the original intent (which means the compression would be from an
+// endpoint to the next, so only for the current transmission), it
+// has been found that using content-encoding (which is end to end
+// compression) is more efficient and more reliable.
 
 if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
 // Disable keep-alive if:
diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java 
b/java/org/apache/tomcat/util/compat/Jre22Compat.java
index d685cd56ec..3bd43dd141 100644
--- a/java/org/apache/tomcat/util/compat/Jre22Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre22Compat.java
@@ -16,8 +16,6 @@
  */
 package org.apache.tomcat.util.compat;
 
-import java.lang.reflect.Method;
-
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -31,24 +29,14 @@ public class Jre22Compat extends Jre21Compat {
 
 
 static {
-// FIXME: Improve check using a new class in 22 later
 Class c1 = null;
-Class c2 = null;
-Method m1 = null;
-
 try {
-c1 = Class.forName("java.lang.foreign.MemorySegment");
-c2 = Class.forName("java.io.Console");
-m1 = c1.getMethod("getString", long.class);
-c2.getMethod("isTerminal");
+c1 = Class.forName("java.text.ListFormat");
 } catch (ClassNotFoundException e) {
 // Must be pre-Java 22
 log.debug(sm.getString("jre22Compat.javaPre22"), e);
-} catch (ReflectiveOperationException e) {
-// Likely a previous Panama API version
-log.debug(sm.getString("jre22Compat.unexpected"), e);
 }
-hasPanama = (m1 != null);
+hasPanama = (c1 != null);
 }
 
 static boolean isSupported() {
diff --git a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 
b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
index 30760700d5..27561b2cc2 100644
--- a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
+++ b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
@@ -197,7 +197,6 @@ public class BaseModelMBean implements DynamicMBean, 
MBeanRegistration,
 }
 
 // Return the results of this method invocation
-// FIXME - should we validate the return type?
 return result;
 }
 
@

(tomcat) branch 9.0.x updated: Clear out some fixmes

2024-02-21 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 d0fd3dfc0d Clear out some fixmes
d0fd3dfc0d is described below

commit d0fd3dfc0d23fe9b43179ec411454383a6a69ef9
Author: remm 
AuthorDate: Wed Feb 21 14:55:06 2024 +0100

Clear out some fixmes
---
 .../org/apache/catalina/valves/rewrite/RewriteValve.java |  4 ++--
 java/org/apache/coyote/http11/Http11Processor.java   |  6 +-
 java/org/apache/tomcat/util/compat/Jre22Compat.java  | 16 ++--
 java/org/apache/tomcat/util/modeler/BaseModelMBean.java  |  2 --
 4 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/RewriteValve.java 
b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
index c827e4b8ea..b1617f451d 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteValve.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteValve.java
@@ -621,8 +621,8 @@ public class RewriteValve extends ValveBase {
 } else if (rewriteMapClassName.startsWith("rnd:")) {
 map = new 
RandomizedTextRewriteMap(rewriteMapClassName.substring("rnd:".length()), true);
 } else if (rewriteMapClassName.startsWith("prg:")) {
-// FIXME: 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
-// Likely not worth implementing further since this is a 
simpler CGI
+// 
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#prg
+// Not worth implementing further since this is a simpler 
CGI
 // piping stdin/stdout from an external native process
 // Instead assume a class and use the RewriteMap interface
 rewriteMapClassName = 
rewriteMapClassName.substring("prg:".length());
diff --git a/java/org/apache/coyote/http11/Http11Processor.java 
b/java/org/apache/coyote/http11/Http11Processor.java
index d2a633cd22..ebbacb7f29 100644
--- a/java/org/apache/coyote/http11/Http11Processor.java
+++ b/java/org/apache/coyote/http11/Http11Processor.java
@@ -965,7 +965,11 @@ public class Http11Processor extends AbstractProcessor {
 
headers.addValue("Date").setString(FastHttpDateFormat.getCurrentDate());
 }
 
-// FIXME: Add transfer encoding header
+// Although using transfer-encoding for gzip would be doable and was
+// the original intent (which means the compression would be from an
+// endpoint to the next, so only for the current transmission), it
+// has been found that using content-encoding (which is end to end
+// compression) is more efficient and more reliable.
 
 if ((entityBody) && (!contentDelimitation) || connectionClosePresent) {
 // Disable keep-alive if:
diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java 
b/java/org/apache/tomcat/util/compat/Jre22Compat.java
index d685cd56ec..3bd43dd141 100644
--- a/java/org/apache/tomcat/util/compat/Jre22Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre22Compat.java
@@ -16,8 +16,6 @@
  */
 package org.apache.tomcat.util.compat;
 
-import java.lang.reflect.Method;
-
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
@@ -31,24 +29,14 @@ public class Jre22Compat extends Jre21Compat {
 
 
 static {
-// FIXME: Improve check using a new class in 22 later
 Class c1 = null;
-Class c2 = null;
-Method m1 = null;
-
 try {
-c1 = Class.forName("java.lang.foreign.MemorySegment");
-c2 = Class.forName("java.io.Console");
-m1 = c1.getMethod("getString", long.class);
-c2.getMethod("isTerminal");
+c1 = Class.forName("java.text.ListFormat");
 } catch (ClassNotFoundException e) {
 // Must be pre-Java 22
 log.debug(sm.getString("jre22Compat.javaPre22"), e);
-} catch (ReflectiveOperationException e) {
-// Likely a previous Panama API version
-log.debug(sm.getString("jre22Compat.unexpected"), e);
 }
-hasPanama = (m1 != null);
+hasPanama = (c1 != null);
 }
 
 static boolean isSupported() {
diff --git a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java 
b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
index 30760700d5..27561b2cc2 100644
--- a/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
+++ b/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
@@ -197,7 +197,6 @@ public class BaseModelMBean implements DynamicMBean, 
MBeanRegistration,
 }
 
 // Return the results of this method invocation
-// FIXME - should we validate the return type?
 return result;
 }
 
@@ 

[PR] Handle osgi headers correctly [tomcat-jakartaee-migration]

2024-02-21 Thread via GitHub


kysmith-csg opened a new pull request, #54:
URL: https://github.com/apache/tomcat-jakartaee-migration/pull/54

   This PR fixes OSGI manifest processing. As it is now, this tool creates 
invalid manifest headers. My changes fix two problems that I saw while trying 
to use this:
   
   1. [`Export-Package` is not allowed to have a version 
range.](https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.exportpackage)
   The change by #42 was too broad and would create things like 
   ```
   Export-Package: jakarta.servlet;version="[5.0.0,7.0.0)"
   ```
   which is not valid in OSGI and results in the bundle not being installable. 
Now, it simply exports the single version:
   ```
   Export-Package: jakarta.servlet;version="5.0.0"
   ```
   
   I was a bit unsure what version to export though so I just went with the 
lowest.
   
   `Import-Package` is unchanged because you are allowed to have a version 
range there.
   
   2. Use `org.eclipse.osgi` as a dependency to process `Import-Package` and 
`Export-Package`. I have seen at least one case that a manifest had something 
like:
   ```
   Export-Package: some.package;uses:="javax.servlet";version="1.0.0"
   ```
   The regex pattern would see `javax.servlet` (after being transformed to 
`jakarta.servlet`) and change the version from `1.0.0` to `[5.0.0,7.0.0)`, even 
though that version is for `some.package`. 
   ```
   Export-Package: some.package;uses:="jakarta.servlet";version="[5.0.0,7.0.0)"
   ```
   
   This results in issues with other bundles who require `some.package` because 
they will be importing a version `1.0.0` which is no longer being exported.
   
   By using `org.eclipse.osgi` we can parse the manifest headers as OSGI would 
and do it properly. I think it's impossible for a regex to match these 
perfectly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org