Giter Club home page Giter Club logo

bpcarsharing's People

Contributors

akosuzonyi avatar

Watchers

 avatar

bpcarsharing's Issues

downloadText data integrity

Hi Akos,
Let me think on the sporadic behaviour of the element numbers...
I am wondering if in.readLine() in source Utils.java line 24 could return null in middle of the stream, when connection stalled due high server/network load in certain cases.

-See the official android examples, there are BufferedInputStream() only shown.
https://developer.android.com/reference/java/net/HttpURLConnection
Yep, In case of file input, the unbuffered stream is definitely faster. But some reason they use Buffered streams. I don't know. maybe there are some other things to consider...
-I think, the BufferedReader will not always blocks readLine, when unbuffered stream stalling before the connection finished or timeout occured. Perhaps, there are points when connection hangs right before a new line started (in example) but your BufferedReader's buffer could be empty momentarily. This may depends on MTU, TCP window size, buffer size on producer side, and your App thread timings on consumer side, and of course the BufferedReader's buffer size is important as well. I guess, the default buffer size is 8k, but your response now around 52k long. That means, there will be chunks anyway between producer and consumer side. So, when an end-of-chunk occured exactly at a new line, then readline should returns null because of the consumer could read the buffer til its temporary end, which is a problem.
Probably we have to check somehow, if the connection or stream could provide this missing info about the response buffer already produced totally or not.

-There's no checks for the integrity of the processed stream. Even if I'm wrong with the thought above, and there's no early break from the processing loop, it would be a nice to have doing some integrity check here.
The minimal thing is to check if JSONArray(String) throws an exeption in the case above. Because it is also needed to get lesser elements. Let say the missing "]" does not cause json exception.

-Handle error cases, for debugging and for robustness. (getResponseCode, getErrorStream, etc)
I hope I help a lil bit.
Have a nice day!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.