diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java | 14 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 4 |
2 files changed, 6 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java index 8fd7dc814..1c4c6ca19 100644 --- a/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java +++ b/src/main/java/de/pixart/messenger/services/AbstractConnectionManager.java @@ -86,7 +86,7 @@ public class AbstractConnectionManager { is = new FileInputStream(file); size = (int) file.getSize(); if (file.getKey() == null) { - return new Pair<InputStream, Integer>(is, size); + return new Pair<>(is, size); } try { if (gcm) { @@ -99,16 +99,10 @@ public class AbstractConnectionManager { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(file.getKey(), "AES"), ips); Log.d(Config.LOGTAG, "opening encrypted input stream"); - return new Pair<InputStream, Integer>(new CipherInputStream(is, cipher), (size / 16 + 1) * 16); + return new Pair<>(new CipherInputStream(is, cipher), (size / 16 + 1) * 16); } - } catch (InvalidKeyException e) { - return null; - } catch (NoSuchAlgorithmException e) { - return null; - } catch (NoSuchPaddingException e) { - return null; - } catch (InvalidAlgorithmParameterException e) { - return null; + } catch (Exception e) { + throw new AssertionError(e); } } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 6ca1c80c4..4aba18387 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -99,7 +99,7 @@ import de.pixart.messenger.generator.AbstractGenerator; import de.pixart.messenger.generator.IqGenerator; import de.pixart.messenger.generator.MessageGenerator; import de.pixart.messenger.generator.PresenceGenerator; -import de.pixart.messenger.http.AesGcmURLStreamHandlerFactory; +import de.pixart.messenger.http.CustomURLStreamHandlerFactory; import de.pixart.messenger.http.HttpConnectionManager; import de.pixart.messenger.parser.AbstractParser; import de.pixart.messenger.parser.IqParser; @@ -165,7 +165,7 @@ public class XmppConnectionService extends Service { private static final String ACTION_MERGE_PHONE_CONTACTS = "merge_phone_contacts"; static { - URL.setURLStreamHandlerFactory(new AesGcmURLStreamHandlerFactory()); + URL.setURLStreamHandlerFactory(new CustomURLStreamHandlerFactory()); } public final CountDownLatch restoredFromDatabaseLatch = new CountDownLatch(1); |