Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

FileNotFoundException thrown when server responds with 400 or above

クローズ 初心者向け
#261 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

関連するプルリクエストがすでにマージされています。

  • #382 @RaphaelFakhri による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
android, java
領域
networking

調査の方向性

スタックトレースは com.pusher.client.util の HttpAuthorizer.authorize 、128行目付近の、接続に対して getInputStream() が呼ばれている箇所を指しています。そこでレスポンスのステータスがどう扱われているかを読み、400 以上を返すローカルサーバーで再現してください。エラーステータスの場合に FileNotFoundException ではなくエラーボディが返され、その動作がテストで確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

What is the issue?

When the server responds with a HTTP status 400 or above a FileNotFoundException is thrown

Is it a crash report? Submit stack traces or anything that you think would help
com.pusher.client.AuthorizationFailureException: java.io.FileNotFoundException: http://10.0.2.2:8000/api/device/auth
        at com.pusher.client.util.HttpAuthorizer.authorize(HttpAuthorizer.java:146)
        at com.pusher.client.channel.impl.PrivateChannelImpl.getAuthResponse(PrivateChannelImpl.java:130)
        at com.pusher.client.channel.impl.PrivateChannelImpl.toSubscribeMessage(PrivateChannelImpl.java:90)
        at com.pusher.client.channel.impl.ChannelManager$1.run(ChannelManager.java:149)
        at com.pusher.client.util.Factory$1.run(Factory.java:119)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.io.FileNotFoundException: http://10.0.2.2:8000/api/device/auth
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:255)
        at com.pusher.client.util.HttpAuthorizer.authorize(HttpAuthorizer.java:128)
        at com.pusher.client.channel.impl.PrivateChannelImpl.getAuthResponse(PrivateChannelImpl.java:130) 
        at com.pusher.client.channel.impl.PrivateChannelImpl.toSubscribeMessage(PrivateChannelImpl.java:90) 
        at com.pusher.client.channel.impl.ChannelManager$1.run(ChannelManager.java:149) 
        at com.pusher.client.util.Factory$1.run(Factory.java:119) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:919) 
Any improvements you suggest

When a status 400 or above is returned from the server get the errorStream instead of the inputStream.

if (responseStatus >= HTTP_BAD_REQUEST) {
     is = connection.getErrorStream();
} else {
     is = connection.getInputStream();
}

CC @pusher/mobile

主要言語
Java
スター
315
フォーク
140
平均マージ
10日 14時間
マージ済み PR(30日)
5

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pusher/pusher-websocket-java のほかの issue

pusher/pusher-websocket-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。