Skip to content

Commit ac405b0

Browse files
gaigeshenbinarywang
authored andcommitted
#869 修复下载临时素材接口异常处理不当的问题
#869 修复下载临时素材接口异常处理不当的问题
1 parent 3537381 commit ac405b0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ sonar-project.properties
5353

5454
!/.mvn/wrapper/maven-wrapper.jar
5555
*.versionsBackup
56+
57+
# STS
58+
.factorypath

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/HttpResponseProxy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String getFileName() throws WxErrorException {
5858
private String getFileName(CloseableHttpResponse response) throws WxErrorException {
5959
Header[] contentDispositionHeader = response.getHeaders("Content-disposition");
6060
if (contentDispositionHeader == null || contentDispositionHeader.length == 0) {
61-
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
61+
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").errorCode(99999).build());
6262
}
6363

6464
return this.extractFileNameFromContentString(contentDispositionHeader[0].getValue());
@@ -76,15 +76,15 @@ private String getFileName(Response response) throws WxErrorException {
7676

7777
private String extractFileNameFromContentString(String content) throws WxErrorException {
7878
if (content == null || content.length() == 0) {
79-
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
79+
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").errorCode(99999).build());
8080
}
8181

8282
Matcher m = PATTERN.matcher(content);
8383
if (m.matches()) {
8484
return m.group(1);
8585
}
8686

87-
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").build());
87+
throw new WxErrorException(WxError.builder().errorMsg("无法获取到文件名").errorCode(99999).build());
8888
}
8989

9090
}

0 commit comments

Comments
 (0)