question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DownloadHelperTest Failed

See original GitHub issue

[REQUIRED] Issue description

When I try to run ExoPlayer library core test cases keep failing

[REQUIRED] Reproduction steps

When try to Run DownloadHelperTest.java is keep failing

[REQUIRED] Link to test content

N/A

[REQUIRED] A full bug report captured from the device

[Robolectric] com.google.android.exoplayer2.offline.DownloadHelperTest.getTrackSelections_afterReplaceTrackSelections_returnsNewSelections: sdk=28; resources=BINARY
Exception in thread "DownloadHelper" java.lang.NullPointerException
	at com.google.android.exoplayer2.offline.DownloadHelper$MediaPreparer.onSourceInfoRefreshed(DownloadHelper.java:918)
	at com.google.android.exoplayer2.source.BaseMediaSource.refreshSourceInfo(BaseMediaSource.java:74)
	at com.google.android.exoplayer2.testutil.FakeMediaSource.finishSourcePreparation(FakeMediaSource.java:215)
	at com.google.android.exoplayer2.testutil.FakeMediaSource.prepareSourceInternal(FakeMediaSource.java:105)
	at com.google.android.exoplayer2.source.BaseMediaSource.prepareSource(BaseMediaSource.java:140)
	at com.google.android.exoplayer2.offline.DownloadHelper$MediaPreparer.handleMessage(DownloadHelper.java:858)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at com.google.android.exoplayer2.testutil.RobolectricUtil$CustomLooper.doLoop(RobolectricUtil.java:129)
	at com.google.android.exoplayer2.testutil.RobolectricUtil$CustomLooper.loop(RobolectricUtil.java:67)
	at android.os.Looper.loop(Looper.java)
	at android.os.HandlerThread.run(HandlerThread.java:65)

[REQUIRED] Version of ExoPlayer being used

2.10.2

[REQUIRED] Device(s) and version(s) of Android being used

N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ojw28commented, Jul 9, 2019

Yes, we’ll push a fix for this shortly. Thanks for the bug report!

0reactions
drayan85commented, Jul 9, 2019

Thanks, @ojw28. I have shifted the pendingMediaPeriods = new ArrayList<>() initialization above the mediaSourceThread.start() in the DownloadHelper.java as below.

    public MediaPreparer(MediaSource mediaSource, DownloadHelper downloadHelper) {
      this.mediaSource = mediaSource;
      this.downloadHelper = downloadHelper;
      allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
      @SuppressWarnings("methodref.receiver.bound.invalid")
      Handler downloadThreadHandler = Util.createHandler(this::handleDownloadHelperCallbackMessage);
      this.downloadHelperHandler = downloadThreadHandler;
      mediaSourceThread = new HandlerThread("DownloadHelper");
      pendingMediaPeriods = new ArrayList<>();
      mediaSourceThread.start();
      mediaSourceHandler = Util.createHandler(mediaSourceThread.getLooper(), /* callback= */ this);
      mediaSourceHandler.sendEmptyMessage(MESSAGE_PREPARE_SOURCE);
    }

No all the test suits pass successfully.

Read more comments on GitHub >

github_iconTop Results From Across the Web

java/PaulWoitaschek/ExoPlayer-Extensions/library/dash/src/test/java ...
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ” defined in class path resource [.xml]: No matching factory method found ...
Read more >
Failed - Download Error - Microsoft Community
The download says "Failed - Download Error" Ive tried going to regedit and downloading it. Srill doesnt work. How do you fix this?...
Read more >
CategorySessionControllerImpl.java example - Javatips.net
This class describes the usage of CategorySessionControllerImpl.java.
Read more >
project.pbxproj - mozsearch - Searchfox
288A2DB51AB8B38D0023ABC3 /* Error.swift in Sources */ = {isa = PBXBuildFile; ... 6ADB651B285C03B100947EA4 /* DownloadHelperTests.swift in Sources */ = {isa ...
Read more >
cppcheck1.osuosl.org:8000/head-shadowVariable
... [shadowVariable] 9base-6/troff/n5.c:433:15: style: Local variable 'error' ... variable [shadowVariable] aria2-1.36.0/test/DownloadHelperTest.cc:150:10: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found