Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d743fe2 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

merge from open-source master

Change-Id: Ic9060d92c014d6cbe9d90ce8deca8fa111711471
parents e896d416 fb59fbf1
Loading
Loading
Loading
Loading
+25 −15
Original line number Diff line number Diff line
@@ -1380,16 +1380,23 @@ public class WebView extends AbsoluteLayout
        final File temp = new File(dest.getPath() + ".writing");
        new Thread(new Runnable() {
            public void run() {
                FileOutputStream out = null;
                try {
                    FileOutputStream out = new FileOutputStream(temp);
                    out = new FileOutputStream(temp);
                    p.writeToStream(out);
                    out.close();
                    // Writing the picture succeeded, rename the temporary file
                    // to the destination.
                    temp.renameTo(dest);
                } catch (Exception e) {
                    // too late to do anything about it.
                } finally {
                    if (out != null) {
                        try {
                            out.close();
                        } catch (Exception e) {
                            // Can't do anything about that
                        }
                    }
                    temp.delete();
                }
            }
@@ -1442,6 +1449,7 @@ public class WebView extends AbsoluteLayout
            final Bundle copy = new Bundle(b);
            new Thread(new Runnable() {
                public void run() {
                    try {
                        final Picture p = Picture.createFromStream(in);
                        if (p != null) {
                            // Post a runnable on the main thread to update the
@@ -1452,12 +1460,14 @@ public class WebView extends AbsoluteLayout
                                }
                            });
                        }
                    } finally {
                        try {
                            in.close();
                        } catch (Exception e) {
                            // Nothing we can do now.
                        }
                    }
                }
            }).start();
        } catch (FileNotFoundException e){
            e.printStackTrace();