I'm trying retrieve artists photos for all music using the last.fm api
but I got java.io.FileNotFoundException
and I don't know why.
Here is my code
protected Bitmap doInBackground(String... strings) {
Bitmap bmp;
try {
Connection connection = Jsoup.connect(mArtisName).ignoreContentType(true).ignoreHttpErrors(true);
Connection.Response resp = connection.execute();
Document document;
if (resp.statusCode() ==200) {
document = connection.parser(Parser.xmlParser()).post();
mArtisName = document.select("image[size=extralarge]").text();
}
bmp = cache.get(Artis);
if (bmp==null) {
URL url = new URL(mArtisName);
URLConnection update = url.openConnection();
bmp = BitmapFactory.decodeStream(update.getInputStream());
cache.put(Artis, bmp);
}
} catch (Exception ex) {
ex.printStackTrace();
bmp = defaultBitmap;
}
return bmp;
}
logcat
12-12 17:47:45.739 5331-5356/com.karyaanaknegeri.musikq W/System.err﹕ java.io.FileNotFoundException: http://img2-ak.lst.fm/i/u/300x300/751c067c9cb6469b9d6d2e33e1791edc.png http://img2-ak.lst.fm/i/u/300x300/be563302f6574b3c800b2308970777b6.png http://img2-ak.lst.fm/i/u/300x300/15fe26485bc54344bb43d7d05705c46d.png http://img2-ak.lst.fm/i/u/300x300/5d54245519f74844806c7918545c6e88.png http://img2-ak.lst.fm/i/u/300x300/37696a0d07f849f5bdd34cac656a218e.png http://img2-ak.lst.fm/i/u/300x300/3a66a1890a9b4c9d8bf88a8c6d88868d.png
12-12 17:47:45.739 5331-5356/com.karyaanaknegeri.musikq W/System.err﹕ at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:206)