Commit 10115e1c authored by 唐峰's avatar 唐峰

极验异常时,处理空指针问题

parent ff608dc3
......@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import java.io.IOException;
......@@ -297,17 +298,21 @@ public class GeetestLib {
}
String return_seccode = "";
try {
if (StringUtils.isNotEmpty(response)) {
return val;
}
JSONObject return_map = JSONObject.parseObject(response);
return_seccode = return_map.getString("seccode");
gtlog("md5: " + Md5Util.build(return_seccode));
if (return_seccode.equals(Md5Util.build(seccode))) {
gtlog("validateMethod: "+ return_map.getString("challenge_type"));
gtlog("validateMethod: " + return_map.getString("challenge_type"));
val.put("validataMethod", return_map.getString("challenge_type"));
val.put("bl", 1);
return val;
} else {
return val;
}
} catch (JSONException e) {
gtlog("json load error");
return val;
......@@ -348,7 +353,7 @@ public class GeetestLib {
protected boolean checkResultByPrivate(String challenge, String validate) {
gtlog("privateKey: " + privateKey);
String encodeStr = Md5Util.build(privateKey + "geetest" + challenge);
gtlog("encodeStr: "+ encodeStr);
gtlog("encodeStr: " + encodeStr);
gtlog("valdate: " + validate);
return validate.equals(encodeStr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment