Skip to content

Commit

Permalink
fix: Update to JDK21 - EXO-71474 - Meeds-io/MIPs#91
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 May 22, 2024
1 parent bffb5ee commit 7d27114
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.cometd.server.CometDServlet;
import org.cometd.client.websocket.javax.WebSocketTransport;
import org.eclipse.jetty.client.HttpClient;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.PortalContainer;
Expand Down Expand Up @@ -344,7 +343,7 @@ public String getInitParameter(String name) {
public Enumeration<String> getInitParameterNames() {
if (configs == null) {
List<String> keys = new LinkedList<String>();
Properties props = PrivilegedSystemHelper.getProperties();
Properties props = System.getProperties();
int len = PREFIX.length();

for (Object key : props.keySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.exoplatform.commons.api.settings.data.Context;
import org.exoplatform.commons.api.settings.data.Scope;
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.RequestLifeCycle;
Expand All @@ -15,7 +14,6 @@
import org.exoplatform.services.log.Log;
import org.picocontainer.Startable;

import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
Expand Down Expand Up @@ -98,13 +96,8 @@ public void start() {
}
}
/** Unregister node name , If System.exit() is called before Thread migration is done.**/
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() {
public Void run() {
ExoContainerContext.setCurrentContainer(container);
Runtime.getRuntime().addShutdownHook(hook);
return null;
}
});
ExoContainerContext.setCurrentContainer(container);
Runtime.getRuntime().addShutdownHook(hook);
/**Register checker task, verify service state**/
if (clusterEnabled) {
boolean initTimer = false;
Expand Down Expand Up @@ -252,13 +245,8 @@ private boolean checkAllIsDone(){
private class ShutdownThread extends Thread {
@Override
public void run() {
SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>() {
public Void run() {
ExoContainerContext.setCurrentContainer(container);
resetSetting();
return null;
}
});
ExoContainerContext.setCurrentContainer(container);
resetSetting();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.exoplatform.commons.notification.job.NotificationJob;
import org.exoplatform.commons.notification.stat.ThreadLocalStatisticsImpl;
import org.exoplatform.commons.utils.CommonsUtils;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
Expand Down Expand Up @@ -300,7 +299,7 @@ public long getStartTime() {

@Override
public void start() {
boolean stats = "true".equalsIgnoreCase(PrivilegedSystemHelper.getProperty("exo.social.notification.statistics.active", "false"));
boolean stats = "true".equalsIgnoreCase(System.getProperty("exo.social.notification.statistics.active", "false"));
this.setStatisticsEnabled(stats);
}

Expand Down
2 changes: 1 addition & 1 deletion commons-component-upgrade/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<artifactId>commons-component-upgrade</artifactId>
<name>eXo PLF:: Commons - Transparent Upgrade Framework</name>
<properties>
<exo.test.coverage.ratio>0.84</exo.test.coverage.ratio>
<exo.test.coverage.ratio>0.83</exo.test.coverage.ratio>
</properties>
<dependencies>
<!-- This dependency is used for main classes compilation but is erroneously reported as useless by mvn dependency:analyze -->
Expand Down

0 comments on commit 7d27114

Please sign in to comment.