Info Call to Socket API

Description

List of all calls to Server Socket API.

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method io.flutter.view.ResourceUpdater$DownloadTask.doInBackground() calling method java.net.URL.<init>()


    protected varargs Void doInBackground(String[] p12)
    {
        try {
            java.util.concurrent.locks.Lock v0_21 = new java.net.URL(io.flutter.view.ResourceUpdater.access$000(this.this$0));
            StringBuilder v2_16 = new StringBuilder();
            v2_16.append(this.this$0.getInstalledPatch().getPath());
            v2_16.append(".download");
            String v1_6 = new java.io.File(v2_16.toString());
            StringBuilder v2_14 = new java.util.Date().getTime();
            String v5_11 = new StringBuilder();
            v5_11.append("Checking for updates at ");
            v5_11.append(v0_21);
            android.util.Log.i("ResourceUpdater", v5_11.toString());
            java.io.InputStream v4_2 = ((java.net.HttpURLConnection) v0_21.openConnection());
            String v5_16 = Math.max(this.this$0.getDownloadedPatch().lastModified(), this.this$0.getInstalledPatch().lastModified());
        } catch (java.util.concurrent.locks.Lock v0_18) {
            StringBuilder v2_13 = new StringBuilder();
            v2_13.append("Could not download update ");
            v2_13.append(v0_18.getMessage());
            android.util.Log.w("ResourceUpdater", v2_13.toString());
            return 0;
        }
        if (v5_16 != 0) {
            String v8_1 = new StringBuilder();
            v8_1.append("Active update timestamp ");
            v8_1.append(v5_16);
            android.util.Log.i("ResourceUpdater", v8_1.toString());
            v4_2.setIfModifiedSince(v5_16);
        }
        String v5_17 = v4_2.getURL();
        double v7_11 = new StringBuilder();
        v7_11.append("Resolved update URL ");
        v7_11.append(v5_17);
        android.util.Log.i("ResourceUpdater", v7_11.toString());
        String v5_19 = v4_2.getResponseCode();
        double v7_13 = new StringBuilder();
        v7_13.append("HTTP response code ");
        v7_13.append(v5_19);
        android.util.Log.i("ResourceUpdater", v7_13.toString());
        if (v5_19 != 404) {
            if (v5_19 != 304) {
                java.io.InputStream v4_3 = v4_2.getInputStream();
                try {
                    int v6_7 = new StringBuilder();
                    v6_7.append("Downloading update ");
                    v6_7.append(v0_21);
                    android.util.Log.i("ResourceUpdater", v6_7.toString());
                    java.util.concurrent.locks.Lock v0_24 = new java.io.FileOutputStream(v1_6);
                    try {
                        String v5_1 = new byte[1024];
                    } catch (String v1_7) {
                        StringBuilder v2_9 = 0;
                        if (v2_9 == null) {
                            v0_24.close();
                        } else {
                            v0_24.close();
                        }
                        throw v1_7;
                    } catch (String v1_5) {
                        try {
                            throw v1_5;
                        } catch (StringBuilder v2_8) {
                            v2_9 = v1_5;
                            v1_7 = v2_8;
                        }
                    }
                    while(true) {
                        int v6_0 = v4_3.read(v5_1);
                        if (v6_0 == -1) {
                            break;
                        }
                        v0_24.write(v5_1, 0, v6_0);
                    }
                    String v5_5 = (new java.util.Date().getTime() - v2_14);
                    String v3_2 = new StringBuilder();
                    v3_2.append("Update downloaded in ");
                    String v5_7 = ((double) (v5_5 / 100));
                    Double.isNaN(v5_7);
                    v3_2.append((v5_7 / 10.0));
                    v3_2.append("s");
                    android.util.Log.i("ResourceUpdater", v3_2.toString());
                    v0_24.close();
                    if (v4_3 != null) {
                        v4_3.close();
                    }
                    io.flutter.view.ResourceUpdater.access$100(this.this$0).lock();
                    java.util.concurrent.locks.Lock v0_4 = this.this$0.getDownloadedPatch();
                    if ((!v0_4.exists()) || (v0_4.delete())) {
                        if (v1_6.renameTo(v0_4)) {
                            io.flutter.view.ResourceUpdater.access$100(this.this$0).unlock();
                            return 0;
                        } else {
                            StringBuilder v2_4 = new StringBuilder();
                            v2_4.append("Could not create file ");
                            v2_4.append(v0_4);
                            android.util.Log.w("ResourceUpdater", v2_4.toString());
                            io.flutter.view.ResourceUpdater.access$100(this.this$0).unlock();
                            return 0;
                        }
                    } else {
                        StringBuilder v2_6 = new StringBuilder();
                        v2_6.append("Could not delete file ");
                        v2_6.append(v0_4);
                        android.util.Log.w("ResourceUpdater", v2_6.toString());
                        io.flutter.view.ResourceUpdater.access$100(this.this$0).unlock();
                        return 0;
                    }
                } catch (java.util.concurrent.locks.Lock v0_15) {
                    String v1_10 = 0;
                    if (v4_3 != null) {
                        if (v1_10 == null) {
                            v4_3.close();
                        } else {
                            v4_3.close();
                        }
                    }
                    throw v0_15;
                } catch (java.util.concurrent.locks.Lock v0_14) {
                    try {
                        throw v0_14;
                    } catch (String v1_9) {
                        v1_10 = v0_14;
                        v0_15 = v1_9;
                    }
                }
            } else {
                android.util.Log.i("ResourceUpdater", "Already have latest update");
                return 0;
            }
        } else {
            android.util.Log.i("ResourceUpdater", "Latest update not found on server");
            return 0;
        }
    }