修复组件出现的几个问题

This commit is contained in:
laoyuyu
2019-09-30 18:19:03 +08:00
parent 2a92321785
commit 75ff995d81
25 changed files with 122 additions and 132 deletions

View File

@@ -83,16 +83,16 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
return;
}
if (getConfig().isOpenDynamicFile) {
if (getThreadConfig().isOpenDynamicFile) {
readDynamicFile(is);
} else {
readNormal(is);
handleComplete();
}
} catch (IOException e) {
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getConfig().url), e), true);
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
} catch (Exception e) {
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getConfig().url), e), false);
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), false);
} finally {
try {
if (is != null) {
@@ -127,7 +127,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
ReadableByteChannel fic = null;
try {
int len;
fos = new FileOutputStream(getConfig().tempFile, true);
fos = new FileOutputStream(getThreadConfig().tempFile, true);
foc = fos.getChannel();
fic = Channels.newChannel(is);
ByteBuffer bf = ByteBuffer.allocate(getTaskConfig().getBuffSize());
@@ -154,7 +154,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
}
handleComplete();
} catch (IOException e) {
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getConfig().url), e), true);
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
} finally {
try {
if (fos != null) {
@@ -179,7 +179,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
BufferedRandomAccessFile file = null;
try {
file =
new BufferedRandomAccessFile(getConfig().tempFile, "rwd", getTaskConfig().getBuffSize());
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd", getTaskConfig().getBuffSize());
file.seek(getThreadRecord().startLocation);
byte[] buffer = new byte[getTaskConfig().getBuffSize()];
int len;
@@ -201,7 +201,7 @@ final class FtpDThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
}
}
} catch (IOException e) {
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getConfig().url), e), true);
fail(new AriaIOException(TAG, String.format("下载失败【%s】", getThreadConfig().url), e), true);
} finally {
try {
if (file != null) {

View File

@@ -66,9 +66,9 @@ class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
}
file =
new BufferedRandomAccessFile(getConfig().tempFile, "rwd", getTaskConfig().getBuffSize());
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd", getTaskConfig().getBuffSize());
if (getThreadRecord().startLocation != 0) {
//file.skipBytes((int) getConfig().START_LOCATION);
//file.skipBytes((int) getThreadConfig().START_LOCATION);
file.seek(getThreadRecord().startLocation);
}
boolean complete = upload(client, file);
@@ -81,7 +81,7 @@ class FtpUThreadTaskAdapter extends BaseFtpThreadTaskAdapter {
} catch (IOException e) {
fail(new AriaIOException(TAG,
String.format("上传失败filePath: %s, uploadUrl: %s", getEntity().getFilePath(),
getConfig().url)), true);
getThreadConfig().url)), true);
} catch (Exception e) {
fail(new AriaIOException(TAG, null, e), false);
} finally {