mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-19 18:22:27 +08:00
优化部分代码
This commit is contained in:
@@ -9,8 +9,6 @@ import me.chanjar.weixin.common.util.fs.FileUtils;
|
||||
import me.chanjar.weixin.common.util.http.MediaDownloadRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
|
||||
import me.chanjar.weixin.common.util.http.RequestExecutor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -22,8 +20,6 @@ import java.util.UUID;
|
||||
* @author <a href="https://github.com/binarywang">Binary Wang</a>
|
||||
*/
|
||||
public class WxMaMediaServiceImpl implements WxMaMediaService {
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private WxMaService wxMaService;
|
||||
|
||||
public WxMaMediaServiceImpl(WxMaService wxMaService) {
|
||||
@@ -35,8 +31,7 @@ public class WxMaMediaServiceImpl implements WxMaMediaService {
|
||||
try {
|
||||
return this.uploadMedia(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build());
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +48,7 @@ public class WxMaMediaServiceImpl implements WxMaMediaService {
|
||||
.create(this.wxMaService.getRequestHttp(), Files.createTempDirectory("wxma").toFile());
|
||||
return this.wxMaService.execute(executor, MEDIA_GET_URL, "media_id=" + mediaId);
|
||||
} catch (IOException e) {
|
||||
this.log.error(e.getMessage(), e);
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build());
|
||||
throw new WxErrorException(WxError.newBuilder().setErrorMsg(e.getMessage()).build(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user