Skip to content

Fix warnings about java security manager #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions client/src/com/mirth/connect/client/ui/OSXAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.AccessController;
import java.util.List;

import org.apache.commons.lang3.math.NumberUtils;
import org.glassfish.jersey.internal.util.ReflectionHelper;

public class OSXAdapter implements InvocationHandler {

Expand Down Expand Up @@ -280,7 +278,7 @@ protected static Object getApplication() throws Exception {

protected static void setHandler(InvocationHandler adapter, String interfaceName, String applicationSetter) throws Exception {
Class<?> handlerInterface = Class.forName(interfaceName);
Object handlerImpl = Proxy.newProxyInstance(AccessController.doPrivileged(ReflectionHelper.getClassLoaderPA(handlerInterface)), new Class[] {
Object handlerImpl = Proxy.newProxyInstance(handlerInterface.getClassLoader(), new Class[] {
handlerInterface }, adapter);
Object application = getApplication();
application.getClass().getMethod(applicationSetter, handlerInterface).invoke(application, handlerImpl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -23,8 +22,6 @@
import javax.swing.JPanel;
import javax.swing.SwingWorker;

import org.glassfish.jersey.internal.util.ReflectionHelper;

import com.mirth.connect.client.core.ClientException;
import com.mirth.connect.client.ui.ConnectorTypeDecoration;
import com.mirth.connect.client.ui.PlatformUI;
Expand Down Expand Up @@ -199,7 +196,7 @@ public final <T> T getServlet(final Class<T> servletInterface, final String work
*/
@SuppressWarnings("unchecked")
public final <T> T getServlet(final Class<T> servletInterface, final String workerDisplayText, final String errorText, final ResponseHandler responseHandler, final String workerId) {
return (T) Proxy.newProxyInstance(AccessController.doPrivileged(ReflectionHelper.getClassLoaderPA(servletInterface)), new Class[] {
return (T) Proxy.newProxyInstance(servletInterface.getClassLoader(), new Class[] {
servletInterface }, new InvocationHandler() {
@Override
public Object invoke(final Object proxy, final Method method, final Object[] args) throws ClientException {
Expand Down
4 changes: 1 addition & 3 deletions server/src/com/mirth/connect/client/core/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.lang.reflect.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.AccessController;
import java.security.Provider;
import java.text.SimpleDateFormat;
import java.util.Calendar;
Expand Down Expand Up @@ -51,7 +50,6 @@
import org.glassfish.jersey.client.proxy.WebResourceFactory;
import org.glassfish.jersey.client.spi.Connector;
import org.glassfish.jersey.client.spi.ConnectorProvider;
import org.glassfish.jersey.internal.util.ReflectionHelper;
import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.reflections.Reflections;

Expand Down Expand Up @@ -245,7 +243,7 @@ public <T> T getServlet(Class<T> servletInterface, ExecuteType executeType) {

@SuppressWarnings("unchecked")
public <T> T getServlet(final Class<T> servletInterface, final ExecuteType executeType, final Map<String, List<String>> customHeaders) {
return (T) Proxy.newProxyInstance(AccessController.doPrivileged(ReflectionHelper.getClassLoaderPA(servletInterface)), new Class[] {
return (T) Proxy.newProxyInstance(servletInterface.getClassLoader(), new Class[] {
servletInterface }, new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws ClientException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public class MirthJavaScriptThreadFactory implements ThreadFactory {
private final String namePrefix;

MirthJavaScriptThreadFactory() {
SecurityManager securityManager = System.getSecurityManager();
group = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
group = Thread.currentThread().getThreadGroup();
namePrefix = "pool-" + poolNumber.getAndIncrement() + "-thread-";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.security.AccessController;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -82,7 +81,6 @@
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;

import org.glassfish.jersey.internal.util.ReflectionHelper;
import org.glassfish.jersey.media.multipart.Boundary;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
import org.glassfish.jersey.media.multipart.FormDataParam;
Expand Down Expand Up @@ -148,7 +146,7 @@ public static <C> C newResource(final Class<C> resourceInterface,
final List<Cookie> cookies,
final Form form) {

return (C) Proxy.newProxyInstance(AccessController.doPrivileged(ReflectionHelper.getClassLoaderPA(resourceInterface)),
return (C) Proxy.newProxyInstance(resourceInterface.getClassLoader(),
new Class[] {resourceInterface},
new WebResourceFactory(ignoreResourcePath ? target : addPathFromAnnotation(resourceInterface, target),
headers, cookies, form));
Expand Down