f.smali

.class Lcom/baidu/location/g/f;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic a:Lcom/baidu/location/g/e;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    return-void
.end method

.method constructor <init>(Lcom/baidu/location/g/e;)V
    .registers 2

    iput-object p1, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

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

    return-void
.end method


# virtual methods
.method public run()V
    .registers 13

    iget-object v0, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    invoke-static {}, Lcom/baidu/location/g/k;->e()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/baidu/location/g/e;->h:Ljava/lang/String;

    iget-object v0, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    invoke-virtual {v0}, Lcom/baidu/location/g/e;->a()V

    iget-object v0, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    iget v0, v0, Lcom/baidu/location/g/e;->i:I

    const/4 v1, 0x0

    move-object v2, v1

    :goto_13
    const/4 v3, 0x1

    const/4 v4, 0x0

    if-lez v0, :cond_119

    :try_start_17
    new-instance v5, Ljava/net/URL;

    iget-object v6, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    iget-object v6, v6, Lcom/baidu/location/g/e;->h:Ljava/lang/String;

    invoke-direct {v5, v6}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

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

    move-result-object v5

    check-cast v5, Ljava/net/HttpURLConnection;
    :try_end_26
    .catch Ljava/lang/Exception; {:try_start_17 .. :try_end_26} :catch_d2
    .catchall {:try_start_17 .. :try_end_26} :catchall_cf

    :try_start_26
    const-string v2, "GET"

    invoke-virtual {v5, v2}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V

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

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

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

    sget v2, Lcom/baidu/location/g/a;->b:I

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

    sget v2, Lcom/baidu/location/g/a;->b:I

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

    const-string v2, "Content-Type"

    const-string v6, "application/x-www-form-urlencoded; charset=utf-8"

    invoke-virtual {v5, v2, v6}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    const-string v2, "Accept-Charset"

    const-string v6, "UTF-8"

    invoke-virtual {v5, v2, v6}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    sget-object v2, Lcom/baidu/location/g/k;->ax:Ljava/lang/String;

    if-eqz v2, :cond_57

    const-string v2, "bd-loc-android"

    sget-object v6, Lcom/baidu/location/g/k;->ax:Ljava/lang/String;

    invoke-virtual {v5, v2, v6}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V

    :cond_57
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->getResponseCode()I

    move-result v2

    const/16 v6, 0xc8

    if-ne v2, v6, :cond_a5

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

    move-result-object v2
    :try_end_63
    .catch Ljava/lang/Exception; {:try_start_26 .. :try_end_63} :catch_ca
    .catchall {:try_start_26 .. :try_end_63} :catchall_c6

    :try_start_63
    new-instance v6, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v6}, Ljava/io/ByteArrayOutputStream;-><init>()V
    :try_end_68
    .catch Ljava/lang/Exception; {:try_start_63 .. :try_end_68} :catch_9f
    .catchall {:try_start_63 .. :try_end_68} :catchall_9b

    const/16 v7, 0x400

    :try_start_6a
    new-array v7, v7, [B

    :goto_6c
    invoke-virtual {v2, v7}, Ljava/io/InputStream;->read([B)I

    move-result v8

    const/4 v9, -0x1

    if-eq v8, v9, :cond_77

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

    goto :goto_6c

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

    invoke-virtual {v6}, Ljava/io/ByteArrayOutputStream;->close()V

    iget-object v7, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    new-instance v8, Ljava/lang/String;

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

    move-result-object v9

    const-string/jumbo v10, "utf-8"

    invoke-direct {v8, v9, v10}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    iput-object v8, v7, Lcom/baidu/location/g/e;->j:Ljava/lang/String;

    iget-object v7, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    invoke-virtual {v7, v3}, Lcom/baidu/location/g/e;->a(Z)V

    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->disconnect()V
    :try_end_95
    .catch Ljava/lang/Exception; {:try_start_6a .. :try_end_95} :catch_99
    .catchall {:try_start_6a .. :try_end_95} :catchall_97

    const/4 v7, 0x1

    goto :goto_ab

    :catchall_97
    move-exception v0

    goto :goto_9d

    :catch_99
    move-exception v7

    goto :goto_a1

    :catchall_9b
    move-exception v0

    move-object v6, v1

    :goto_9d
    move-object v1, v2

    goto :goto_c8

    :catch_9f
    move-exception v6

    move-object v6, v1

    :goto_a1
    move-object v11, v5

    move-object v5, v2

    move-object v2, v11

    goto :goto_d5

    :cond_a5
    :try_start_a5
    invoke-virtual {v5}, Ljava/net/HttpURLConnection;->disconnect()V
    :try_end_a8
    .catch Ljava/lang/Exception; {:try_start_a5 .. :try_end_a8} :catch_ca
    .catchall {:try_start_a5 .. :try_end_a8} :catchall_c6

    move-object v2, v1

    move-object v6, v2

    const/4 v7, 0x0

    :goto_ab
    if-eqz v5, :cond_b0

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

    :cond_b0
    if-eqz v2, :cond_ba

    :try_start_b2
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_b5
    .catch Ljava/lang/Exception; {:try_start_b2 .. :try_end_b5} :catch_b6

    goto :goto_ba

    :catch_b6
    move-exception v2

    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    :cond_ba
    :goto_ba
    if-eqz v6, :cond_c4

    :try_start_bc
    invoke-virtual {v6}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_bf
    .catch Ljava/lang/Exception; {:try_start_bc .. :try_end_bf} :catch_c0

    goto :goto_c4

    :catch_c0
    move-exception v2

    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    :cond_c4
    :goto_c4
    move-object v2, v5

    goto :goto_f6

    :catchall_c6
    move-exception v0

    move-object v6, v1

    :goto_c8
    move-object v2, v5

    goto :goto_ff

    :catch_ca
    move-exception v2

    move-object v6, v1

    move-object v2, v5

    move-object v5, v6

    goto :goto_d5

    :catchall_cf
    move-exception v0

    move-object v6, v1

    goto :goto_ff

    :catch_d2
    move-exception v5

    move-object v5, v1

    move-object v6, v5

    :goto_d5
    :try_start_d5
    sget-object v7, Lcom/baidu/location/g/a;->a:Ljava/lang/String;

    const-string v8, "NetworkCommunicationException!"

    invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_dc
    .catchall {:try_start_d5 .. :try_end_dc} :catchall_fd

    if-eqz v2, :cond_e1

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

    :cond_e1
    if-eqz v5, :cond_eb

    :try_start_e3
    invoke-virtual {v5}, Ljava/io/InputStream;->close()V
    :try_end_e6
    .catch Ljava/lang/Exception; {:try_start_e3 .. :try_end_e6} :catch_e7

    goto :goto_eb

    :catch_e7
    move-exception v5

    invoke-virtual {v5}, Ljava/lang/Exception;->printStackTrace()V

    :cond_eb
    :goto_eb
    if-eqz v6, :cond_f5

    :try_start_ed
    invoke-virtual {v6}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_f0
    .catch Ljava/lang/Exception; {:try_start_ed .. :try_end_f0} :catch_f1

    goto :goto_f5

    :catch_f1
    move-exception v5

    invoke-virtual {v5}, Ljava/lang/Exception;->printStackTrace()V

    :cond_f5
    :goto_f5
    const/4 v7, 0x0

    :goto_f6
    if-eqz v7, :cond_f9

    goto :goto_119

    :cond_f9
    add-int/lit8 v0, v0, -0x1

    goto/16 :goto_13

    :catchall_fd
    move-exception v0

    move-object v1, v5

    :goto_ff
    if-eqz v2, :cond_104

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

    :cond_104
    if-eqz v1, :cond_10e

    :try_start_106
    invoke-virtual {v1}, Ljava/io/InputStream;->close()V
    :try_end_109
    .catch Ljava/lang/Exception; {:try_start_106 .. :try_end_109} :catch_10a

    goto :goto_10e

    :catch_10a
    move-exception v1

    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_10e
    :goto_10e
    if-eqz v6, :cond_118

    :try_start_110
    invoke-virtual {v6}, Ljava/io/ByteArrayOutputStream;->close()V
    :try_end_113
    .catch Ljava/lang/Exception; {:try_start_110 .. :try_end_113} :catch_114

    goto :goto_118

    :catch_114
    move-exception v1

    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    :cond_118
    :goto_118
    throw v0

    :cond_119
    :goto_119
    if-gtz v0, :cond_12a

    sget v0, Lcom/baidu/location/g/e;->p:I

    add-int/2addr v0, v3

    sput v0, Lcom/baidu/location/g/e;->p:I

    iget-object v0, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    iput-object v1, v0, Lcom/baidu/location/g/e;->j:Ljava/lang/String;

    iget-object v0, p0, Lcom/baidu/location/g/f;->a:Lcom/baidu/location/g/e;

    invoke-virtual {v0, v4}, Lcom/baidu/location/g/e;->a(Z)V

    goto :goto_12c

    :cond_12a
    sput v4, Lcom/baidu/location/g/e;->p:I

    :goto_12c
    return-void
.end method