.class public final Lj6/i3;
.super Ljava/lang/Object;
.source ""

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field public final r:Ljava/net/URL;

.field public final s:[B

.field public final t:Lj6/h3;

.field public final u:Ljava/lang/String;

.field public final v:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field public final synthetic w:Lj6/j3;


# direct methods
.method public constructor <init>(Lj6/j3;Ljava/lang/String;Ljava/net/URL;[BLjava/util/Map;Lj6/h3;)V
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            "Ljava/net/URL;",
            "[B",
            "Ljava/util/Map<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;",
            "Lj6/h3;",
            ")V"
        }
    .end annotation

    iput-object p1, p0, Lj6/i3;->w:Lj6/j3;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    invoke-static {p2}, Lcom/google/android/gms/common/internal/d;->e(Ljava/lang/String;)Ljava/lang/String;

    .line 1
    iput-object p3, p0, Lj6/i3;->r:Ljava/net/URL;

    iput-object p4, p0, Lj6/i3;->s:[B

    iput-object p6, p0, Lj6/i3;->t:Lj6/h3;

    iput-object p2, p0, Lj6/i3;->u:Ljava/lang/String;

    iput-object p5, p0, Lj6/i3;->v:Ljava/util/Map;

    return-void
.end method


# virtual methods
.method public final run()V
    .registers 14

    const-string v0, "Error closing HTTP compressed POST connection output stream. appId"

    iget-object v1, p0, Lj6/i3;->w:Lj6/j3;

    invoke-virtual {v1}, Lcom/google/android/gms/measurement/internal/e;->f()V

    const/4 v1, 0x0

    const/4 v2, 0x0

    :try_start_9
    iget-object v3, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v4, p0, Lj6/i3;->r:Ljava/net/URL;

    invoke-virtual {v4}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;

    move-result-object v4

    instance-of v5, v4, Ljava/net/HttpURLConnection;

    if-eqz v5, :cond_116

    check-cast v4, Ljava/net/HttpURLConnection;

    invoke-virtual {v4, v1}, Ljava/net/HttpURLConnection;->setDefaultUseCaches(Z)V

    iget-object v5, v3, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-static {v5}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const v5, 0xea60

    invoke-virtual {v4, v5}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V

    iget-object v3, v3, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-static {v3}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;)Ljava/lang/Object;

    const v3, 0xee48

    invoke-virtual {v4, v3}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V

    invoke-virtual {v4, v1}, Ljava/net/HttpURLConnection;->setInstanceFollowRedirects(Z)V

    const/4 v3, 0x1

    invoke-virtual {v4, v3}, Ljava/net/HttpURLConnection;->setDoInput(Z)V
    :try_end_37
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_37} :catch_15a
    .catchall {:try_start_9 .. :try_end_37} :catchall_11e

    :try_start_37
    iget-object v5, p0, Lj6/i3;->v:Ljava/util/Map;

    if-eqz v5, :cond_5f

    invoke-interface {v5}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v5

    invoke-interface {v5}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v5

    :goto_43
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v6

    if-eqz v6, :cond_5f

    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/util/Map$Entry;

    invoke-interface {v6}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Ljava/lang/String;

    invoke-interface {v6}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v6

    check-cast v6, Ljava/lang/String;

    invoke-virtual {v4, v7, v6}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_43

    :cond_5f
    iget-object v5, p0, Lj6/i3;->s:[B

    if-eqz v5, :cond_ad

    iget-object v5, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v5, v5, Lj6/x5;->b:Lj6/b6;

    .line 1
    iget-object v5, v5, Lj6/b6;->g:Lj6/d6;

    invoke-static {v5}, Lj6/b6;->I(Lj6/y5;)Lj6/y5;

    .line 2
    iget-object v6, p0, Lj6/i3;->s:[B

    invoke-virtual {v5, v6}, Lj6/d6;->P([B)[B

    move-result-object v5

    iget-object v6, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v6, v6, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v6}, Lcom/google/android/gms/measurement/internal/d;->s()Lcom/google/android/gms/measurement/internal/b;

    move-result-object v6

    .line 3
    iget-object v6, v6, Lcom/google/android/gms/measurement/internal/b;->n:Lj6/e3;

    .line 4
    array-length v7, v5

    const-string v8, "Uploading data. size"

    invoke-static {v7}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v9

    invoke-virtual {v6, v8, v9}, Lj6/e3;->d(Ljava/lang/String;Ljava/lang/Object;)V

    invoke-virtual {v4, v3}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V

    const-string v3, "Content-Encoding"

    const-string v6, "gzip"

    invoke-virtual {v4, v3, v6}, Ljava/net/HttpURLConnection;->addRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    invoke-virtual {v4, v7}, Ljava/net/HttpURLConnection;->setFixedLengthStreamingMode(I)V

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->connect()V

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v3
    :try_end_9a
    .catch Ljava/io/IOException; {:try_start_37 .. :try_end_9a} :catch_111
    .catchall {:try_start_37 .. :try_end_9a} :catchall_10c

    :try_start_9a
    invoke-virtual {v3, v5}, Ljava/io/OutputStream;->write([B)V

    invoke-virtual {v3}, Ljava/io/OutputStream;->close()V
    :try_end_a0
    .catch Ljava/io/IOException; {:try_start_9a .. :try_end_a0} :catch_a7
    .catchall {:try_start_9a .. :try_end_a0} :catchall_a1

    goto :goto_ad

    :catchall_a1
    move-exception v5

    move v9, v1

    move-object v12, v2

    move-object v2, v3

    goto/16 :goto_123

    :catch_a7
    move-exception v5

    move v9, v1

    move-object v12, v2

    move-object v2, v3

    goto/16 :goto_15f

    :cond_ad
    :goto_ad
    :try_start_ad
    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v8
    :try_end_b1
    .catch Ljava/io/IOException; {:try_start_ad .. :try_end_b1} :catch_111
    .catchall {:try_start_ad .. :try_end_b1} :catchall_10c

    :try_start_b1
    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->getHeaderFields()Ljava/util/Map;

    move-result-object v11
    :try_end_b5
    .catch Ljava/io/IOException; {:try_start_b1 .. :try_end_b5} :catch_107
    .catchall {:try_start_b1 .. :try_end_b5} :catchall_103

    :try_start_b5
    new-instance v3, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v3}, Ljava/io/ByteArrayOutputStream;-><init>()V

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;

    move-result-object v5
    :try_end_be
    .catchall {:try_start_b5 .. :try_end_be} :catchall_ef

    const/16 v6, 0x400

    :try_start_c0
    new-array v6, v6, [B

    :goto_c2
    invoke-virtual {v5, v6}, Ljava/io/InputStream;->read([B)I

    move-result v7

    if-lez v7, :cond_cc

    invoke-virtual {v3, v6, v1, v7}, Ljava/io/ByteArrayOutputStream;->write([BII)V

    goto :goto_c2

    :cond_cc
    invoke-virtual {v3}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v10
    :try_end_d0
    .catchall {:try_start_c0 .. :try_end_d0} :catchall_ed

    :try_start_d0
    invoke-virtual {v5}, Ljava/io/InputStream;->close()V
    :try_end_d3
    .catch Ljava/io/IOException; {:try_start_d0 .. :try_end_d3} :catch_fc
    .catchall {:try_start_d0 .. :try_end_d3} :catchall_f7

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V

    iget-object v0, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v0, v0, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v0}, Lcom/google/android/gms/measurement/internal/d;->c()Lj6/d4;

    move-result-object v0

    new-instance v1, Lj6/d3;

    iget-object v6, p0, Lj6/i3;->u:Ljava/lang/String;

    iget-object v7, p0, Lj6/i3;->t:Lj6/h3;

    const/4 v9, 0x0

    move-object v5, v1

    invoke-direct/range {v5 .. v11}, Lj6/d3;-><init>(Ljava/lang/String;Lj6/h3;ILjava/lang/Throwable;[BLjava/util/Map;)V

    :goto_e9
    invoke-virtual {v0, v1}, Lj6/d4;->r(Ljava/lang/Runnable;)V

    return-void

    :catchall_ed
    move-exception v1

    goto :goto_f1

    :catchall_ef
    move-exception v1

    move-object v5, v2

    :goto_f1
    if-eqz v5, :cond_f6

    :try_start_f3
    invoke-virtual {v5}, Ljava/io/InputStream;->close()V

    :cond_f6
    throw v1
    :try_end_f7
    .catch Ljava/io/IOException; {:try_start_f3 .. :try_end_f7} :catch_fc
    .catchall {:try_start_f3 .. :try_end_f7} :catchall_f7

    :catchall_f7
    move-exception v1

    move-object v5, v1

    move v9, v8

    move-object v12, v11

    goto :goto_123

    :catch_fc
    move-exception v1

    move-object v5, v1

    move-object v10, v5

    move v9, v8

    move-object v12, v11

    goto/16 :goto_160

    :catchall_103
    move-exception v5

    move-object v12, v2

    move v9, v8

    goto :goto_123

    :catch_107
    move-exception v5

    move-object v12, v2

    move-object v10, v5

    move v9, v8

    goto :goto_160

    :catchall_10c
    move-exception v3

    move v9, v1

    move-object v12, v2

    move-object v5, v3

    goto :goto_123

    :catch_111
    move-exception v3

    move v9, v1

    move-object v12, v2

    move-object v10, v3

    goto :goto_160

    :cond_116
    :try_start_116
    new-instance v3, Ljava/io/IOException;

    const-string v4, "Failed to obtain HTTP connection"

    invoke-direct {v3, v4}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v3
    :try_end_11e
    .catch Ljava/io/IOException; {:try_start_116 .. :try_end_11e} :catch_15a
    .catchall {:try_start_116 .. :try_end_11e} :catchall_11e

    :catchall_11e
    move-exception v3

    move-object v5, v3

    move v9, v1

    move-object v4, v2

    move-object v12, v4

    :goto_123
    if-eqz v2, :cond_13d

    :try_start_125
    invoke-virtual {v2}, Ljava/io/OutputStream;->close()V
    :try_end_128
    .catch Ljava/io/IOException; {:try_start_125 .. :try_end_128} :catch_129

    goto :goto_13d

    :catch_129
    move-exception v1

    iget-object v2, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v2, v2, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v2}, Lcom/google/android/gms/measurement/internal/d;->s()Lcom/google/android/gms/measurement/internal/b;

    move-result-object v2

    .line 5
    iget-object v2, v2, Lcom/google/android/gms/measurement/internal/b;->f:Lj6/e3;

    .line 6
    iget-object v3, p0, Lj6/i3;->u:Ljava/lang/String;

    invoke-static {v3}, Lcom/google/android/gms/measurement/internal/b;->u(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v3

    invoke-virtual {v2, v0, v3, v1}, Lj6/e3;->e(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V

    :cond_13d
    :goto_13d
    if-eqz v4, :cond_142

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V

    :cond_142
    iget-object v0, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v0, v0, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v0}, Lcom/google/android/gms/measurement/internal/d;->c()Lj6/d4;

    move-result-object v0

    new-instance v1, Lj6/d3;

    iget-object v7, p0, Lj6/i3;->u:Ljava/lang/String;

    iget-object v8, p0, Lj6/i3;->t:Lj6/h3;

    const/4 v10, 0x0

    const/4 v11, 0x0

    move-object v6, v1

    invoke-direct/range {v6 .. v12}, Lj6/d3;-><init>(Ljava/lang/String;Lj6/h3;ILjava/lang/Throwable;[BLjava/util/Map;)V

    invoke-virtual {v0, v1}, Lj6/d4;->r(Ljava/lang/Runnable;)V

    throw v5

    :catch_15a
    move-exception v3

    move-object v5, v3

    move v9, v1

    move-object v4, v2

    move-object v12, v4

    :goto_15f
    move-object v10, v5

    :goto_160
    if-eqz v2, :cond_17a

    :try_start_162
    invoke-virtual {v2}, Ljava/io/OutputStream;->close()V
    :try_end_165
    .catch Ljava/io/IOException; {:try_start_162 .. :try_end_165} :catch_166

    goto :goto_17a

    :catch_166
    move-exception v1

    iget-object v2, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v2, v2, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v2}, Lcom/google/android/gms/measurement/internal/d;->s()Lcom/google/android/gms/measurement/internal/b;

    move-result-object v2

    .line 7
    iget-object v2, v2, Lcom/google/android/gms/measurement/internal/b;->f:Lj6/e3;

    .line 8
    iget-object v3, p0, Lj6/i3;->u:Ljava/lang/String;

    invoke-static {v3}, Lcom/google/android/gms/measurement/internal/b;->u(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v3

    invoke-virtual {v2, v0, v3, v1}, Lj6/e3;->e(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V

    :cond_17a
    :goto_17a
    if-eqz v4, :cond_17f

    invoke-virtual {v4}, Ljava/net/HttpURLConnection;->disconnect()V

    :cond_17f
    iget-object v0, p0, Lj6/i3;->w:Lj6/j3;

    iget-object v0, v0, Lcom/google/android/gms/measurement/internal/e;->a:Lcom/google/android/gms/measurement/internal/d;

    invoke-virtual {v0}, Lcom/google/android/gms/measurement/internal/d;->c()Lj6/d4;

    move-result-object v0

    new-instance v1, Lj6/d3;

    iget-object v7, p0, Lj6/i3;->u:Ljava/lang/String;

    iget-object v8, p0, Lj6/i3;->t:Lj6/h3;

    const/4 v11, 0x0

    move-object v6, v1

    invoke-direct/range {v6 .. v12}, Lj6/d3;-><init>(Ljava/lang/String;Lj6/h3;ILjava/lang/Throwable;[BLjava/util/Map;)V

    goto/16 :goto_e9
.end method
