Fixing some invalid checks and cleaning some redundant conditions
Change-Id: I770ce2cc2eccbee105958634e81bbc9bc2e4cc48
diff --git a/src/com/android/launcher3/LauncherBackupHelper.java b/src/com/android/launcher3/LauncherBackupHelper.java
index 2d11d3a..509fbf8 100644
--- a/src/com/android/launcher3/LauncherBackupHelper.java
+++ b/src/com/android/launcher3/LauncherBackupHelper.java
@@ -768,13 +768,10 @@
try {
Key key = Key.parseFrom(Base64.decode(backupKey, Base64.DEFAULT));
if (key.checksum != checkKey(key)) {
- key = null;
throw new InvalidBackupException("invalid key read from stream" + backupKey);
}
return key;
- } catch (InvalidProtocolBufferNanoException e) {
- throw new InvalidBackupException(e);
- } catch (IllegalArgumentException e) {
+ } catch (InvalidProtocolBufferNanoException | IllegalArgumentException e) {
throw new InvalidBackupException(e);
}
}
@@ -1137,9 +1134,8 @@
* @param journal a Journal protocol buffer
*/
private void writeJournal(ParcelFileDescriptor newState, Journal journal) {
- FileOutputStream outStream = null;
try {
- outStream = new FileOutputStream(newState.getFileDescriptor());
+ FileOutputStream outStream = new FileOutputStream(newState.getFileDescriptor());
final byte[] journalBytes = writeCheckedBytes(journal);
outStream.write(journalBytes);
outStream.close();