Merge pull request #144 from DevFactory/release/redundant-nullcheck-fix-1
Fixing redundant null check of value known to be non-null.
This commit is contained in:
commit
e673eca316
@ -296,10 +296,8 @@ public class Dictionary {
|
|||||||
logger.error("ik-analyzer",e);
|
logger.error("ik-analyzer",e);
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
if(is != null){
|
is.close();
|
||||||
is.close();
|
is = null;
|
||||||
is = null;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("ik-analyzer",e);
|
logger.error("ik-analyzer",e);
|
||||||
}
|
}
|
||||||
@ -317,11 +315,14 @@ public class Dictionary {
|
|||||||
for(String location:remoteExtDictFiles){
|
for(String location:remoteExtDictFiles){
|
||||||
logger.info("[Dict Loading] " + location);
|
logger.info("[Dict Loading] " + location);
|
||||||
List<String> lists = getRemoteWords(location);
|
List<String> lists = getRemoteWords(location);
|
||||||
|
|
||||||
|
/** Redundant Nullcheck as the list is initialized in the getRemoteWords method
|
||||||
//如果找不到扩展的字典,则忽略
|
//如果找不到扩展的字典,则忽略
|
||||||
if(lists == null){
|
if(lists == null){
|
||||||
logger.error("[Dict Loading] "+location+"加载失败");
|
logger.error("[Dict Loading] "+location+"加载失败");
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for(String theWord:lists){
|
for(String theWord:lists){
|
||||||
if (theWord != null && !"".equals(theWord.trim())) {
|
if (theWord != null && !"".equals(theWord.trim())) {
|
||||||
//加载扩展词典数据到主内存词典中
|
//加载扩展词典数据到主内存词典中
|
||||||
@ -454,10 +455,8 @@ public class Dictionary {
|
|||||||
|
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
if(is != null){
|
is.close();
|
||||||
is.close();
|
is = null;
|
||||||
is = null;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("ik-analyzer",e);
|
logger.error("ik-analyzer",e);
|
||||||
}
|
}
|
||||||
@ -470,11 +469,14 @@ public class Dictionary {
|
|||||||
for(String location:remoteExtStopWordDictFiles){
|
for(String location:remoteExtStopWordDictFiles){
|
||||||
logger.info("[Dict Loading] " + location);
|
logger.info("[Dict Loading] " + location);
|
||||||
List<String> lists = getRemoteWords(location);
|
List<String> lists = getRemoteWords(location);
|
||||||
|
|
||||||
|
/** Redundant Nullcheck as the list is initialized in the getRemoteWords method
|
||||||
//如果找不到扩展的字典,则忽略
|
//如果找不到扩展的字典,则忽略
|
||||||
if(lists == null){
|
if(lists == null){
|
||||||
logger.error("[Dict Loading] "+location+"加载失败");
|
logger.error("[Dict Loading] "+location+"加载失败");
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
for(String theWord:lists){
|
for(String theWord:lists){
|
||||||
if (theWord != null && !"".equals(theWord.trim())) {
|
if (theWord != null && !"".equals(theWord.trim())) {
|
||||||
//加载远程词典数据到主内存中
|
//加载远程词典数据到主内存中
|
||||||
@ -553,10 +555,8 @@ public class Dictionary {
|
|||||||
logger.error("ik-analyzer",e);
|
logger.error("ik-analyzer",e);
|
||||||
}finally{
|
}finally{
|
||||||
try {
|
try {
|
||||||
if(is != null){
|
is.close();
|
||||||
is.close();
|
is = null;
|
||||||
is = null;
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("ik-analyzer",e);
|
logger.error("ik-analyzer",e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user