Twitter4J
  1. Twitter4J
  2. TFJ-296

TwitterException: -1 on Android platform

    詳細

    • タイプ: バグ バグ
    • ステータス: クローズ クローズ
    • 優先度: 中
    • 解決状況: 修正済み
    • 影響バージョン: なし
    • 修正バージョン: 2.1.1
    • コンポーネント: http
    • ラベル:
      なし

      アクティビティ

      非表示
      Yusuke Yamamoto がコメント - を追加
      According to Hitoshi Kamezaki, they're aware of the issue, but no ETA for the fix is available.
      http://code.google.com/p/android/issues/detail?id=2800

      We'd better just workaround the issue by setting http.keepalive system property to false.
      表示
      Yusuke Yamamoto がコメント - を追加 According to Hitoshi Kamezaki, they're aware of the issue, but no ETA for the fix is available. http://code.google.com/p/android/issues/detail?id=2800 We'd better just workaround the issue by setting http.keepalive system property to false.
      非表示
      Yusuke Yamamoto がコメント - を追加
      workarounded the dalvik side issue.
      表示
      Yusuke Yamamoto がコメント - を追加 workarounded the dalvik side issue.
      非表示
      SUBBA がコメント - を追加
      Appears to be workaround causes the issue for other HTTP connections inside the application.(Android platform 4.2.2).

      {code}
      if (ConfigurationContext.getInstance().isDalvik())
       {
                  // quick and dirty workaround for TFJ-296
                      // it must be an Android/Dalvik/Harmony side issue!!!!
                      System.setProperty("http.keepAlive", "false");
       }
      {code}

      The above code closes other HTTP Keep alive(Persistent) connections inside the app ( Android platform).

      Use case:

      1. Make network call with different service either it could be Google+ or Drop box API service, set connection as Keep-Alive
          setRequestProperty("Connection", "Keep-Alive"); //set Header for HttpURLConnection

      2. Start Twitter4J library. Initialize the Module as below.

      ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
      configurationBuilder.setOAuthConsumerKey(xxxx);
      configurationBuilder.setOAuthConsumerSecret(xxxx);
      Configuration configuration = configurationBuilder.build();
               AsyncTwitterFactory factory = new AsyncTwitterFactory(loadTwitterConfiguration());
               AsyncTwitter aSyncTwitter = factory.getInstance();

      3. After the above code execution , "Keep-Alive" becomes false, HTTP Persistence no longer works for other HTTP connections inside the application.

      Is there any way to reset the value after twitter operation completes? Any suggestions not to affect other HTTP connections..
      表示
      SUBBA がコメント - を追加 Appears to be workaround causes the issue for other HTTP connections inside the application.(Android platform 4.2.2). {code} if (ConfigurationContext.getInstance().isDalvik())  {             // quick and dirty workaround for TFJ-296                 // it must be an Android/Dalvik/Harmony side issue!!!!                 System.setProperty("http.keepAlive", "false");  } {code} The above code closes other HTTP Keep alive(Persistent) connections inside the app ( Android platform). Use case: 1. Make network call with different service either it could be Google+ or Drop box API service, set connection as Keep-Alive     setRequestProperty("Connection", "Keep-Alive"); //set Header for HttpURLConnection 2. Start Twitter4J library. Initialize the Module as below. ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.setOAuthConsumerKey(xxxx); configurationBuilder.setOAuthConsumerSecret(xxxx); Configuration configuration = configurationBuilder.build();          AsyncTwitterFactory factory = new AsyncTwitterFactory(loadTwitterConfiguration());          AsyncTwitter aSyncTwitter = factory.getInstance(); 3. After the above code execution , "Keep-Alive" becomes false, HTTP Persistence no longer works for other HTTP connections inside the application. Is there any way to reset the value after twitter operation completes? Any suggestions not to affect other HTTP connections..

        ピープル

        • 担当者:
          Yusuke Yamamoto
          報告者:
          Yusuke Yamamoto
        • 投票:
          0 この課題に投票する
          ウォッチャー:
          1 この課題のウォッチを開始する

          日付

          • 作成日:
            更新日:
            解決日: