Skip to content

Commit

Permalink
fix: Update to JDK21 - EXO-71474 - Meeds-io/MIPs#91 (#1999)
Browse files Browse the repository at this point in the history
Remove usage of SecurityManager as it is deprecated for removal in jdk21
Remove also usage of classes
- SecurityHelper
- PrivilegedSystemHelper
- PrivilegedFileHelper
- SecureList
- SecureSet
- SecureCollections

These classes are here only to use securityManager, and as it is
removed, it is no more necessary

Resolves Meeds-io/MIPs#91
  • Loading branch information
rdenarie authored and exo-swf committed May 22, 2024
1 parent 5840c61 commit 2c2c0e4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
15 changes: 15 additions & 0 deletions packaging/plf-tomcat-resources/src/main/resources/bin/setenv.bat
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,21 @@ SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens java.xml/com.sun.org.apache.
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.lang.module=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/jdk.internal.module=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.time=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/sun.security.util=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/javax.net.ssl=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.util.zip=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.util.jar=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.util.regex=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.security=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.nio.channels=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED
SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED

SET JDK_JAVA_OPTIONS=%JDK_JAVA_OPTIONS% -noverify

REM # Set the window name
Expand Down
14 changes: 14 additions & 0 deletions packaging/plf-tomcat-resources/src/main/resources/bin/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,20 @@ JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.desktop/java.awt.font=ALL-U
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.rmi/sun.rmi.transport=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens java.xml/com.sun.org.apache.xerces.internal.parsers=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.time=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/sun.security.util=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/javax.net.ssl=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.util.zip=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.util.jar=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.util.regex=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.security=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.nio.channels=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED"
JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS -noverify"

export JDK_JAVA_OPTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.RootContainer;

import java.security.PrivilegedAction;

/**
*
*/
Expand All @@ -45,25 +42,15 @@ public void lifecycleEvent(LifecycleEvent event) {
*/
public void createPortalContainers() {
final RootContainer rootContainer = RootContainer.getInstance();
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() {
public Void run() {
rootContainer.createPortalContainers();
return null;
}
});
rootContainer.createPortalContainers();
}

/**
* Ensure that the root container is stopped properly since the shutdown hook
* doesn't work in some cases for example with tomcat when we call the stop command
*/
public void releasePortalContainers() {
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() {
public Void run() {
RootContainer.getInstance().stop();
return null;
}
});
RootContainer.getInstance().stop();
}

}

0 comments on commit 2c2c0e4

Please sign in to comment.