Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suite may be empty and will produce java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 #1116

Open
juherr opened this issue Apr 30, 2024 · 3 comments

Comments

@juherr
Copy link

juherr commented Apr 30, 2024

The current implementation doesn't manage the case where the suite is empty:

Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
    Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
        at java.base/java.util.Objects.checkIndex(Objects.java:361)
        at java.base/java.util.ArrayList.get(ArrayList.java:427)
        at org.ops4j.pax.exam.testng.listener.PaxExam.stageReactor(PaxExam.java:224)
        at org.ops4j.pax.exam.testng.listener.PaxExam.onStart(PaxExam.java:186)
        at org.testng.SuiteRunner.invokeListeners(SuiteRunner.java:242)
        at org.testng.SuiteRunner.run(SuiteRunner.java:310)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

https://github.com/ops4j/org.ops4j.pax.exam2/blob/master/drivers/pax-exam-testng/src/main/java/org/ops4j/pax/exam/testng/driver/DriverListener.java#L153-L154

@juherr
Copy link
Author

juherr commented Apr 30, 2024

@krmahadevan fyi if you want to propose a fix

@krmahadevan
Copy link

@juherr - I would first want to wait for my existing PR to be merged before I spend time raising new PRs.

I am still waiting for feedback on #1112

@oliverlietz
Copy link
Member

The "current" (abandoned) version 5 wasn't touched for 7 years. See also the refactoring mentioned in PAXEXAM-772.
Do you have capacity to backport the approach to 4.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants