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 46cb8c3 Remove use of JreCompat as it is not required with Java 11+
46cb8c3 is described below
commit 46cb8c3b407a7628613a4a1f5fed5a0297122c8a
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 28 13:43:47 2021 +0100
Remove use of JreCompat as it is not required with Java 11+
---
java/org/apache/tomcat/websocket/server/WsSci.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/java/org/apache/tomcat/websocket/server/WsSci.java
b/java/org/apache/tomcat/websocket/server/WsSci.java
index 007cac6..8b07ce3 100644
--- a/java/org/apache/tomcat/websocket/server/WsSci.java
+++ b/java/org/apache/tomcat/websocket/server/WsSci.java
@@ -31,8 +31,6 @@ import jakarta.websocket.server.ServerApplicationConfig;
import jakarta.websocket.server.ServerEndpoint;
import jakarta.websocket.server.ServerEndpointConfig;
-import org.apache.tomcat.util.compat.JreCompat;
-
/**
* Registers an interest in any class that is annotated with
* {@link ServerEndpoint} so that Endpoint can be published via the WebSocket
@@ -62,12 +60,11 @@ public class WsSci implements ServletContainerInitializer {
String wsPackage = ContainerProvider.class.getName();
wsPackage = wsPackage.substring(0, wsPackage.lastIndexOf('.') + 1);
for (Class<?> clazz : clazzes) {
- JreCompat jreCompat = JreCompat.getInstance();
int modifiers = clazz.getModifiers();
if (!Modifier.isPublic(modifiers) ||
Modifier.isAbstract(modifiers) ||
Modifier.isInterface(modifiers) ||
- !jreCompat.isExported(clazz)) {
+ isExported(clazz)) {
// Non-public, abstract, interface or not in an exported
// package (Java 9+) - skip it.
continue;
@@ -131,6 +128,13 @@ public class WsSci implements ServletContainerInitializer {
}
+ private static boolean isExported(Class<?> type) {
+ String packageName = type.getPackage().getName();
+ Module module = type.getModule();
+ return module.isExported(packageName);
+ }
+
+
static WsServerContainer init(ServletContext servletContext,
boolean initBySciMechanism) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]