[tomcat-native] branch 1.2.x updated: Refactor for Tomcat 10.1.x compatability

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

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


The following commit(s) were added to refs/heads/1.2.x by this push:
 new b07b48b16 Refactor for Tomcat 10.1.x compatability
b07b48b16 is described below

commit b07b48b1690c91bc575f2a31cb5be8cb7a6c53f3
Author: Mark Thomas 
AuthorDate: Mon May 30 20:41:03 2022 +0100

Refactor for Tomcat 10.1.x compatability

FileInfo and Sockaddr have been removed in 10.1.x
---
 native/include/tcn.h  |  9 ++---
 native/src/jnilib.c   | 20 +---
 xdocs/miscellaneous/changelog.xml |  4 
 3 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/native/include/tcn.h b/native/include/tcn.h
index 168549fae..4eb2c9730 100644
--- a/native/include/tcn.h
+++ b/native/include/tcn.h
@@ -227,10 +227,13 @@ unsigned long   tcn_get_thread_id(void);
 jclass _##C = (*(E))->FindClass((E), N);\
 if (_##C == NULL) { \
 (*(E))->ExceptionClear((E));\
-return R;   \
+if (R != JNI_OK) {  \
+return R;   \
+}   \
+} else {\
+C = (*(E))->NewGlobalRef((E), _##C);\
+(*(E))->DeleteLocalRef((E), _##C);  \
 }   \
-C = (*(E))->NewGlobalRef((E), _##C);\
-(*(E))->DeleteLocalRef((E), _##C);  \
 TCN_END_MACRO
 
 #define TCN_UNLOAD_CLASS(E, C)  \
diff --git a/native/src/jnilib.c b/native/src/jnilib.c
index 32f5151dd..300fe8caa 100644
--- a/native/src/jnilib.c
+++ b/native/src/jnilib.c
@@ -82,18 +82,24 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void 
*reserved)
 
 /* Initialize global java.lang.String class */
 TCN_LOAD_CLASS(env, jString_class, "java/lang/String", JNI_ERR);
-TCN_LOAD_CLASS(env, jFinfo_class, TCN_FINFO_CLASS, JNI_ERR);
-TCN_LOAD_CLASS(env, jAinfo_class, TCN_AINFO_CLASS, JNI_ERR);
-
 TCN_GET_METHOD(env, jString_class, jString_init,
"", "([B)V", JNI_ERR);
 TCN_GET_METHOD(env, jString_class, jString_getBytes,
"getBytes", "()[B", JNI_ERR);
 
-if(tcn_load_finfo_class(env, jFinfo_class) != APR_SUCCESS)
-return JNI_ERR;
-if(tcn_load_ainfo_class(env, jAinfo_class) != APR_SUCCESS)
-return JNI_ERR;
+TCN_LOAD_CLASS(env, jFinfo_class, TCN_FINFO_CLASS, JNI_OK);
+if (jFinfo_class) {
+if (tcn_load_finfo_class(env, jFinfo_class) != APR_SUCCESS) {
+return JNI_ERR;
+}
+}
+
+TCN_LOAD_CLASS(env, jAinfo_class, TCN_AINFO_CLASS, JNI_OK);
+if (jAinfo_class) {
+if (tcn_load_ainfo_class(env, jAinfo_class) != APR_SUCCESS) {
+return JNI_ERR;
+}
+}
 #ifdef WIN32
 {
 char *ppid = getenv(TCN_PARENT_IDE);
diff --git a/xdocs/miscellaneous/changelog.xml 
b/xdocs/miscellaneous/changelog.xml
index f07cbb494..59ab613bc 100644
--- a/xdocs/miscellaneous/changelog.xml
+++ b/xdocs/miscellaneous/changelog.xml
@@ -36,6 +36,10 @@
 
 
   
+
+  Refactor library initialization so it is compatible with Tomcat 10.1.x
+  onwards where a number of Java classes have been removed. (markt)
+
   
 
 


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



[tomcat] branch 8.5.x updated: Fix deprecation warnings in IDE

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new a2110be96d Fix deprecation warnings in IDE
a2110be96d is described below

commit a2110be96dc76a4cef5f6372eae3e42e31e04cb7
Author: Mark Thomas 
AuthorDate: Mon May 30 20:54:35 2022 +0100

Fix deprecation warnings in IDE
---
 java/org/apache/tomcat/util/net/Acceptor.java| 6 +++---
 test/org/apache/tomcat/util/net/TestXxxEndpoint.java | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Acceptor.java 
b/java/org/apache/tomcat/util/net/Acceptor.java
index 3fa4f965a3..bbfd8dd695 100644
--- a/java/org/apache/tomcat/util/net/Acceptor.java
+++ b/java/org/apache/tomcat/util/net/Acceptor.java
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -65,6 +64,7 @@ public class Acceptor implements Runnable {
 }
 
 
+@SuppressWarnings("deprecation")
 @Override
 public void run() {
 
@@ -157,8 +157,8 @@ public class Acceptor implements Runnable {
 String msg = sm.getString("endpoint.accept.fail");
 // APR specific.
 // Could push this down but not sure it is worth the 
trouble.
-if (t instanceof Error) {
-Error e = (Error) t;
+if (t instanceof org.apache.tomcat.jni.Error) {
+org.apache.tomcat.jni.Error e = 
(org.apache.tomcat.jni.Error) t;
 if (e.getError() == 233) {
 // Not an error on HP-UX so log as a warning
 // so it can be filtered out on that platform
diff --git a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java 
b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
index e13713b499..b355460aea 100644
--- a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
+++ b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
@@ -27,7 +27,6 @@ import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.jni.Address;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.jni.OS;
 import org.apache.tomcat.jni.Pool;
 import org.apache.tomcat.jni.Socket;
@@ -49,6 +48,7 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 }
 }
 
+@SuppressWarnings("deprecation")
 private long createAprSocket(int port, long pool)
  throws Exception {
 /**
@@ -82,8 +82,8 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 // Bind the server socket
 int ret = Socket.bind(serverSock, inetAddress);
 if (ret != 0) {
-log.error("Could not bind: " + Error.strerror(ret));
-throw (new Exception(Error.strerror(ret)));
+log.error("Could not bind: " + 
org.apache.tomcat.jni.Error.strerror(ret));
+throw (new Exception(org.apache.tomcat.jni.Error.strerror(ret)));
 }
 return serverSock;
 }


-
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: Fix deprecation warnings in IDE

2022-05-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 79900c9eef Fix deprecation warnings in IDE
79900c9eef is described below

commit 79900c9eef9aac2e892af73f23d9b16337deac27
Author: Mark Thomas 
AuthorDate: Mon May 30 20:54:35 2022 +0100

Fix deprecation warnings in IDE
---
 java/org/apache/tomcat/util/net/Acceptor.java| 6 +++---
 test/org/apache/tomcat/util/net/TestXxxEndpoint.java | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Acceptor.java 
b/java/org/apache/tomcat/util/net/Acceptor.java
index 3fa4f965a3..bbfd8dd695 100644
--- a/java/org/apache/tomcat/util/net/Acceptor.java
+++ b/java/org/apache/tomcat/util/net/Acceptor.java
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -65,6 +64,7 @@ public class Acceptor implements Runnable {
 }
 
 
+@SuppressWarnings("deprecation")
 @Override
 public void run() {
 
@@ -157,8 +157,8 @@ public class Acceptor implements Runnable {
 String msg = sm.getString("endpoint.accept.fail");
 // APR specific.
 // Could push this down but not sure it is worth the 
trouble.
-if (t instanceof Error) {
-Error e = (Error) t;
+if (t instanceof org.apache.tomcat.jni.Error) {
+org.apache.tomcat.jni.Error e = 
(org.apache.tomcat.jni.Error) t;
 if (e.getError() == 233) {
 // Not an error on HP-UX so log as a warning
 // so it can be filtered out on that platform
diff --git a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java 
b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
index 0c23787856..19cd4ce214 100644
--- a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
+++ b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
@@ -31,7 +31,6 @@ import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
 import org.apache.tomcat.jni.Address;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.jni.OS;
 import org.apache.tomcat.jni.Pool;
 import org.apache.tomcat.jni.Socket;
@@ -54,6 +53,7 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 }
 }
 
+@SuppressWarnings("deprecation")
 private long createAprSocket(int port, long pool)
  throws Exception {
 /**
@@ -87,8 +87,8 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 // Bind the server socket
 int ret = Socket.bind(serverSock, inetAddress);
 if (ret != 0) {
-log.error("Could not bind: " + Error.strerror(ret));
-throw (new Exception(Error.strerror(ret)));
+log.error("Could not bind: " + 
org.apache.tomcat.jni.Error.strerror(ret));
+throw (new Exception(org.apache.tomcat.jni.Error.strerror(ret)));
 }
 return serverSock;
 }


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



[tomcat] branch 10.0.x updated: Fix deprecation warnings in IDE

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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 27cae2f868 Fix deprecation warnings in IDE
27cae2f868 is described below

commit 27cae2f868d53908cdaedb63de5dff003869c19d
Author: Mark Thomas 
AuthorDate: Mon May 30 20:54:35 2022 +0100

Fix deprecation warnings in IDE
---
 java/org/apache/tomcat/util/net/Acceptor.java| 6 +++---
 test/org/apache/tomcat/util/net/TestXxxEndpoint.java | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Acceptor.java 
b/java/org/apache/tomcat/util/net/Acceptor.java
index 3fa4f965a3..bbfd8dd695 100644
--- a/java/org/apache/tomcat/util/net/Acceptor.java
+++ b/java/org/apache/tomcat/util/net/Acceptor.java
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
@@ -65,6 +64,7 @@ public class Acceptor implements Runnable {
 }
 
 
+@SuppressWarnings("deprecation")
 @Override
 public void run() {
 
@@ -157,8 +157,8 @@ public class Acceptor implements Runnable {
 String msg = sm.getString("endpoint.accept.fail");
 // APR specific.
 // Could push this down but not sure it is worth the 
trouble.
-if (t instanceof Error) {
-Error e = (Error) t;
+if (t instanceof org.apache.tomcat.jni.Error) {
+org.apache.tomcat.jni.Error e = 
(org.apache.tomcat.jni.Error) t;
 if (e.getError() == 233) {
 // Not an error on HP-UX so log as a warning
 // so it can be filtered out on that platform
diff --git a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java 
b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
index f270258087..f9777b085f 100644
--- a/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
+++ b/test/org/apache/tomcat/util/net/TestXxxEndpoint.java
@@ -30,7 +30,6 @@ import org.junit.Test;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
 import org.apache.catalina.startup.TomcatBaseTest;
-import org.apache.tomcat.jni.Error;
 import org.apache.tomcat.jni.Pool;
 import org.apache.tomcat.util.compat.JreCompat;
 
@@ -90,8 +89,8 @@ public class TestXxxEndpoint extends TomcatBaseTest {
 // Bind the server socket
 int ret = org.apache.tomcat.jni.Socket.bind(serverSock, inetAddress);
 if (ret != 0) {
-log.error("Could not bind: " + Error.strerror(ret));
-throw (new Exception(Error.strerror(ret)));
+log.error("Could not bind: " + 
org.apache.tomcat.jni.Error.strerror(ret));
+throw (new Exception(org.apache.tomcat.jni.Error.strerror(ret)));
 }
 return serverSock;
 }


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



Re: Tomcat Native 2.0 Update

2022-05-30 Thread Rémy Maucherat
On Mon, May 30, 2022 at 6:49 PM Mark Thomas  wrote:
>
> Hi all,
>
> I have made some progress. I have a trimmed down Tomcat Native 2.0 built
> with OpenSSL 3.0 working locally with Tomcat 10.1.x. I also have it
> working with the OpenSSL 3 FIPS provider.
>
> I have also been thinking about Tomcat Native 1.2.x and 2.0.x
> interoperability.
>
> Since Native 2.0 is mostly (apart from one new FIPS method) a subset of
> Native 1.2 it should be relatively easy for 10.1.x to work with Native
> 2.0.x or 1.2.x.
>
> Allowing Native 1.2.x use with Tomcat 10.1.x should make it easier on
> downstream distributions as it removes the need for them to update to
> APR 1.7.x and OpenSSL 3.0.x
>
> Getting 10.0.x and earlier working with Native 2.0.x is a little
> trickier although it doable if the limits are:
> - No APR/Native connector
> - No application usage of o.a.t.u.jni (as most of the native code is
>removed)
>
> Enabling Native 2.0.x use with Tomcat 10.0.x and earlier opens up the
> possibility of OpenSSL FIPS that doesn't depend on an unsupported
> version of OpenSSL.
>
> I am currently thinking along the following lines:
>
> - release Tomcat Native 1.2.34 that includes:
>- refactoring the caching of the FileInfo and Sockaddr classes so
>  that are only cached if used
>- any additional refactoring to allow Native 1.2.x to be used in
>  Tomcat 10.1.x with all the deprecated code removed
>
> - make Tomcat Native 1.2.34 the minimum required Tomcat Native version
>for Tomcat 10.1.x
>
> - release Tomcat Native 2.0.0
>
> - make Tomcat Native 2.0.0 the minimum recommended Tomcat Native
>version for Tomcat 10.1.x
>
> - updates as required to Tomcat Native 1.2.x, 2.0.x and Tomcat
><=10.0.x to allow Tomcat Native 2.0.x to be used (reasonably) safely
>with Tomcat <=10.0.x
>
> My plan is to do most of this work locally to make sure I haven't missed
> anything and then start committing and releasing in the order above.

Sounds great. Any subtask for me or do you prefer doing it alone ?

> Additional tasks that don't have the any ordering dependencies (that I
> can think of) include:
>
> - update the Tomcat Native 2.0.x code not to use any of the deprecated
>OpenSSL APIs
>
> - when in FIPS required mode, consider checking individually negotiated
>ciphers are from the FIPS provider in case the user has multiple
>providers configured
>
> - Get LibreSSL fully working (my understanding that may be wrong is that
>it isn't currently working)

Rémy

> Mark
>
> -
> 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



Tomcat Native 2.0 Update

2022-05-30 Thread Mark Thomas

Hi all,

I have made some progress. I have a trimmed down Tomcat Native 2.0 built 
with OpenSSL 3.0 working locally with Tomcat 10.1.x. I also have it 
working with the OpenSSL 3 FIPS provider.


I have also been thinking about Tomcat Native 1.2.x and 2.0.x 
interoperability.


Since Native 2.0 is mostly (apart from one new FIPS method) a subset of 
Native 1.2 it should be relatively easy for 10.1.x to work with Native 
2.0.x or 1.2.x.


Allowing Native 1.2.x use with Tomcat 10.1.x should make it easier on 
downstream distributions as it removes the need for them to update to 
APR 1.7.x and OpenSSL 3.0.x


Getting 10.0.x and earlier working with Native 2.0.x is a little 
trickier although it doable if the limits are:

- No APR/Native connector
- No application usage of o.a.t.u.jni (as most of the native code is
  removed)

Enabling Native 2.0.x use with Tomcat 10.0.x and earlier opens up the 
possibility of OpenSSL FIPS that doesn't depend on an unsupported 
version of OpenSSL.


I am currently thinking along the following lines:

- release Tomcat Native 1.2.34 that includes:
  - refactoring the caching of the FileInfo and Sockaddr classes so
that are only cached if used
  - any additional refactoring to allow Native 1.2.x to be used in
Tomcat 10.1.x with all the deprecated code removed

- make Tomcat Native 1.2.34 the minimum required Tomcat Native version
  for Tomcat 10.1.x

- release Tomcat Native 2.0.0

- make Tomcat Native 2.0.0 the minimum recommended Tomcat Native
  version for Tomcat 10.1.x

- updates as required to Tomcat Native 1.2.x, 2.0.x and Tomcat
  <=10.0.x to allow Tomcat Native 2.0.x to be used (reasonably) safely
  with Tomcat <=10.0.x

My plan is to do most of this work locally to make sure I haven't missed 
anything and then start committing and releasing in the order above.


Additional tasks that don't have the any ordering dependencies (that I 
can think of) include:


- update the Tomcat Native 2.0.x code not to use any of the deprecated
  OpenSSL APIs

- when in FIPS required mode, consider checking individually negotiated
  ciphers are from the FIPS provider in case the user has multiple
  providers configured

- Get LibreSSL fully working (my understanding that may be wrong is that
  it isn't currently working)

Mark

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



[tomcat] branch 8.5.x updated: Deprecate unused code

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 81f48e0bd6 Deprecate unused code
81f48e0bd6 is described below

commit 81f48e0bd608912b8be131d4cd71a0b8daf8fd3e
Author: Mark Thomas 
AuthorDate: Tue May 24 19:14:37 2022 +0100

Deprecate unused code
---
 java/org/apache/tomcat/jni/BIOCallback.java  |  3 ++
 java/org/apache/tomcat/jni/Buffer.java   | 21 ++
 java/org/apache/tomcat/jni/Error.java|  3 ++
 java/org/apache/tomcat/jni/Library.java  |  1 +
 java/org/apache/tomcat/jni/PasswordCallback.java |  3 ++
 java/org/apache/tomcat/jni/Pool.java | 33 +
 java/org/apache/tomcat/jni/SSL.java  | 37 
 java/org/apache/tomcat/jni/SSLContext.java   | 28 ++
 8 files changed, 129 insertions(+)

diff --git a/java/org/apache/tomcat/jni/BIOCallback.java 
b/java/org/apache/tomcat/jni/BIOCallback.java
index 7dfdce0512..ea9ccff67c 100644
--- a/java/org/apache/tomcat/jni/BIOCallback.java
+++ b/java/org/apache/tomcat/jni/BIOCallback.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Open SSL BIO Callback Interface
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public interface BIOCallback {
 
 /**
diff --git a/java/org/apache/tomcat/jni/Buffer.java 
b/java/org/apache/tomcat/jni/Buffer.java
index 9802b114a3..2645666357 100644
--- a/java/org/apache/tomcat/jni/Buffer.java
+++ b/java/org/apache/tomcat/jni/Buffer.java
@@ -28,7 +28,10 @@ public class Buffer {
  * Allocate a new ByteBuffer from memory
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer malloc(int size);
 
 /**
@@ -36,7 +39,10 @@ public class Buffer {
  * @param num Number of elements.
  * @param size Length in bytes of each element.
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer calloc(int num, int size);
 
 /**
@@ -44,7 +50,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer palloc(long p, int size);
 
 /**
@@ -52,7 +61,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer pcalloc(long p, int size);
 
 /**
@@ -62,7 +74,10 @@ public class Buffer {
  * @param mem The memory to use
  * @param size The amount of memory to use
  * @return The ByteBuffer with attached memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer create(long mem, int size);
 
 /**
@@ -70,7 +85,10 @@ public class Buffer {
  * Warning : Call this method only on ByteBuffers
  * that were created by calling Buffer.alloc or Buffer.calloc.
  * @param buf Previously allocated ByteBuffer to be freed.
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native void free(ByteBuffer buf);
 
 /**
@@ -84,7 +102,10 @@ public class Buffer {
  * Returns the allocated memory size of the ByteBuffer.
  * @param buf Previously allocated ByteBuffer.
  * @return the size
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native long size(ByteBuffer buf);
 
 }
diff --git a/java/org/apache/tomcat/jni/Error.java 
b/java/org/apache/tomcat/jni/Error.java
index bd3d87b390..a72cc15d56 100644
--- a/java/org/apache/tomcat/jni/Error.java
+++ b/java/org/apache/tomcat/jni/Error.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Error
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public class Error extends Exception {
 
 private static final long serialVersionUID = 1L;
diff --git a/java/org/apache/tomcat/jni/Library.java 
b/java/org/apache/tomcat/jni/Library.java
index 8e4f40cfa5..4c6cdfc054 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -155,6 +155,7 @@ public final class Library {
 public static int APR_MMAP_LIMIT;
 

[tomcat] branch 10.0.x updated: Deprecate unused code

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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 791e8af3bd Deprecate unused code
791e8af3bd is described below

commit 791e8af3bd2a36d122c870fb18f2874405c81568
Author: Mark Thomas 
AuthorDate: Tue May 24 19:14:37 2022 +0100

Deprecate unused code
---
 java/org/apache/tomcat/jni/BIOCallback.java  |  3 ++
 java/org/apache/tomcat/jni/Buffer.java   | 21 ++
 java/org/apache/tomcat/jni/Error.java|  3 ++
 java/org/apache/tomcat/jni/Library.java  |  1 +
 java/org/apache/tomcat/jni/PasswordCallback.java |  3 ++
 java/org/apache/tomcat/jni/Pool.java | 33 +
 java/org/apache/tomcat/jni/SSL.java  | 37 
 java/org/apache/tomcat/jni/SSLContext.java   | 28 ++
 8 files changed, 129 insertions(+)

diff --git a/java/org/apache/tomcat/jni/BIOCallback.java 
b/java/org/apache/tomcat/jni/BIOCallback.java
index 7dfdce0512..ea9ccff67c 100644
--- a/java/org/apache/tomcat/jni/BIOCallback.java
+++ b/java/org/apache/tomcat/jni/BIOCallback.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Open SSL BIO Callback Interface
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public interface BIOCallback {
 
 /**
diff --git a/java/org/apache/tomcat/jni/Buffer.java 
b/java/org/apache/tomcat/jni/Buffer.java
index 9802b114a3..2645666357 100644
--- a/java/org/apache/tomcat/jni/Buffer.java
+++ b/java/org/apache/tomcat/jni/Buffer.java
@@ -28,7 +28,10 @@ public class Buffer {
  * Allocate a new ByteBuffer from memory
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer malloc(int size);
 
 /**
@@ -36,7 +39,10 @@ public class Buffer {
  * @param num Number of elements.
  * @param size Length in bytes of each element.
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer calloc(int num, int size);
 
 /**
@@ -44,7 +50,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer palloc(long p, int size);
 
 /**
@@ -52,7 +61,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer pcalloc(long p, int size);
 
 /**
@@ -62,7 +74,10 @@ public class Buffer {
  * @param mem The memory to use
  * @param size The amount of memory to use
  * @return The ByteBuffer with attached memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer create(long mem, int size);
 
 /**
@@ -70,7 +85,10 @@ public class Buffer {
  * Warning : Call this method only on ByteBuffers
  * that were created by calling Buffer.alloc or Buffer.calloc.
  * @param buf Previously allocated ByteBuffer to be freed.
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native void free(ByteBuffer buf);
 
 /**
@@ -84,7 +102,10 @@ public class Buffer {
  * Returns the allocated memory size of the ByteBuffer.
  * @param buf Previously allocated ByteBuffer.
  * @return the size
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native long size(ByteBuffer buf);
 
 }
diff --git a/java/org/apache/tomcat/jni/Error.java 
b/java/org/apache/tomcat/jni/Error.java
index bd3d87b390..a72cc15d56 100644
--- a/java/org/apache/tomcat/jni/Error.java
+++ b/java/org/apache/tomcat/jni/Error.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Error
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public class Error extends Exception {
 
 private static final long serialVersionUID = 1L;
diff --git a/java/org/apache/tomcat/jni/Library.java 
b/java/org/apache/tomcat/jni/Library.java
index 09fe13a014..abda71f948 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -185,6 +185,7 @@ public final class Library {
 public static int APR_MMAP_LIMIT;
 
  

[tomcat] branch 9.0.x updated: Deprecate unused code

2022-05-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 9013b6987f Deprecate unused code
9013b6987f is described below

commit 9013b6987feee7cb71352c69f97c630610c43c21
Author: Mark Thomas 
AuthorDate: Tue May 24 19:14:37 2022 +0100

Deprecate unused code
---
 java/org/apache/tomcat/jni/BIOCallback.java  |  3 ++
 java/org/apache/tomcat/jni/Buffer.java   | 21 ++
 java/org/apache/tomcat/jni/Error.java|  3 ++
 java/org/apache/tomcat/jni/Library.java  |  1 +
 java/org/apache/tomcat/jni/PasswordCallback.java |  3 ++
 java/org/apache/tomcat/jni/Pool.java | 33 +
 java/org/apache/tomcat/jni/SSL.java  | 37 
 java/org/apache/tomcat/jni/SSLContext.java   | 28 ++
 8 files changed, 129 insertions(+)

diff --git a/java/org/apache/tomcat/jni/BIOCallback.java 
b/java/org/apache/tomcat/jni/BIOCallback.java
index 7dfdce0512..ea9ccff67c 100644
--- a/java/org/apache/tomcat/jni/BIOCallback.java
+++ b/java/org/apache/tomcat/jni/BIOCallback.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Open SSL BIO Callback Interface
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public interface BIOCallback {
 
 /**
diff --git a/java/org/apache/tomcat/jni/Buffer.java 
b/java/org/apache/tomcat/jni/Buffer.java
index 9802b114a3..2645666357 100644
--- a/java/org/apache/tomcat/jni/Buffer.java
+++ b/java/org/apache/tomcat/jni/Buffer.java
@@ -28,7 +28,10 @@ public class Buffer {
  * Allocate a new ByteBuffer from memory
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer malloc(int size);
 
 /**
@@ -36,7 +39,10 @@ public class Buffer {
  * @param num Number of elements.
  * @param size Length in bytes of each element.
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer calloc(int num, int size);
 
 /**
@@ -44,7 +50,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer palloc(long p, int size);
 
 /**
@@ -52,7 +61,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer pcalloc(long p, int size);
 
 /**
@@ -62,7 +74,10 @@ public class Buffer {
  * @param mem The memory to use
  * @param size The amount of memory to use
  * @return The ByteBuffer with attached memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer create(long mem, int size);
 
 /**
@@ -70,7 +85,10 @@ public class Buffer {
  * Warning : Call this method only on ByteBuffers
  * that were created by calling Buffer.alloc or Buffer.calloc.
  * @param buf Previously allocated ByteBuffer to be freed.
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native void free(ByteBuffer buf);
 
 /**
@@ -84,7 +102,10 @@ public class Buffer {
  * Returns the allocated memory size of the ByteBuffer.
  * @param buf Previously allocated ByteBuffer.
  * @return the size
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native long size(ByteBuffer buf);
 
 }
diff --git a/java/org/apache/tomcat/jni/Error.java 
b/java/org/apache/tomcat/jni/Error.java
index bd3d87b390..a72cc15d56 100644
--- a/java/org/apache/tomcat/jni/Error.java
+++ b/java/org/apache/tomcat/jni/Error.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Error
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public class Error extends Exception {
 
 private static final long serialVersionUID = 1L;
diff --git a/java/org/apache/tomcat/jni/Library.java 
b/java/org/apache/tomcat/jni/Library.java
index 09fe13a014..abda71f948 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -185,6 +185,7 @@ public final class Library {
 public static int APR_MMAP_LIMIT;
 

[tomcat] branch main updated: Deprecate unused code

2022-05-30 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 b8d96d1abb Deprecate unused code
b8d96d1abb is described below

commit b8d96d1abb6a127141c24bd669a0ca13d86cdba8
Author: Mark Thomas 
AuthorDate: Tue May 24 19:14:37 2022 +0100

Deprecate unused code
---
 java/org/apache/tomcat/jni/BIOCallback.java  |  3 ++
 java/org/apache/tomcat/jni/Buffer.java   | 21 ++
 java/org/apache/tomcat/jni/Error.java|  3 ++
 java/org/apache/tomcat/jni/Library.java  |  1 +
 java/org/apache/tomcat/jni/PasswordCallback.java |  3 ++
 java/org/apache/tomcat/jni/Pool.java | 33 +
 java/org/apache/tomcat/jni/SSL.java  | 37 
 java/org/apache/tomcat/jni/SSLContext.java   | 28 ++
 8 files changed, 129 insertions(+)

diff --git a/java/org/apache/tomcat/jni/BIOCallback.java 
b/java/org/apache/tomcat/jni/BIOCallback.java
index 7dfdce0512..ea9ccff67c 100644
--- a/java/org/apache/tomcat/jni/BIOCallback.java
+++ b/java/org/apache/tomcat/jni/BIOCallback.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Open SSL BIO Callback Interface
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public interface BIOCallback {
 
 /**
diff --git a/java/org/apache/tomcat/jni/Buffer.java 
b/java/org/apache/tomcat/jni/Buffer.java
index 9802b114a3..2645666357 100644
--- a/java/org/apache/tomcat/jni/Buffer.java
+++ b/java/org/apache/tomcat/jni/Buffer.java
@@ -28,7 +28,10 @@ public class Buffer {
  * Allocate a new ByteBuffer from memory
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer malloc(int size);
 
 /**
@@ -36,7 +39,10 @@ public class Buffer {
  * @param num Number of elements.
  * @param size Length in bytes of each element.
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer calloc(int num, int size);
 
 /**
@@ -44,7 +50,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer palloc(long p, int size);
 
 /**
@@ -52,7 +61,10 @@ public class Buffer {
  * @param p The pool to allocate from
  * @param size The amount of memory to allocate
  * @return The ByteBuffer with allocated memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer pcalloc(long p, int size);
 
 /**
@@ -62,7 +74,10 @@ public class Buffer {
  * @param mem The memory to use
  * @param size The amount of memory to use
  * @return The ByteBuffer with attached memory
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native ByteBuffer create(long mem, int size);
 
 /**
@@ -70,7 +85,10 @@ public class Buffer {
  * Warning : Call this method only on ByteBuffers
  * that were created by calling Buffer.alloc or Buffer.calloc.
  * @param buf Previously allocated ByteBuffer to be freed.
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native void free(ByteBuffer buf);
 
 /**
@@ -84,7 +102,10 @@ public class Buffer {
  * Returns the allocated memory size of the ByteBuffer.
  * @param buf Previously allocated ByteBuffer.
  * @return the size
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public static native long size(ByteBuffer buf);
 
 }
diff --git a/java/org/apache/tomcat/jni/Error.java 
b/java/org/apache/tomcat/jni/Error.java
index bd3d87b390..a72cc15d56 100644
--- a/java/org/apache/tomcat/jni/Error.java
+++ b/java/org/apache/tomcat/jni/Error.java
@@ -19,7 +19,10 @@ package org.apache.tomcat.jni;
 /** Error
  *
  * @author Mladen Turk
+ *
+ * @deprecated Unused. Will be removed in Tomcat 10.1
  */
+@Deprecated
 public class Error extends Exception {
 
 private static final long serialVersionUID = 1L;
diff --git a/java/org/apache/tomcat/jni/Library.java 
b/java/org/apache/tomcat/jni/Library.java
index 09fe13a014..abda71f948 100644
--- a/java/org/apache/tomcat/jni/Library.java
+++ b/java/org/apache/tomcat/jni/Library.java
@@ -185,6 +185,7 @@ public final class Library {
 public static int APR_MMAP_LIMIT;
 
 

[tomcat] branch 8.5.x updated: Additional fix for BZ 65118 - NPE on HTTP/2 prune

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 562250db94 Additional fix for BZ 65118 - NPE on HTTP/2 prune
562250db94 is described below

commit 562250db9497d199b827ed2060f4440125ada6bc
Author: Mark Thomas 
AuthorDate: Fri May 27 11:26:33 2022 +0100

Additional fix for BZ 65118 - NPE on HTTP/2 prune

Expand priorityTree sync to include looking up the streams to be
reprioritised.
---
 .../org/apache/coyote/http2/Http2UpgradeHandler.java | 20 
 webapps/docs/changelog.xml   |  5 +
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index b1119a7135..e93e29dc49 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -1760,15 +1760,19 @@ class Http2UpgradeHandler extends AbstractStream 
implements InternalHttpUpgradeH
 
 increaseOverheadCount(FrameType.PRIORITY);
 
-AbstractNonZeroStream abstractNonZeroStream = 
getAbstractNonZeroStream(streamId);
-if (abstractNonZeroStream == null) {
-abstractNonZeroStream = createRemoteStream(streamId);
-}
-AbstractStream parentStream = getAbstractNonZeroStream(parentStreamId);
-if (parentStream == null) {
-parentStream = this;
-}
 synchronized (priorityTreeLock) {
+// Need to look up stream and parent stream inside the lock else it
+// is possible for a stream to be recycled before it is
+// reprioritised. This can result in incorrect references to the
+// non-recycled stream being retained after reprioritisation.
+AbstractNonZeroStream abstractNonZeroStream = 
getAbstractNonZeroStream(streamId);
+if (abstractNonZeroStream == null) {
+abstractNonZeroStream = createRemoteStream(streamId);
+}
+AbstractStream parentStream = 
getAbstractNonZeroStream(parentStreamId);
+if (parentStream == null) {
+parentStream = this;
+}
 abstractNonZeroStream.rePrioritise(parentStream, exclusive, 
weight);
 }
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 234fdadb3b..5d14420169 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -129,6 +129,11 @@
   
   
 
+  
+Additional fix for 65118. Fix a potential
+NullPointerException when pruning closed HTTP/2 streams
+from the connection. (markt)
+  
   
 66076: When using TLS with non-blocking writes and the NIO
 connector, ensure that flushing the buffers attempts to empty all of 
the


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