ihsanbal/LoggingInterceptor

java.io.FileNotFoundException: mock/.json

wadexi opened this issue · 1 comments

i have .json file in directory assets/mock
But get an error as follows

java.io.FileNotFoundException: mock/.json
at android.content.res.AssetManager.openAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:354)
at android.content.res.AssetManager.open(AssetManager.java:328)
at com.android.wadexi.basedemo.dagger2.modules.app.AppModules$1.getJsonResponse(AppModules.java:92)
at com.ihsanbal.logging.LoggingInterceptor.intercept(LoggingInterceptor.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1115)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:590)
at java.lang.Thread.run(Thread.java:818)``

I think you're passing empty string to string format. mock/.json should be something like mock/mockResponseFile.json

String segment = request.url().pathSegments().get(0); segment might be an empty string.