Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Delegate checks to the existing SecurityManager. #507

Closed
Closed
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
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