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 SecurityManager from Kernel as it is deprecated for removal in jdk21
Remove also 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 committed May 3, 2024
1 parent 9edcfb8 commit 4c42911
Show file tree
Hide file tree
Showing 74 changed files with 853 additions and 4,603 deletions.

This file was deleted.

6 changes: 0 additions & 6 deletions exo.kernel.commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.exoplatform.commons;

import org.exoplatform.commons.utils.PrivilegedSystemHelper;

public class Environment
{

Expand All @@ -43,12 +41,12 @@ public class Environment

private Environment()
{
String catalinaHome = PrivilegedSystemHelper.getProperty("catalina.home");
String jbossHome = PrivilegedSystemHelper.getProperty("jboss.home.dir");
String jettyHome = PrivilegedSystemHelper.getProperty("jetty.home");
String websphereHome = PrivilegedSystemHelper.getProperty("was.install.root");
String weblogicHome = PrivilegedSystemHelper.getProperty("weblogic.Name");
String standAlone = PrivilegedSystemHelper.getProperty("maven.exoplatform.dir");
String catalinaHome = System.getProperty("catalina.home");
String jbossHome = System.getProperty("jboss.home.dir");
String jettyHome = System.getProperty("jetty.home");
String websphereHome = System.getProperty("was.install.root");
String weblogicHome = System.getProperty("weblogic.Name");
String standAlone = System.getProperty("maven.exoplatform.dir");
if (jbossHome != null)
{
platform_ = JBOSS_PLATFORM;
Expand Down Expand Up @@ -95,4 +93,4 @@ static public Environment getInstance()
}
return singleton_;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
*/
package org.exoplatform.commons.reflect;

import org.exoplatform.commons.utils.SecurityHelper;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -102,16 +99,7 @@ public static <A extends Annotation> Map<Method, A> resolveMethodAnnotations(fin
//
Map<Method, A> methods = new HashMap<Method, A>();

//
PrivilegedAction<Method[]> action = new PrivilegedAction<Method[]>()
{
public Method[] run()
{
return clazz.getDeclaredMethods();
}
};

for (Method method : SecurityHelper.doPrivilegedAction(action))
for (Method method : clazz.getDeclaredMethods())
{
A annotation = method.getAnnotation(methodAnnotation);
if (annotation != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public class ExceptionUtil
{
private static String LINE_SEPARATOR = PrivilegedSystemHelper.getProperty("line.separator");
private static String LINE_SEPARATOR = System.getProperty("line.separator");

static public String getExoStackTrace(Throwable t)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static public String getFileContentAsString(File file, String charset) throws IO
{
throw new IllegalArgumentException("No null file accepted");
}
FileInputStream is = PrivilegedFileHelper.fileInputStream(file);
FileInputStream is = new FileInputStream(file);
return new String(getStreamContentAsBytes(is), charset);
}

Expand Down Expand Up @@ -136,7 +136,7 @@ static public byte[] getFileContentAsBytes(String fileName) throws IOException,
{
throw new IllegalArgumentException("No null file name accepted");
}
FileInputStream is = PrivilegedFileHelper.fileInputStream(fileName);
FileInputStream is = new FileInputStream(fileName);
return getStreamContentAsBytes(is);
}

Expand Down
Loading

0 comments on commit 4c42911

Please sign in to comment.