diff options
author | Thialfihar <thialfihar@gmail.com> | 2010-05-21 02:47:40 +0000 |
---|---|---|
committer | Thialfihar <thialfihar@gmail.com> | 2010-05-21 02:47:40 +0000 |
commit | 2c784554c771da4d5d37b3895e94d494418fae3d (patch) | |
tree | aa00d87ca6d5816acf25a4878444869f3c67c47f /src/org/thialfihar/android | |
parent | e5573973e767a87b2a70372c89775dcaddc50b36 (diff) | |
download | open-keychain-2c784554c771da4d5d37b3895e94d494418fae3d.tar.gz open-keychain-2c784554c771da4d5d37b3895e94d494418fae3d.tar.bz2 open-keychain-2c784554c771da4d5d37b3895e94d494418fae3d.zip |
fixed symmetric decrypting, stream didn't support .reset(), I guess, so now creating fresh streams where needed, and changed exception string to "" + e, rather than getMessage(), as that still can be null... annoying.
Diffstat (limited to 'src/org/thialfihar/android')
7 files changed, 32 insertions, 33 deletions
diff --git a/src/org/thialfihar/android/apg/Apg.java b/src/org/thialfihar/android/apg/Apg.java index eed8c09d1..422545b86 100644 --- a/src/org/thialfihar/android/apg/Apg.java +++ b/src/org/thialfihar/android/apg/Apg.java @@ -465,7 +465,7 @@ public class Apg { } catch (UserIdEditor.NoEmailException e) {
throw new Apg.GeneralException(context.getString(R.string.error_userIdNeedsAnEmailAddress));
} catch (UserIdEditor.InvalidEmailException e) {
- throw new Apg.GeneralException(e.getMessage());
+ throw new Apg.GeneralException("" + e);
}
if (userId.equals("")) {
diff --git a/src/org/thialfihar/android/apg/DecryptActivity.java b/src/org/thialfihar/android/apg/DecryptActivity.java index 80ad13d5e..e0db36367 100644 --- a/src/org/thialfihar/android/apg/DecryptActivity.java +++ b/src/org/thialfihar/android/apg/DecryptActivity.java @@ -373,9 +373,9 @@ public class DecryptActivity extends BaseActivity { // look at the file/message again to check whether there's // symmetric encryption data in there if (mDecryptTarget == Id.target.file) { - ((FileInputStream) in).reset(); + in = new FileInputStream(mInputFilename); } else { - ((ByteArrayInputStream) in).reset(); + in = new ByteArrayInputStream(mMessage.getText().toString().getBytes()); } if (!Apg.hasSymmetricEncryption(this, in)) { throw new Apg.GeneralException(getString(R.string.error_noKnownEncryptionFound)); @@ -396,9 +396,9 @@ public class DecryptActivity extends BaseActivity { } catch (FileNotFoundException e) { error = getString(R.string.error_fileNotFound); } catch (IOException e) { - error = e.getLocalizedMessage(); + error = "" + e; } catch (Apg.GeneralException e) { - error = e.getLocalizedMessage(); + error = "" + e; } if (error != null) { Toast.makeText(this, getString(R.string.errorMessage, error), @@ -479,14 +479,13 @@ public class DecryptActivity extends BaseActivity { out).toByteArray())); } } catch (PGPException e) { - error = e.getMessage(); + error = "" + e; } catch (IOException e) { - error = e.getMessage(); + error = "" + e; } catch (SignatureException e) { - error = e.getMessage(); - e.printStackTrace(); + error = "" + e; } catch (Apg.GeneralException e) { - error = e.getMessage(); + error = "" + e; } data.putInt("type", Id.message.done); diff --git a/src/org/thialfihar/android/apg/EditKeyActivity.java b/src/org/thialfihar/android/apg/EditKeyActivity.java index 9bd6d3f36..dfd4f4f46 100644 --- a/src/org/thialfihar/android/apg/EditKeyActivity.java +++ b/src/org/thialfihar/android/apg/EditKeyActivity.java @@ -245,15 +245,15 @@ public class EditKeyActivity extends BaseActivity implements OnClickListener { Apg.buildSecretKey(this, mUserIds, mKeys, oldPassPhrase, newPassPhrase, this); Apg.setCachedPassPhrase(getMasterKeyId(), newPassPhrase); } catch (NoSuchProviderException e) { - error = e.getMessage(); + error = "" + e; } catch (NoSuchAlgorithmException e) { - error = e.getMessage(); + error = "" + e; } catch (PGPException e) { - error = e.getMessage(); + error = "" + e; } catch (SignatureException e) { - error = e.getMessage(); + error = "" + e; } catch (Apg.GeneralException e) { - error = e.getMessage(); + error = "" + e; } data.putInt("type", Id.message.done); diff --git a/src/org/thialfihar/android/apg/EncryptActivity.java b/src/org/thialfihar/android/apg/EncryptActivity.java index 073e9dc9c..d76b568a6 100644 --- a/src/org/thialfihar/android/apg/EncryptActivity.java +++ b/src/org/thialfihar/android/apg/EncryptActivity.java @@ -585,17 +585,17 @@ public class EncryptActivity extends BaseActivity { data.putString("message", new String(((ByteArrayOutputStream)out).toByteArray())); } } catch (IOException e) { - error = e.getMessage(); + error = "" + e; } catch (PGPException e) { - error = e.getMessage(); + error = "" + e; } catch (NoSuchProviderException e) { - error = e.getMessage(); + error = "" + e; } catch (NoSuchAlgorithmException e) { - error = e.getMessage(); + error = "" + e; } catch (SignatureException e) { - error = e.getMessage(); + error = "" + e; } catch (Apg.GeneralException e) { - error = e.getMessage(); + error = "" + e; } data.putInt("type", Id.message.done); diff --git a/src/org/thialfihar/android/apg/PublicKeyListActivity.java b/src/org/thialfihar/android/apg/PublicKeyListActivity.java index a04d933d7..4f4f49bba 100644 --- a/src/org/thialfihar/android/apg/PublicKeyListActivity.java +++ b/src/org/thialfihar/android/apg/PublicKeyListActivity.java @@ -280,11 +280,11 @@ public class PublicKeyListActivity extends BaseActivity { } catch (FileNotFoundException e) {
error = getString(R.string.error_fileNotFound);
} catch (IOException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (PGPException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (Apg.GeneralException e) {
- error = e.getMessage();
+ error = "" + e;
}
if (mTask == Id.task.import_keys) {
diff --git a/src/org/thialfihar/android/apg/SecretKeyListActivity.java b/src/org/thialfihar/android/apg/SecretKeyListActivity.java index b1857dc6c..3612e73fc 100644 --- a/src/org/thialfihar/android/apg/SecretKeyListActivity.java +++ b/src/org/thialfihar/android/apg/SecretKeyListActivity.java @@ -381,11 +381,11 @@ public class SecretKeyListActivity extends BaseActivity implements OnChildClickL } catch (FileNotFoundException e) {
error = getString(R.string.error_fileNotFound);
} catch (IOException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (PGPException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (Apg.GeneralException e) {
- error = e.getMessage();
+ error = "" + e;
}
if (mTask == Id.task.import_keys) {
diff --git a/src/org/thialfihar/android/apg/ui/widget/SectionView.java b/src/org/thialfihar/android/apg/ui/widget/SectionView.java index cc1410c26..32e73a491 100644 --- a/src/org/thialfihar/android/apg/ui/widget/SectionView.java +++ b/src/org/thialfihar/android/apg/ui/widget/SectionView.java @@ -310,17 +310,17 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor mNewKeySize, passPhrase,
masterKey);
} catch (NoSuchProviderException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (NoSuchAlgorithmException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (PGPException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (InvalidParameterException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (InvalidAlgorithmParameterException e) {
- error = e.getMessage();
+ error = "" + e;
} catch (Apg.GeneralException e) {
- error = e.getMessage();
+ error = "" + e;
}
Message message = new Message();
|