FileNotFoundException thrown when server responds with 400 or above
Une pull request liée a déjà été fusionnée.
- #382 par @RaphaelFakhri — fusionnée
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 65/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Domaine
- networking
Piste de recherche
La stack trace pointe vers HttpAuthorizer.authorize dans com.pusher.client.util, vers la ligne 128, où getInputStream() est appelée sur la connexion. Lisez comment le statut de la réponse y est traité, puis reproduisez le problème avec un serveur local qui renvoie 400 ou un code supérieur. C'est terminé lorsqu'un statut d'erreur renvoie le corps de l'erreur au lieu d'une FileNotFoundException, et que ce comportement est couvert par un test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- Java
- Étoiles
- 315
- Forks
- 140
- Merge moyen
- 10 j 14 h
- PR mergées (30 j)
- 5
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de pusher/pusher-websocket-java
-
java.lang.NoClassDefFoundError: com.pusher.client.Pusher$$ExternalSyntheticLambda0 on Android API 21-22 anywayPeut-être pris @Keith-wright l’a pris il y a 10 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 22/100
pusher/pusher-websocket-java#366 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
pusher/pusher-websocket-java#340 · 3 commentaires · 7 réactions ·
-
Difficulté 4/5 1-2 jours Accessibilité débutants 8/100
pusher/pusher-websocket-java#311 · 4 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 12/100
pusher/pusher-websocket-java#308 · 2 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 18/100
pusher/pusher-websocket-java#303 · 4 commentaires ·
Toutes les issues de pusher/pusher-websocket-java
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
quarkusio/quarkus-agent-mcp#302 ·
Les mainteneurs répondent en général sous 2 jours
-
build
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
MetricsHub/metricshub-community#1472 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
IdentityArrayObjectSet iterator remove may throw ArrayIndexOutOfBoundsExceptionPeut-être pris @jiteshkhatri11 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
javapathfinder/jpf-core#660 · 1 commentaire ·