🎨 #1659 Json解析统一优化

* 解决动态添加第一个公众号时由于configStorageMap为null报空指针异常

* Json解析统一优化

Co-authored-by: niefy <niefy@qq.com>
This commit is contained in:
niefy
2020-07-06 17:01:37 +08:00
committed by GitHub
parent 8121a521d3
commit 0adca9650d
114 changed files with 229 additions and 337 deletions

View File

@@ -5,8 +5,6 @@ import com.github.binarywang.wxpay.bean.payscore.WxPayScoreRequest;
import com.github.binarywang.wxpay.bean.payscore.WxPayScoreResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import java.net.URISyntaxException;
/**
* <pre>
* 支付分相关服务类.

View File

@@ -1,8 +1,6 @@
package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.profitsharing.*;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingResult;
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingRequest;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.ProfitSharingService;

View File

@@ -3,8 +3,8 @@ package com.github.binarywang.wxpay.service.impl;
import com.github.binarywang.wxpay.bean.WxPayApiData;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import jodd.util.Base64;
import me.chanjar.weixin.common.util.json.GsonParser;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.HttpStatus;
@@ -38,7 +38,6 @@ import java.nio.charset.StandardCharsets;
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
private final static JsonParser JSON_PARSER = new JsonParser();
@Override
public byte[] postForBytes(String url, String requestStr, boolean useKey) throws WxPayException {
@@ -104,7 +103,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
return responseString;
} else {
//有错误提示信息返回
JsonObject jsonObject = JSON_PARSER.parse(responseString).getAsJsonObject();
JsonObject jsonObject = GsonParser.parse(responseString);
throw new WxPayException(jsonObject.get("message").getAsString());
}
} catch (Exception e) {
@@ -132,7 +131,7 @@ public class WxPayServiceApacheHttpImpl extends BaseWxPayServiceImpl {
return responseString;
} else {
//有错误提示信息返回
JsonObject jsonObject = JSON_PARSER.parse(responseString).getAsJsonObject();
JsonObject jsonObject = GsonParser.parse(responseString);
throw new WxPayException(jsonObject.get("message").getAsString());
}
} catch (Exception e) {