Skip to content

Commit

Permalink
fix: Update to JDK21 - EXO-71474 - Meeds-io/MIPs#91 (#2356)
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
  • Loading branch information
rdenarie authored May 22, 2024
1 parent 61fb516 commit 601fec3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.io.IOException;
import java.io.InputStream;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
Expand All @@ -34,7 +33,6 @@
import javax.activation.MimeTypeParseException;

import org.exoplatform.commons.utils.MimeTypeResolver;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.component.BaseComponentPlugin;
import org.exoplatform.container.configuration.ConfigurationException;
import org.exoplatform.container.configuration.ConfigurationManager;
Expand Down Expand Up @@ -134,33 +132,28 @@ public ExtendedMimeTypeResolver(ConfigurationManager configService, InitParams p
*/
public void addPlugin(final MimeTypeMap typesMap) {
try {
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>() {
public Void run() throws Exception {
for (String path : typesMap.getPaths()) {
for (String path : typesMap.getPaths()) {
try {
Scanner scanner = null;
InputStream stream = configService.getInputStream(path);
if (stream != null) {
scanner = new Scanner(stream, "ISO-8859-1");
}
if (scanner == null) {
LOG.warn("Cannot read extended mimetypes from path " + path);
} else {
try {
Scanner scanner = null;
InputStream stream = configService.getInputStream(path);
if (stream != null) {
scanner = new Scanner(stream, "ISO-8859-1");
while (scanner.hasNextLine()) {
processLine(scanner.nextLine());
}
if (scanner == null) {
LOG.warn("Cannot read extended mimetypes from path " + path);
} else {
try {
while (scanner.hasNextLine()) {
processLine(scanner.nextLine());
}
} finally {
scanner.close();
}
}
} catch (IOException e) {
throw new IOException("Error loadinng extended mimetypes from path " + path + ": " + e.getMessage(), e);
} finally {
scanner.close();
}
}
return null;
} catch (Exception e) {
throw new IOException("Error loadinng extended mimetypes from path " + path + ": " + e.getMessage(), e);
}
});
}
} catch (IOException e) {
throw new InternalError("Unable to load extended mimetypes: " + e.toString());
}
Expand Down
10 changes: 0 additions & 10 deletions ext/authoring/services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,4 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{argLine} --add-opens=java.management/java.lang.management=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED </argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 601fec3

Please sign in to comment.