dodona-edu / judge-java

JUnit-based Java judge for the Dodona learning environment
MIT License
1 stars 1 forks source link

Use a SecurityManager and ExitException to handle System.exit-students #21

Closed ninewise closed 5 years ago

ninewise commented 5 years ago

When using System.exit(...), an ExitException will be thrown. This has the same effect from the user's point of view (the code exits) as it winds up call hierarchy to crash, with the exception it can be caught and checked by the test code. If the ExitException is not caught, the submission is evaluated as incorrect: students shouldn't use System.exit in their code unless asked.

Fixes #17

thepieterdc commented 5 years ago

Did you verify that the ExpectedSystemExit-rule still works after applying these modifications? Some teachers might be using this.

ninewise commented 5 years ago

Now I did, and I added tests for it. The system-rules Rule just overrides my security manager, so this change wouldn't interfere with it.