getCauseStackTraceLines throws StringIndexOutOfBoundsException

Open
#2,306 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
testing-qa

Research direction

Start by reading androidx.test.services.events.internal.Throwables.getCauseStackTraceLines at Throwables.java:70, then trace its callers through getTrimmedStackTrace, StackTrimmer.getTrimmedStackTrace, and ParcelableConverter.getFailure. Reproduce the failure from the supplied stack trace on API 28 and verify that generating a test failure report no longer throws StringIndexOutOfBoundsException.

Written by the indexing model from the issue text.

Description

Description

Exception in the test runner

Steps to Reproduce

Generate a failure during a test

Expected Results

Test orchestrator generate the test report successfully

Actual Results

This is the stacktrace that shows the exception:

10-28 12:00:57.213  7455  7485 E TestRunner: java.lang.StringIndexOutOfBoundsException: length=117; index=290
10-28 12:00:57.213  7455  7485 E TestRunner: 	at java.lang.String.substring(String.java:1999)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.services.events.internal.Throwables.getCauseStackTraceLines(Throwables.java:70)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.services.events.internal.Throwables.getTrimmedStackTrace(Throwables.java:38)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.services.events.internal.StackTrimmer.getTrimmedStackTrace(StackTrimmer.java:37)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.services.events.ParcelableConverter.getFailure(ParcelableConverter.java:106)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.services.events.ParcelableConverter.getFailuresFromList(ParcelableConverter.java:119)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.internal.events.client.OrchestratedInstrumentationListener.testRunFinished(OrchestratedInstrumentationListener.java:84)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.notification.SynchronizedRunListener.testRunFinished(SynchronizedRunListener.java:42)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.notification.RunNotifier$2.notifyListener(RunNotifier.java:103)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.notification.RunNotifier.fireTestRunFinished(RunNotifier.java:100)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:68)
10-28 12:00:57.213  7455  7485 E TestRunner: 	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)

AndroidX Test and Android OS Versions

androidx.test🏃1.6.2 on API 28

Link to a public git repo demonstrating the problem:
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
1d 14h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/android-test

All issues in android/android-test

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.