#6516 closed defect (incomplete)

java.lang.NullPointerException error

Reported by: laximan Assignee:
Priority: P5 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: Blocked By:
Blocking: Platform: Android
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Getting error in the AdblockPlus library

java.lang.NullPointerException
Attempt to invoke interface method 'java.lang.Object org.adblockplus.libadblockplus.android.AdblockEngineProvider.getEngineLock()' on a null object reference
AdblockWebView.java
org.adblockplus.libadblockplus.android.webview.AdblockWebView$ElemHideThread

Change History (8)

comment:1 Changed 18 months ago by asmirnov

  • Component changed from Unknown to Libadblockplus-Android
  • Priority changed from Unknown to P5

comment:2 Changed 18 months ago by asmirnov

  • Summary changed from java.lang.NullPointerException error in the AdblockPlus library to java.lang.NullPointerException error

comment:3 Changed 18 months ago by laximan

LIBRARY DETAILS
Library Name : org.adblockplus.libadblockplus.android.webview
Library VERSION_CODE = 4
Library VERSION_NAME = "2.1";

ERROR DETAILS

Error
java.lang.NullPointerException

Stacktrace
Attempt to invoke interface method 'java.lang.Object org.adblockplus.libadblockplus.android.AdblockEngineProvider.getEngineLock()' on a null object reference

className : AdblockWebView.java
methodName : run
Line number : 977

subclass name : ElemHideThread
org.adblockplus.libadblockplus.android.webview.AdblockWebView$ElemHideThread

The probable error where it occurs is at this piece of code, when the "provider" is null.

public void run() {

synchronized(AdblockWebView.this.provider.getEngineLock()) {

try {

if(AdblockWebView.this.provider.getCounter() == 0) {

....

comment:4 Changed 18 months ago by laximan

Some of the devices on which the issue occurs have been mentioned below

a5lte,Fone_161,hero2lte,condor_umts,rolex,SO-03J,i-mobile,j7y17lte,gtelwifi,SO-02F,on7xelte,c7prolte,riva,lt013g,athene,SO-04J,heroqltevzw,QMobile i10,HWY360-U,nikel,E2105,fortuna3g,goyave3gsea,QPAD,mobiistar_LAI_Zoro,KYV31,serranolte,j1qltevzw,lt01wifi,g2,PLAY_P1,a3xelte,dream2qltesq,kt07c_honghd,on5xelte,F01F,j7elte,SOV34,dream2lte,gtel3g,zoom_ro,lcsh92_wet_jb9,HWLUA-U6582,mido,heroqltespr,hammerhead,dream2lteks,armani,jflteatt,ASUS_X00DD,kaleido_sprout,PSP5455D,O,grandneove3g,SO-02J,KYV38,POP455C,e1q,A536,grandmaxltekx,c1ktt,ASUS_X007D,goyavewifixtc,serranovelte,goyavewifi,KYY24,hwG7-L01,SC-04J,ASUS_X008_1

comment:5 Changed 18 months ago by asmirnov

provider is never set to null in AdblockWebView. Did you call setProvider(null) intentionally?

Last edited 18 months ago by asmirnov (previous) (diff)

comment:6 Changed 18 months ago by laximan

We never call setProvider(null) intentionally but we get the provider from AdblockHelper class itself and set it to the setProvider method.

AdblockHelper.get().getProvider().waitForReady();
this.setProvider(AdblockHelper.get().getProvider());


if(AdblockHelper.get().getProvider().getEngine() != null){
	AdblockHelper.get().getProvider().getEngine().setAcceptableAdsEnabled(isAAEnable);
	mWebView.setProvider(AdblockHelper.get().getProvider());
}

That is the way we are calling the setProvider method.

comment:7 Changed 18 months ago by asmirnov

  1. AdblockHelper.get().getProvider().waitForReady(); is not required before setting provider.
  2. Use addEngineCreatedListener to set engine creation listener to do some init

comment:8 Changed 18 months ago by asmirnov

  • Resolution set to incomplete
  • Status changed from new to closed

I was unable to reproduce it for:
https://github.com/adblockplus/libadblockplus-android/commit/eacd75a39184b8b8570086926514514e5f859eab

Full app log is required.
Steps to reproduce are required.

Note: See TracTickets for help on using tickets.