omegaes / Android-Link-Preview

An Android Library with demo application, to fetch meta-data from url, like Facebook and Whatsapp ....
http://mega4tech.com
9 stars 8 forks source link

Exception #1

Open tusharuit25 opened 6 years ago

tusharuit25 commented 6 years ago

E/UncaughtException: java.lang.IllegalArgumentException: unexpected url: /yts/img/yt_1200-vfl4C3T0K.png at okhttp3.Request$Builder.url(Request.java:142) at com.mega4tech.linkpreview.LinkUtil$1.onResponse(LinkUtil.java:144) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:833)

yelsane commented 6 years ago

Experiencing this issue as well. It seems that when response url is pointing to an image file, it immediately crashes. In my case, the site I always run into is "https://www.goo", this throws a FatalException:

04-24 15:47:24.864 32168-32408/com.test.app E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: com.test.app, PID: 32168
    java.lang.IllegalArgumentException: unexpected url: //www.xgoo.jp/img/og/rm4.png
        at okhttp3.Request$Builder.url(Request.java:143)
        at com.mega4tech.linkpreview.LinkUtil$1.onResponse(LinkUtil.java:144)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

Adding a Malformed URL checker in LinkUtil for the imageLink should prevent this crash.

kpamansoor commented 5 years ago

I am also having similar issue. Any body solved?

    java.lang.IllegalArgumentException: unexpected url: //i-cdn.phonearena.com/images/article/114851-two_lead/WhatsApp-closer-to-protecting-the-retinas-of-Android-users.jpg
        at okhttp3.Request$Builder.url(Request.java:142)
        at com.mega4tech.linkpreview.LinkUtil$1.onResponse(LinkUtil.java:144)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:760)
kpamansoor commented 5 years ago

My problem solved by adding this library offline and catches exception in the line mentioned in the error log.

follow the line https://stackoverflow.com/questions/32600325/android-studio-add-library-from-github to add this library offline. and in LinkUtil.class, add exception to the line 98.