Security Exception with TestsCorrect::all

I get this error message (only with TestCorrect::all)

java.lang.SecurityException: Attempted to access restricted classes or methods.
	at de.unisaarland.cdl.prog2.projects.test.MySecurityManager.checkPermission(
	at java.base/java.lang.SecurityManager.checkCreateClassLoader(

I already checked the following:

  • there are no implementation specific imports
  • there are no print statements
  • there are not more imports than in a previous run that didn’t fail

Are there any other causes for SecurityExceptions?

You are using a timeout rule in your tests.
The offending rule is the one in
Such a timeout rule modifies the classes at runtime in certain situations (for instance, when the timeout is triggered) to abort execution and provide custom error messages.

Such behavior is potentially malicious and as such not allowed in student code.

1 Like

That’s kind of weird, since I had it in there previously and it worked.

Either way, I removed it and hopefully the test will run now.