Skip to content

Commit

Permalink
Merge pull request yaphone#65 from yaphone/revert-64-revert-59-master
Browse files Browse the repository at this point in the history
修复:登录时因账号被封禁而导致一直报空指针异常问题 by 默非默""
  • Loading branch information
yaphone committed Aug 13, 2017
2 parents 2447195 + 1ae2929 commit d5b668b
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,13 @@ private void processLoginInfo(String loginContent) {
LOG.info(e.getMessage());
return;
}
//add by 默非默 2017-08-01 22:28:09
//如果登录被禁止时,则登录返回的message内容不为空,下面代码则判断登录内容是否为空,不为空则退出程序
String msg = getLoginMessage(text);
if (!"".equals(msg)){
LOG.info(msg);
System.exit(0);
}
Document doc = CommonTools.xmlParser(text);
if (doc != null) {
core.getLoginInfo().put(StorageLoginInfoEnum.skey.getKey(),
Expand Down Expand Up @@ -661,4 +668,17 @@ private Map<String, String> syncCheck() {
return resultMap;
}

/**
* 解析登录返回的消息,如果成功登录,则message为空
* @param result
* @return
*/
public String getLoginMessage(String result){
String[] strArr = result.split("<message>");
String[] rs = strArr[1].split("</message>");
if (rs!=null && rs.length>1) {
return rs[0];
}
return "";
}
}

0 comments on commit d5b668b

Please sign in to comment.