From 485e8455bdba46905cca2c4fd969de0d1fe2bf29 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 15 Jun 2015 12:26:29 -0700 Subject: [PATCH] Minor cleanup. // FREEBIE --- .../crypto/DecryptingPartInputStream.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java b/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java index 8b496baf87..3b50ecd62e 100644 --- a/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java +++ b/src/org/thoughtcrime/securesms/crypto/DecryptingPartInputStream.java @@ -45,6 +45,8 @@ import android.util.Log; public class DecryptingPartInputStream extends FileInputStream { + private static final String TAG = DecryptingPartInputStream.class.getSimpleName(); + private static final int IV_LENGTH = 16; private static final int MAC_LENGTH = 20; @@ -68,16 +70,12 @@ public class DecryptingPartInputStream extends FileInputStream { totalDataSize = file.length() - cipher.getBlockSize() - mac.getMacLength(); totalRead = 0; } catch (InvalidKeyException ike) { - Log.w("EncryptingPartInputStream", ike); + Log.w(TAG, ike); throw new FileNotFoundException("Invalid key!"); - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } catch (InvalidAlgorithmParameterException e) { - throw new AssertionError(e); - } catch (NoSuchPaddingException e) { + } catch (NoSuchAlgorithmException | InvalidAlgorithmParameterException | NoSuchPaddingException e) { throw new AssertionError(e); } catch (IOException e) { - Log.w("EncryptingPartInputStream", e); + Log.w(TAG, e); throw new FileNotFoundException("IOException while reading IV!"); } } @@ -130,13 +128,13 @@ public class DecryptingPartInputStream extends FileInputStream { done = true; return flourish; } catch (IllegalBlockSizeException e) { - Log.w("EncryptingPartInputStream", e); + Log.w(TAG, e); throw new IOException("Illegal block size exception!"); } catch (ShortBufferException e) { - Log.w("EncryptingPartInputStream", e); + Log.w(TAG, e); throw new IOException("Short buffer exception!"); } catch (BadPaddingException e) { - Log.w("EncryptingPartInputStream", e); + Log.w(TAG, e); throw new IOException("Bad padding exception!"); } }