java.lang.SecurityException: Test code should never call System.exit()

GitHub | damienmg | 10 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.

Root Cause Analysis

  1. java.lang.SecurityException

    Test code should never call System.exit()

    at com.google.testing.junit.runner.util.GoogleTestSecurityManager.checkExit()
  2. com.google.testing
    GoogleTestSecurityManager.checkExit
    1. com.google.testing.junit.runner.util.GoogleTestSecurityManager.checkExit(GoogleTestSecurityManager.java:36)
    1 frame
  3. Java RT
    System.exit
    1. java.lang.Runtime.exit(Runtime.java:107)
    2. java.lang.System.exit(System.java:971)
    2 frames
  4. com.google.devtools
    PackageParserTest.testHandlesOldFormat
    1. com.google.devtools.common.options.OptionsParser.parseAndExitUponError(OptionsParser.java:193)
    2. com.google.devtools.common.options.OptionsParser.parseAndExitUponError(OptionsParser.java:172)
    3. com.google.devtools.build.android.ideinfo.PackageParser.parseArgs(PackageParser.java:163)
    4. com.google.devtools.build.android.ideinfo.PackageParserTest.testHandlesOldFormat(PackageParserTest.java:272)
    4 frames
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  6. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    6. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    9. org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    10. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    11. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    12. org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    13. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    14. org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    14 frames
  7. com.google.testing
    CancellableRequestFactory$CancellableRunner.run
    1. com.google.testing.junit.runner.junit4.CancellableRequestFactory$CancellableRunner.run(CancellableRequestFactory.java:89)
    1 frame
  8. JUnit
    JUnitCore.run
    1. org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    2. org.junit.runner.JUnitCore.run(JUnitCore.java:138)
    2 frames
  9. com.google.testing
    BazelTestRunner.main
    1. com.google.testing.junit.runner.junit4.JUnit4Runner.run(JUnit4Runner.java:114)
    2. com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:152)
    3. com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:91)
    3 frames