Skip to content

升级到4.8后用httpclient5 NPE了。 #3836

@sanzi1205

Description

@sanzi1205

简要描述

升级到4.8后用httpclient5 NPE了。

模块版本情况

  • WxJava 模块名: weixin-java-mp-4.8.0
Image
 @Override
  public void initHttp() {
    WxMpConfigStorage configStorage = this.getWxMpConfigStorage();
    HttpComponentsClientBuilder apacheHttpClientBuilder = DefaultHttpComponentsClientBuilder.get();

    apacheHttpClientBuilder.httpProxyHost(configStorage.getHttpProxyHost())
      .httpProxyPort(configStorage.getHttpProxyPort())
      .httpProxyUsername(configStorage.getHttpProxyUsername())
      .httpProxyPassword(configStorage.getHttpProxyPassword().toCharArray());

    if (configStorage.getHttpProxyHost() != null && configStorage.getHttpProxyPort() > 0) {
      this.httpProxy = new HttpHost(configStorage.getHttpProxyHost(), configStorage.getHttpProxyPort());
    }

    this.httpClient = apacheHttpClientBuilder.build();
  }

具体的类:WxMpServiceHttpComponentsImpl
NPE具体的行: configStorage.getHttpProxyPassword().toCharArray()这里的toCharArray()会NPE。
第一次使用这个类库,我也不确定是真的NPE还是我的使用方式不对,麻烦大佬看下。

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions