From: peli0101 Date: Mon, 27 Apr 2009 21:40:06 +0000 (+0000) Subject: OI Safe: Clean up code. X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=c5e26d555fdcb8d170703690a7c26695e94b01ec;p=android-vcpass-oisafe OI Safe: Clean up code. git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2054 72b678ce-9140-0410-bee8-679b907dd61a --- diff --git a/src/org/openintents/safe/CryptoHelper.java b/src/org/openintents/safe/CryptoHelper.java index 36b4ef5..aae1131 100644 --- a/src/org/openintents/safe/CryptoHelper.java +++ b/src/org/openintents/safe/CryptoHelper.java @@ -762,14 +762,15 @@ public class CryptoHelper { Log.d(TAG, "fileUri="+fileUri.toString()); ContentResolver contentResolver = ctx.getContentResolver(); + String inputPath = null; String outputPath = null; Uri resultUri = null; boolean result = false; try { InputStream is; - if (fileUri.getScheme().equals("file")) { - String inputPath = fileUri.getPath(); + if (fileUri.getScheme().equals("file")) { + inputPath = fileUri.getPath(); is = new java.io.FileInputStream(inputPath); if (debug) Log.d(TAG, "Decrypt: Input from " + inputPath); if (inputPath.endsWith(OISAFE_EXTENSION)) { @@ -807,8 +808,9 @@ public class CryptoHelper { // Successful // Securely delete the original file: - - SecureDelete.delete(new File(fileUri.getPath())); + if (inputPath != null) { + SecureDelete.delete(new File(inputPath)); + } } else { resultUri = null; @@ -887,12 +889,6 @@ public class CryptoHelper { Log.e(TAG, "IOException", e); } - // Securely delete the original file: - - // TODO Peli: Only delete if this is not a decryption through ContentProvider. - // SecureDelete.delete(new File(fileUri.getPath())); - - if (result == false) { resultUri = null;