mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-02-17 13:49:26 +08:00
🎨 #1659 Json解析统一优化
* 解决动态添加第一个公众号时由于configStorageMap为null报空指针异常 * Json解析统一优化 Co-authored-by: niefy <niefy@qq.com>
This commit is contained in:
@@ -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>
|
||||
* 支付分相关服务类.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user