This is what i have right now, this method open's a connection with http url,
public static void setCameraList(String list) {
URL calculator;
try {
String url = "http://example.com/index.php?cameraList=" +URLEncoder.encode(list, "ISO-8859-1");
calculator = new URL(url);
URLConnection calcConnection = calculator.openConnection();
BufferedReader streamReader = new BufferedReader(new InputStreamReader(calcConnection.getInputStream()));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
This work's fine, but sometimes when url is unreachable or return's some error code this method
seem's to crash full app.
What i am curious about is, Why this method fails to catch Exception
?
Also, If i add this :
catch(Throwable th){
}
Will this method
catch
every possible error/exception
related to what operation's i perform inside it ?