fix: Header ETag not exists will throw error: java.lang.NullPointerException #223 (#224)

This commit is contained in:
tangyu 2016-06-29 10:30:31 +08:00 committed by Medcl
parent 4373cf7c94
commit 82432f1059

View File

@ -68,8 +68,8 @@ public class Monitor implements Runnable {
//返回200 才做操作 //返回200 才做操作
if(response.getStatusLine().getStatusCode()==200){ if(response.getStatusLine().getStatusCode()==200){
if (!response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified) if (((response.getLastHeader("Last-Modified")!=null) && !response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified))
||!response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags)) { ||((response.getLastHeader("ETag")!=null) && !response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags))) {
// 远程词库有更新,需要重新加载词典并修改last_modified,eTags // 远程词库有更新,需要重新加载词典并修改last_modified,eTags
Dictionary.getSingleton().reLoadMainDict(); Dictionary.getSingleton().reLoadMainDict();