Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A network request is not being handled on failure #226

Open
amazuerar opened this issue Aug 13, 2021 · 1 comment
Open

A network request is not being handled on failure #226

amazuerar opened this issue Aug 13, 2021 · 1 comment

Comments

@amazuerar
Copy link

Dear Developer!

My name is Alejandro Mazuera-Rozo, I am a PhD Student at Universidad de los Andes, and at Università della Svizzera italiana. I am part of a research on the usage of network libraries within Android apps. As result of this we identified some code locations that might have network related problems.

In this case, we address the code locations that are related to a network request which is not being assessed on failure. In order to avoid misbehaviour when performing network operations it is recommended to handle failure scenarios.

In order to address this issue we recommend:

  1. To add a try statement allowing you to define a block of code to be assessed while being executed.
  2. To include a catch statement in which one defines a block of code to be executed if an error occurs.

Potential Code Location not handling failure scenarios when performing a network request

override fun doRequest(baseUrl: URL, data: String): String {
val connection = baseUrl.openConnection() as HttpURLConnection

@Lee-Carre
Copy link

@amazuerar

Since you did I thorough analysis of the source, and identified the changes necessary, why not submit a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants