The top-level function you're calling should indeed only throw those exceptions that are specified in its signature. But if it calls other classes / methods, there could be all kinds of exceptions, including runtime errors (like the one you are facing). The former would be caught and eventualy rethrown as specified by the top-level method, the latter can lead to crashes.
I'd recommend you track down the source for your device's version of HttpURLConnectionImpl.java, and take a look at the method mentioned in the crash. -- Kostya 2011/4/4 manigault <[email protected]> > Hi all, > I faced really nasty problem these days. I am executing the following > code > > > String destination = "";// this string is initialized before > coming here > > > URL url = null; > InputStream inputStream = null; > try { > url = new URL(destination); > inputStream = url.openStream(); > // process the input stream > catch (IOException e) { > // handle the exception > } finally { > if (inputStream != null) { > inputStream.close(); > } > } > > > This was working fine so far, but i start to receive to following > exception - > > > Exception: java.lang.StringIndexOutOfBoundsException > Stack Trace : > java.lang.String.substring(String.java:1579) > > > org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getAuthorizationCredentials(HttpURLConnectionImpl.java: > 1769) > > > org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequestInternal(HttpURLConnectionImpl.java: > 1701) > > > org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.doRequest(HttpURLConnectionImpl.java: > 1649) > > > org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java: > 1153) > java.net.URL.openStream(URL.java:653) > > I can't figure out for which values of 'destination' this exception is > thrown but i think this should never happen. The doc says the > openStream could throw only IOException. Any ideas ? > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

