diff --git a/src/main/java/com/gaotao/common/utils/HttpUtils.java b/src/main/java/com/gaotao/common/utils/HttpUtils.java index 39bf246..17af441 100644 --- a/src/main/java/com/gaotao/common/utils/HttpUtils.java +++ b/src/main/java/com/gaotao/common/utils/HttpUtils.java @@ -99,13 +99,19 @@ public class HttpUtils { HttpResponse response = client.send(builder.build(), HttpResponse.BodyHandlers.ofString()); return handleResponse(response); } catch (java.net.http.HttpTimeoutException e) { - // 超时异常特殊处理 - rqrq - Thread.currentThread().interrupt(); throw new RuntimeException("接口响应超时(60秒),请检查网络连接或者接口服务是否可用。 " ); - } catch (IOException | InterruptedException e) { - Thread.currentThread().interrupt(); - throw new RuntimeException("POST 请求失败: " + e.getMessage(), e); + } catch (IOException e) { + // IO 错误:不涉及中断 + throw new RuntimeException("网络或IO错误: " + e.getMessage(), e); + } catch (InterruptedException e) { + // 线程被中断:恢复中断状态,并抛出异常(或返回) + Thread.currentThread().interrupt(); // ✅ 合理 + throw new RuntimeException("请求被中断", e); } + // (IOException | InterruptedException e) { + // Thread.currentThread().interrupt(); + // throw new RuntimeException("POST 请求失败: " + e.getMessage(), e); + // } } /** 构建查询参数字符串 */