diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java index d11499bd4..e12e30493 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java @@ -25,11 +25,7 @@ import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.util.DataUtils; import me.chanjar.weixin.common.util.RandomUtils; import me.chanjar.weixin.common.util.crypto.SHA1; -import me.chanjar.weixin.common.util.http.RequestExecutor; -import me.chanjar.weixin.common.util.http.RequestHttp; -import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor; -import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor; -import me.chanjar.weixin.common.util.http.URIUtil; +import me.chanjar.weixin.common.util.http.*; import me.chanjar.weixin.common.util.json.GsonParser; import me.chanjar.weixin.common.util.json.WxGsonBuilder; import me.chanjar.weixin.mp.api.*; @@ -46,16 +42,7 @@ import java.io.IOException; import java.util.Map; import java.util.concurrent.locks.Lock; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.CLEAR_QUOTA_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.FETCH_SHORTEN_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.GEN_SHORTEN_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.GET_CALLBACK_IP_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.GET_CURRENT_AUTOREPLY_INFO_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.GET_TICKET_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.NETCHECK_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.QRCONNECT_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.SEMANTIC_SEMPROXY_SEARCH_URL; -import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.SHORTURL_API_URL; +import static me.chanjar.weixin.mp.enums.WxMpApiUrl.Other.*; /** * 基础实现类. @@ -482,6 +469,10 @@ public abstract class BaseWxMpServiceImpl implements WxMpService, RequestH @Override public void setWxMpConfigStorage(WxMpConfigStorage wxConfigProvider) { final String defaultMpId = wxConfigProvider.getAppId(); + if (defaultMpId == null) { + throw new WxRuntimeException("appid不能设置为null"); + } + this.setMultiConfigStorages(ImmutableMap.of(defaultMpId, wxConfigProvider), defaultMpId); }