diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java index aba5e2669..a73e01d0d 100755 --- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java +++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java @@ -36,19 +36,16 @@ public class WxCryptUtil { private static final Base64 BASE64 = new Base64(); private static final Charset CHARSET = StandardCharsets.UTF_8; - private static final ThreadLocal BUILDER_LOCAL = new ThreadLocal() { - @Override - protected DocumentBuilder initialValue() { - try { - final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setExpandEntityReferences(false); - factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - return factory.newDocumentBuilder(); - } catch (ParserConfigurationException exc) { - throw new IllegalArgumentException(exc); - } + private static final ThreadLocal BUILDER_LOCAL = ThreadLocal.withInitial(() -> { + try { + final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setExpandEntityReferences(false); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + return factory.newDocumentBuilder(); + } catch (ParserConfigurationException exc) { + throw new IllegalArgumentException(exc); } - }; + }); protected byte[] aesKey; protected String token; @@ -67,7 +64,7 @@ public class WxCryptUtil { public WxCryptUtil(String token, String encodingAesKey, String appidOrCorpid) { this.token = token; this.appidOrCorpid = appidOrCorpid; - this.aesKey = BaseEncoding.base64().decode(CharMatcher.whitespace().removeFrom(encodingAesKey)); + this.aesKey = Base64.decodeBase64(CharMatcher.whitespace().removeFrom(encodingAesKey)); } private static String extractEncryptPart(String xml) { diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceImpl.java new file mode 100644 index 000000000..58fb09cf9 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceImpl.java @@ -0,0 +1,12 @@ +package me.chanjar.weixin.cp.tp.service.impl; + +/** + *
+ *  默认接口实现类,使用apache httpclient实现
+ * Created by zhenjun cai.
+ * 
+ * + * @author zhenjun cai + */ +public class WxCpTpServiceImpl extends WxCpTpServiceApacheHttpClientImpl { +}