Skip to content

Commit 1510041

Browse files
committed
🎨 优化部分代码,明确出错信息
1 parent 07bc5a5 commit 1510041

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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("无法获取到文件名");
61+
throw new WxErrorException("无法获取到文件名,Content-disposition为空");
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("无法获取到文件名");
79+
throw new WxErrorException("无法获取到文件名,content为空");
8080
}
8181

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

87-
throw new WxErrorException("无法获取到文件名");
87+
throw new WxErrorException("无法获取到文件名,header信息有问题");
8888
}
8989

9090
}

0 commit comments

Comments
 (0)