Skip to content

Commit 2cbd91c

Browse files
committed
1、将http 304作为正常状态处理;2、应为ETag,而不是ETags
1、将http 304作为正常状态处理,避免大量304错误写到日志文件里;2、应为ETag,而不是ETags
1 parent 2f36702 commit 2cbd91c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/org/wltea/analyzer/dic/Monitor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ public void run() {
6262
response = httpclient.execute(head);
6363

6464
//返回200 才做操作
65-
if(response.getStatusLine().getStatusCode()==200){
65+
if(response.getStatusLine().getStatusCode()==200 || response.getStatusLine().getStatusCode()==304){
6666

6767
if (!response.getLastHeader("Last-Modified").getValue().equalsIgnoreCase(last_modified)
68-
||!response.getLastHeader("ETags").getValue().equalsIgnoreCase(eTags)) {
68+
||!response.getLastHeader("ETag").getValue().equalsIgnoreCase(eTags)) {
6969

7070
// 远程词库有更新,需要重新加载词典,并修改last_modified,eTags
7171
Dictionary.getSingleton().reLoadMainDict();
7272
last_modified = response.getLastHeader("Last-Modified")==null?null:response.getLastHeader("Last-Modified").getValue();
73-
eTags = response.getLastHeader("ETags")==null?null:response.getLastHeader("ETags").getValue();
73+
eTags = response.getLastHeader("ETag")==null?null:response.getLastHeader("ETag").getValue();
7474
}
7575
}else{
7676
Dictionary.logger.info("remote_ext_dict {} return bad code {}" , location , response.getStatusLine().getStatusCode() );

0 commit comments

Comments
 (0)