Check http response code

This commit is contained in:
M66B
2021-05-19 17:20:42 +02:00
parent 487b1038c0
commit 3b82c631db
6 changed files with 27 additions and 0 deletions

View File

@@ -355,6 +355,10 @@ public class EmailProvider {
request.setRequestProperty("User-Agent", WebViewEx.getUserAgent(context));
request.connect();
int status = request.getResponseCode();
if (status != HttpURLConnection.HTTP_OK)
throw new FileNotFoundException("Error " + status + ":" + request.getResponseMessage());
// https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
XmlPullParser xml = factory.newPullParser();