update downloadmanager...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-09-01 19:23:25 +08:00
parent 189e10bd00
commit 58fc3a4549

View File

@ -101,6 +101,7 @@ public class DownloadManager {
return run(sender, url, file); return run(sender, url, file);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
sender.sendMessage("§4错误: §c无法识别的URL地址..."); sender.sendMessage("§4错误: §c无法识别的URL地址...");
sender.sendMessage("§4地址: §c" + urlstring);
return false; return false;
} }
} }
@ -126,6 +127,11 @@ public class DownloadManager {
sender.sendMessage("§6开始下载: §3" + getFileName(url)); sender.sendMessage("§6开始下载: §3" + getFileName(url));
sender.sendMessage("§6下载地址: §3" + url.toString()); sender.sendMessage("§6下载地址: §3" + url.toString());
int fileLength = url.openConnection().getContentLength(); int fileLength = url.openConnection().getContentLength();
if (fileLength < 0) {
sender.sendMessage("§6下载: §c文件 " + file.getName() + " 获取长度错误(可能是网络问题)!");
sender.sendMessage("§6文件: §c " + file.getName() + " 下载失败!");
return false;
}
sender.sendMessage("§6文件长度: §3" + fileLength); sender.sendMessage("§6文件长度: §3" + fileLength);
in = new BufferedInputStream(url.openStream()); in = new BufferedInputStream(url.openStream());
if (!file.getParentFile().exists()) { if (!file.getParentFile().exists()) {