{"record":{"id":"f2d6ccaeb2f76031","repo":"binarywang/WxJava","slug":"99-f2d6cc","errorCode":"-99","errorMessage":"上传文件为空","messagePattern":"上传文件为空","errorType":"exception","errorClass":"WxErrorException","httpStatus":null,"severity":"error","filePath":"weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMinishopMediaUploadRequestCustomizeExecutor.java","lineNumber":42,"sourceCode":" * @author altusea\n */\n@Slf4j\npublic class HttpComponentsMinishopMediaUploadRequestCustomizeExecutor extends MinishopUploadRequestCustomizeExecutor<CloseableHttpClient, HttpHost> {\n\n  public HttpComponentsMinishopMediaUploadRequestCustomizeExecutor(RequestHttp<CloseableHttpClient, HttpHost> requestHttp, String respType, String imgUrl) {\n    super(requestHttp, respType, imgUrl);\n  }\n\n  @Override\n  public WxMinishopImageUploadCustomizeResult execute(String uri, File file, WxType wxType) throws WxErrorException, IOException {\n    HttpPost httpPost = new HttpPost(uri);\n    if (requestHttp.getRequestHttpProxy() != null) {\n      RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();\n      httpPost.setConfig(config);\n    }\n    if (this.uploadType.equals(\"0\")) {\n      if (file == null) {\n        throw new WxErrorException(\"上传文件为空\");\n      }\n      HttpEntity entity = MultipartEntityBuilder\n        .create()\n        .addBinaryBody(\"media\", file)\n        .addTextBody(\"resp_type\", this.respType)\n        .addTextBody(\"upload_type\", this.uploadType)\n        .setMode(HttpMultipartMode.EXTENDED)\n        .build();\n      httpPost.setEntity(entity);\n    }\n    else {\n      HttpEntity entity = MultipartEntityBuilder\n              .create()\n              .addTextBody(\"resp_type\", this.respType)\n              .addTextBody(\"upload_type\", this.uploadType)\n              .addTextBody(\"img_url\", this.imgUrl)\n              .setMode(org.apache.hc.client5.http.entity.mime.HttpMultipartMode.EXTENDED)\n              .build();","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/binarywang/WxJava/blob/1c43293a3c2c9d7e91304b6d037fb017f680d0c6/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMinishopMediaUploadRequestCustomizeExecutor.java#L24-L60","documentation":"Error \"上传文件为空\" thrown in binarywang/WxJava.","triggerScenarios":"Thrown at weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/hc/HttpComponentsMinishopMediaUploadRequestCustomizeExecutor.java:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["调用上传接口前检查上传文件对象是否为 null，确保传入有效的文件。","在上传前验证文件存在且大小大于 0。"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1c43293a3c2c9d7e91304b6d037fb017f680d0c6","analyzedAt":"2026-08-14T02:29:11.060Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}