Skip to content
Permalink
Browse files

Fix security manager issues when running on Windows 10

  • Loading branch information...
danielboudreau danielboudreau
danielboudreau authored and danielboudreau committed Oct 15, 2018
1 parent d4ea425 commit 5dc306b9771efe5b32185833f1e5649896a177a4
Showing with 23 additions and 0 deletions.
  1. +23 −0 java/test/jmri/jmrix/loconet/locormi/LnMessageServerTest.java
@@ -1,10 +1,12 @@
package jmri.jmrix.loconet.locormi;

import java.security.Permission;
import jmri.util.JUnitUtil;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/**
@@ -21,6 +23,27 @@ public void testGetInstance() throws java.rmi.RemoteException {
Assert.assertNotNull("exists", t);
}

@BeforeClass
public static void setUpClass() {
if (SM == null) {
System.setSecurityManager(new SecurityManager() {
@Override
public void checkPermission(Permission perm) {
}

@Override
public void checkPermission(Permission perm, Object context) {
}

@Override
public void checkExit(int status) {
String message = "System exit requested with error " + status;
throw new SecurityException(message);
}
});
}
}

@AfterClass
public static void tearDownClass() throws Exception {
System.setSecurityManager(SM);

0 comments on commit 5dc306b

Please sign in to comment.
You can’t perform that action at this time.