Open susirsusir opened 3 years ago
还有另外一处地方也会出现空指针 同样是 task.getUrl()为空
1 com.liulishuo.okdownload.core.IdentifiedTask.a(SourceFile:40) 2 com.liulishuo.okdownload.DownloadTask.equals(SourceFile:930) 3 com.liulishuo.okdownload.core.download.DownloadCall.a(SourceFile:394) 4 com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.a(SourceFile:468) 5 com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.a(SourceFile:426) 6 com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.j(SourceFile:420) 7 com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.h(SourceFile:153) 8 com.liulishuo.okdownload.core.dispatcher.DownloadDispatcher.a(SourceFile:113) 9 com.liulishuo.okdownload.DownloadTask.b(SourceFile:525)
具体出错代码: IdentifiedTask.java public boolean compareIgnoreId(IdentifiedTask another) { if (!getUrl().equals(another.getUrl())) return false;
if (getUrl().equals(EMPTY_URL) || getParentFile().equals(EMPTY_FILE)) return false;
if (getProvidedPathFile().equals(another.getProvidedPathFile())) return true;
if (!getParentFile().equals(another.getParentFile())) return false;
// cover the case of filename is provided by response.
final String filename = getFilename();
final String anotherFilename = another.getFilename();
return anotherFilename != null && filename != null && anotherFilename.equals(filename);
}
@Jacksgong
OkDownload Version
v1.0.7
Problem Describe
OkDownload Download(11933) java.lang.NullPointerException : Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
1 com.liulishuo.okdownload.core.download.DownloadCall.a(SourceFile:149) 2 com.liulishuo.okdownload.core.NamedRunnable.run(SourceFile:32) 3 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 4 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 5 java.lang.Thread.run(Thread.java:764)
不确定到底是哪里有问题,创建任务时候url确定是有的,但是执行到这里报错空指针 if (task.getUrl().length() <= 0) { this.cache = new DownloadCache.PreError( new IOException("unexpected url: " + task.getUrl())); break; }