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;
|
package org.fdroid.fdroid.net;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@ -10,23 +12,23 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class LocalFileDownloader extends Downloader {
|
public class LocalFileDownloader extends Downloader {
|
||||||
|
|
||||||
|
private InputStream inputStream;
|
||||||
|
|
||||||
LocalFileDownloader(URL url, File destFile) throws FileNotFoundException, MalformedURLException {
|
LocalFileDownloader(URL url, File destFile) throws FileNotFoundException, MalformedURLException {
|
||||||
super(url, destFile);
|
super(url, destFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private File getFileToDownload() {
|
|
||||||
return new File(sourceUrl.getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected InputStream getDownloadersInputStream() throws IOException {
|
protected InputStream getDownloadersInputStream() throws IOException {
|
||||||
return new FileInputStream(getFileToDownload());
|
inputStream = new FileInputStream(new File(sourceUrl.getPath()));
|
||||||
|
return inputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void close() {
|
protected void close() {
|
||||||
// Do nothing.
|
if (inputStream != null) {
|
||||||
// TODO this should close the InputStream from getDownloadersInputStream()
|
Utils.closeQuietly(inputStream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user