Closes Android input streams and delivers its exceptions to its caller
This commit is contained in:
parent
52756b1a38
commit
7402f4bf9d
|
@ -15,6 +15,7 @@ import android.webkit.MimeTypeMap;
|
|||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
||||
|
@ -77,15 +78,18 @@ public class FilePickerPlugin implements MethodCallHandler {
|
|||
} finally {
|
||||
fos.getFD().sync();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
fos.close();
|
||||
} catch(IOException ex) {
|
||||
result.error(TAG, "Failed to close file streams: " + e.getMessage(),null);
|
||||
}
|
||||
result.error(TAG, "Failed to retrieve path: " + e.getMessage(),null);
|
||||
}
|
||||
|
||||
Log.i(TAG, "Cloud file loaded and cached on:" + cloudFile);
|
||||
fullPath = cloudFile;
|
||||
}
|
||||
|
||||
Log.i(TAG, "Absolute file path:" + fullPath);
|
||||
result.success(fullPath);
|
||||
}
|
||||
|
@ -147,8 +151,6 @@ public class FilePickerPlugin implements MethodCallHandler {
|
|||
}
|
||||
|
||||
switch (type) {
|
||||
case "PDF":
|
||||
return "application/pdf";
|
||||
case "VIDEO":
|
||||
return "video/*";
|
||||
case "ANY":
|
||||
|
|
Loading…
Reference in New Issue