consistently use FileHelper.openInputStreamSafe to resolve input streams
This commit is contained in:
@@ -41,6 +41,7 @@ import org.sufficientlysecure.keychain.ui.util.recyclerview.ItemTouchHelperAdapt
|
||||
import org.sufficientlysecure.keychain.ui.util.recyclerview.ItemTouchHelperDragCallback;
|
||||
import org.sufficientlysecure.keychain.ui.util.recyclerview.ItemTouchHelperViewHolder;
|
||||
import org.sufficientlysecure.keychain.ui.util.recyclerview.RecyclerItemClickListener;
|
||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -205,7 +206,7 @@ public class SettingsSmartPGPAuthorityFragment extends Fragment implements Recyc
|
||||
if (uri == null) {
|
||||
new_cert = old_cert;
|
||||
} else {
|
||||
final InputStream fis = getContext().getContentResolver().openInputStream(Uri.parse(uri));
|
||||
final InputStream fis = FileHelper.openInputStreamSafe(getContext().getContentResolver(), Uri.parse(uri));
|
||||
|
||||
final CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
||||
new_cert = cf.generateCertificate(fis);
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.FileHelper;
|
||||
import org.sufficientlysecure.keychain.util.ParcelableProxy;
|
||||
import org.sufficientlysecure.keychain.util.Preferences;
|
||||
import timber.log.Timber;
|
||||
@@ -206,7 +207,7 @@ public class PublicKeyRetriever {
|
||||
log.add(LogType.MSG_RET_CURI_START, 0);
|
||||
|
||||
log.add(LogType.MSG_RET_CURI_OPEN, 1, uri.toString());
|
||||
InputStream is = context.getContentResolver().openInputStream(uri);
|
||||
InputStream is = FileHelper.openInputStreamSafe(context.getContentResolver(), uri);
|
||||
if (is == null) {
|
||||
log.add(LogType.MSG_RET_CURI_ERROR_NOT_FOUND, 1);
|
||||
return KeyRetrievalResult.createWithError(log);
|
||||
|
||||
Reference in New Issue
Block a user