make LocalFileDownloader.close() actually close things
This doesn't fix the stacktrace but at least it makes this class complete
This commit is contained in:
parent
c3b47ecd5a
commit
6a1ab2b80a
@ -1,5 +1,7 @@
|
||||
package org.fdroid.fdroid.net;
|
||||
|
||||
import org.fdroid.fdroid.Utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -10,23 +12,23 @@ import java.net.URL;
|
||||
|
||||
public class LocalFileDownloader extends Downloader {
|
||||
|
||||
private InputStream inputStream;
|
||||
|
||||
LocalFileDownloader(URL url, File destFile) throws FileNotFoundException, MalformedURLException {
|
||||
super(url, destFile);
|
||||
}
|
||||
|
||||
private File getFileToDownload() {
|
||||
return new File(sourceUrl.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream getDownloadersInputStream() throws IOException {
|
||||
return new FileInputStream(getFileToDownload());
|
||||
inputStream = new FileInputStream(new File(sourceUrl.getPath()));
|
||||
return inputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void close() {
|
||||
// Do nothing.
|
||||
// TODO this should close the InputStream from getDownloadersInputStream()
|
||||
if (inputStream != null) {
|
||||
Utils.closeQuietly(inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user