[GH-ISSUE #453] Empty response to task checker makes the app crash #318

Open
opened 2026-02-28 01:24:07 +03:00 by kerem · 0 comments
Owner

Originally created by @vanso-hubsi on GitHub (Jun 29, 2016).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/453

Expected behavior

SMSSync not to crash

Actual behavior

SMSSync crashes, when it receives an empty response for the task checking request.

Steps to reproduce the behavior

Enable task checker, let server return an empty response

Notes

It seems the bug is here: PostMessage.java#L378

 } catch (IOException e1) {

When the response is empty, the method messageHttpClient.getResponse().body() throws an exception since getResponse() returns null. This exception is first catched on Line 371, but when the catch block wants to log the error, it does the getResponse().body() call again. That time, only IOExceptions get catched, which doesn't apply and thus makes the app crash.

Originally created by @vanso-hubsi on GitHub (Jun 29, 2016). Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/453 ### Expected behavior SMSSync not to crash ### Actual behavior SMSSync crashes, when it receives an empty response for the task checking request. ### Steps to reproduce the behavior Enable task checker, let server return an empty response ### Notes It seems the bug is here: [PostMessage.java#L378](https://github.com/ushahidi/SMSSync/blob/54951c1794e24f74e12b3df704fe35b6ddb65efd/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java#L378) ``` } catch (IOException e1) { ``` When the response is empty, the method `messageHttpClient.getResponse().body()` throws an exception since `getResponse()` returns null. This exception is first catched on [Line 371](https://github.com/ushahidi/SMSSync/blob/54951c1794e24f74e12b3df704fe35b6ddb65efd/smssync/src/main/java/org/addhen/smssync/data/message/PostMessage.java#L371), but when the catch block wants to log the error, it does the `getResponse().body()` call again. That time, only IOExceptions get catched, which doesn't apply and thus makes the app crash.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SMSSync#318
No description provided.