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

BoxDownload#getOutputFile returns null #14

Closed
MariusVolkhart opened this issue May 8, 2015 · 3 comments
Closed

BoxDownload#getOutputFile returns null #14

MariusVolkhart opened this issue May 8, 2015 · 3 comments

Comments

@MariusVolkhart
Copy link
Contributor

BoxDownload#getOutputFile() is documented as returning

the output file for the download.

But it has a return value of null hard coded.

Consider the following snippet. The assertion at the bottom will fail, though it seems semantically reasonable and the documentation does not suggest it to be incorrect.

BoxApiFile boxApiFile;
File downloadTarget;
String fileId;

// Some setup...

File sameAsDownloadTarget = boxApiFile.getDownloadRequest(downloadTarget, fileId).send().getOutputFile();

assert downloadTarget.equals(sameAsDownloadTarget);

https://github.com/box/box-android-content-sdk/blob/master/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxDownload.java#L94

@doncung
Copy link
Contributor

doncung commented May 8, 2015

That's odd, the method in BoxDownload is overridden in BoxRequestDownload to return the file provided or a newly created file inside the directory provided. I'll test to see if this is indeed a bug, but BoxDownload is supposed to return null by default with its values changed through overriding.

@doncung
Copy link
Contributor

doncung commented May 9, 2015

I tried a test similar to yours and getOutputFile does return a File for me. If you're getting something different can you post your full source? Might be a particular file.

@doncung doncung closed this as completed May 12, 2015
@MariusVolkhart
Copy link
Contributor Author

I gave you the wrong example code. We were using the variant of BoxApiFile#getDownloadRequest() that takes a OutputStream. I figured I should still be able to get the output file but there's not really way to do so.

I would prefer to see an IllegalStateException instead of returning null if calling getOutputFile() on an object of the stream variant, but this issue is definitely closed.

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