Return empty list if SSLException (under IOException)

This commit is contained in:
misaochan 2016-07-06 17:49:19 +12:00
parent e33601875b
commit d2347d00b1
2 changed files with 6 additions and 2 deletions

View file

@ -67,7 +67,8 @@ public class MethodAUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
.get(); .get();
Log.d(TAG, "Method A URL filter" + result.toString()); Log.d(TAG, "Method A URL filter" + result.toString());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); //Return empty arraylist
return categories;
} }
ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/search/p/@title"); ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/search/p/@title");

View file

@ -11,6 +11,8 @@ import org.mediawiki.api.MWApi;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import javax.net.ssl.SSLPeerUnverifiedException;
import fr.free.nrw.commons.CommonsApplication; import fr.free.nrw.commons.CommonsApplication;
/** /**
@ -63,7 +65,8 @@ public class PrefixUpdater extends AsyncTask<Void, Void, ArrayList<String>> {
.get(); .get();
Log.d(TAG, "Prefix URL filter" + result.toString()); Log.d(TAG, "Prefix URL filter" + result.toString());
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); //Return empty arraylist
return categories;
} }
ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/allcategories/c"); ArrayList<ApiResult> categoryNodes = result.getNodes("/api/query/allcategories/c");