Don't crash just because invalid datasets were offered for restore

In practice, recognize that the current transport state may not yet
incorporate a valid restore data stream object, so don't go making
assumptions that it's usable / closeable / etc.

Bug 18379004

Change-Id: I221e04b5b83438e37455e025d67f412d3abb8c50
This commit is contained in:
Christopher Tate
2014-11-14 18:27:36 -08:00
parent 2f8d4ea206
commit 824392bdbd

View File

@@ -35,6 +35,8 @@ import android.util.Log;
import com.android.org.bouncycastle.util.encoders.Base64;
import libcore.io.IoUtils;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -559,11 +561,7 @@ public class LocalTransport extends BackupTransport {
// Full restore handling
private void resetFullRestoreState() {
try {
mCurFullRestoreStream.close();
} catch (IOException e) {
Log.w(TAG, "Unable to close full restore input stream");
}
IoUtils.closeQuietly(mCurFullRestoreStream);
mCurFullRestoreStream = null;
mFullRestoreSocketStream = null;
mFullRestoreBuffer = null;