From 0bbbd746e8c39d91ad7b47a4e36e29ab972dc98c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期二, 20 十月 2026 16:56:54 +0800
Subject: [PATCH] 处理长期任务发送问题
---
ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
index 0310368..971ef13 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -395,14 +395,18 @@
// 鑾峰彇鍝嶅簲鐮�
int responseCode = connection.getResponseCode();
+ log.info("postFormRequest 鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
- // 璇诲彇鍝嶅簲
+ // 璇诲彇鍝嶅簲锛堥潪200鏃秂rrorStream鍙兘涓簄ull锛岄伩鍏峃PE锛�
StringBuilder response = new StringBuilder();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- } else {
- reader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
+ InputStream respStream = responseCode == HttpURLConnection.HTTP_OK
+ ? connection.getInputStream()
+ : connection.getErrorStream();
+ if (respStream == null) {
+ log.warn("postFormRequest 鍝嶅簲浣撲负绌猴紝鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
+ return "";
}
+ reader = new BufferedReader(new InputStreamReader(respStream));
String line;
while ((line = reader.readLine()) != null) {
--
Gitblit v1.9.3