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
Timob 9797: Android: HTTP Post will save a photo at Internal phone storage #2498
Conversation
@@ -1013,6 +1015,8 @@ protected DefaultHttpClient getClient(boolean validating) | |||
|
|||
public void send(Object userData) throws MethodNotSupportedException | |||
{ | |||
ArrayList<File> tmpFiles = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this can't just be a private variable of the class versus passing it around as a function arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary files are generated in send(). We may have only one http client but call send() many times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but it isn't valid to call send() multiple times when a request is in progress.
We should have deleted and cleared out the temporary files by the time the request finishes right?
Updated. Ready for review again. |
} | ||
if (tmpFiles != null) { | ||
tmpFiles.clear(); | ||
tmpFiles = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we just test if tmpFiles is null OR empty. If this is true then just return.
Otherwise iterate through the files and delete each one. Once this loop is done
just null out tmpFiles (we don't need to clear since it will get GC'ed).
Code reviewed and functional tested. Accepted |
Timob 9797: Android: HTTP Post will save a photo at Internal phone storage
https://jira.appcelerator.org/browse/TIMOB-9797
For functional test, please run the two test cases in JIRA. And run KS->Platform->XHR->UTF-8+GET/POST, KS->Mashups and drillbit-> network/network.httpclient for a sanity check.