Skip to content

Commit

Permalink
Delegate checks to the existing SecurityManager.
Browse files Browse the repository at this point in the history
In case one already exists.
  • Loading branch information
GUIpsp committed Sep 2, 2014
1 parent dc02d56 commit 113b9d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/cpw/mods/fml/common/launcher/FMLTweaker.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public FMLTweaker()
System.setProperty("java.net.preferIPv4Stack", "true"); //Lets do this as early as possible. Vanilla does it in Main.main
try
{
System.setSecurityManager(new FMLSecurityManager());
System.setSecurityManager(new FMLSecurityManager(System.getSecurityManager()));
}
catch (SecurityException se)
{
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/cpw/mods/fml/relauncher/FMLSecurityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
*
*/
public class FMLSecurityManager extends SecurityManager {

private SecurityManager delegate;

public FMLSecurityManager(SecurityManager delegate)
{
this.delegate=delegate;
}

@Override
public void checkPermission(Permission perm)
{
Expand All @@ -29,6 +37,10 @@ else if ("setSecurityManager".equals(permName))
{
throw new SecurityException("Cannot replace the FML security manager");
}
else if (delegate != null)
{
delegate.checkPermission(perm);
}
return;
}

Expand Down

0 comments on commit 113b9d1

Please sign in to comment.