Bug 740731 - Catch unchecked exceptions in two places in BaseResource. r=rnewman

--HG--
extra : rebase_source : 85fcbb003017f542c95e8757932f8eb6a2afeb53
This commit is contained in:
Nick Alexander 2012-05-31 12:14:32 -07:00
parent fa92c40291
commit fb65c1f891

View File

@ -9,6 +9,7 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
@ -249,6 +250,10 @@ public class BaseResource implements Resource {
delegate.handleHttpProtocolException(e);
} catch (IOException e) {
delegate.handleHttpIOException(e);
} catch (Exception e) {
// Bug 740731: Don't let an exception fall through. Wrapping isn't
// optimal, but often the exception is treated as an Exception anyway.
delegate.handleHttpIOException(new IOException(e));
}
}
@ -262,9 +267,16 @@ public class BaseResource implements Resource {
} catch (KeyManagementException e) {
Logger.error(LOG_TAG, "Couldn't prepare client.", e);
delegate.handleTransportException(e);
return;
} catch (NoSuchAlgorithmException e) {
Logger.error(LOG_TAG, "Couldn't prepare client.", e);
delegate.handleTransportException(e);
return;
} catch (Exception e) {
// Bug 740731: Don't let an exception fall through. Wrapping isn't
// optimal, but often the exception is treated as an Exception anyway.
delegate.handleTransportException(new GeneralSecurityException(e));
return;
}
this.execute();
}