Merge "generateProjectThumbnail can fail to close output stream"

This commit is contained in:
Elliott Hughes
2014-04-11 17:37:54 +00:00
committed by Gerrit Code Review

View File

@@ -47,6 +47,8 @@ import android.os.Debug;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.Environment; import android.os.Environment;
import libcore.io.IoUtils;
/** /**
* The VideoEditor implementation {@hide} * The VideoEditor implementation {@hide}
*/ */
@@ -1859,15 +1861,15 @@ public class VideoEditorImpl implements VideoEditor {
} }
} }
FileOutputStream stream = null;
try { try {
FileOutputStream stream = new FileOutputStream(mProjectPath + "/" stream = new FileOutputStream(mProjectPath + "/" + THUMBNAIL_FILENAME);
+ THUMBNAIL_FILENAME);
projectBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); projectBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
stream.flush(); stream.flush();
stream.close();
} catch (IOException e) { } catch (IOException e) {
throw new IllegalArgumentException ("Error creating project thumbnail"); throw new IllegalArgumentException ("Error creating project thumbnail");
} finally { } finally {
IoUtils.closeQuietly(stream);
projectBitmap.recycle(); projectBitmap.recycle();
} }
} }