Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/yudao-cloud
# Conflicts: # yudao-dependencies/pom.xml # yudao-module-report/yudao-module-report-server/pom.xmlpull/250/head
commit
915885c825
|
|
@ -27,17 +27,17 @@
|
|||
<springdoc.version>1.8.0</springdoc.version>
|
||||
<knife4j.version>4.5.0</knife4j.version>
|
||||
<!-- DB 相关 -->
|
||||
<druid.version>1.2.27</druid.version>
|
||||
<druid.version>1.2.28</druid.version>
|
||||
<mybatis.version>3.5.19</mybatis.version>
|
||||
<mybatis-plus.version>3.5.15</mybatis-plus.version>
|
||||
<mybatis-plus-join.version>1.5.5</mybatis-plus-join.version>
|
||||
<mybatis-plus.version>3.5.16</mybatis-plus.version>
|
||||
<mybatis-plus-join.version>1.5.7</mybatis-plus-join.version>
|
||||
<dynamic-datasource.version>4.5.0</dynamic-datasource.version>
|
||||
<easy-trans.version>3.0.6</easy-trans.version>
|
||||
<redisson.version>3.52.0</redisson.version>
|
||||
<dm8.jdbc.version>8.1.3.140</dm8.jdbc.version>
|
||||
<kingbase.jdbc.version>8.6.0</kingbase.jdbc.version>
|
||||
<opengauss.jdbc.version>5.1.0</opengauss.jdbc.version>
|
||||
<taos.version>3.7.9</taos.version>
|
||||
<kingbase.jdbc.version>9.0.1.jre7</kingbase.jdbc.version>
|
||||
<opengauss.jdbc.version>7.0.0-RC3-og</opengauss.jdbc.version>
|
||||
<taos.version>3.8.3</taos.version>
|
||||
<!-- 消息队列 -->
|
||||
<rocketmq-spring.version>2.3.5</rocketmq-spring.version>
|
||||
<!-- RPC 相关 -->
|
||||
|
|
@ -58,36 +58,36 @@
|
|||
<flowable.version>6.8.1</flowable.version>
|
||||
<!-- 工具类相关 -->
|
||||
<anji-plus-captcha.version>1.4.0</anji-plus-captcha.version>
|
||||
<jsoup.version>1.21.2</jsoup.version>
|
||||
<lombok.version>1.18.42</lombok.version>
|
||||
<jsoup.version>1.22.2</jsoup.version>
|
||||
<lombok.version>1.18.46</lombok.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
<hutool-5.version>5.8.42</hutool-5.version>
|
||||
<hutool-5.version>5.8.44</hutool-5.version>
|
||||
<fastexcel.version>1.3.0</fastexcel.version>
|
||||
<velocity.version>2.4</velocity.version> <!-- JDK8 不能从 2.4 升级到 2.4.1,会报包不存在!!!! -->
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<guava.version>33.5.0-jre</guava.version>
|
||||
<guava.version>33.6.0-jre</guava.version>
|
||||
<transmittable-thread-local.version>2.14.5</transmittable-thread-local.version>
|
||||
<commons-net.version>3.12.0</commons-net.version>
|
||||
<commons-net.version>3.13.0</commons-net.version>
|
||||
<commons-lang3.version>3.20.0</commons-lang3.version>
|
||||
<jsch.version>2.27.7</jsch.version>
|
||||
<jsch.version>2.28.2</jsch.version>
|
||||
<tika-core.version>2.9.3</tika-core.version> <!-- JDK8 不能从 2.9.3 升级到 3.X,会报 JDK8 不支持 -->
|
||||
<ip2region.version>2.7.0</ip2region.version>
|
||||
<bizlog-sdk.version>3.0.6</bizlog-sdk.version>
|
||||
<reflections.version>0.10.2</reflections.version>
|
||||
<netty.version>4.2.9.Final</netty.version>
|
||||
<netty.version>4.2.12.Final</netty.version>
|
||||
<mqtt.version>1.2.5</mqtt.version>
|
||||
<vertx.version>4.5.22</vertx.version>
|
||||
<vertx.version>4.5.26</vertx.version>
|
||||
<okhttp.version>4.12.0</okhttp.version>
|
||||
<californium.version>3.12.0</californium.version>
|
||||
<j2mod.version>3.2.1</j2mod.version>
|
||||
<californium.version>3.14.0</californium.version>
|
||||
<j2mod.version>3.3.0</j2mod.version>
|
||||
<!-- 三方云服务相关 -->
|
||||
<awssdk.version>2.40.15</awssdk.version>
|
||||
<awssdk.version>2.44.0</awssdk.version>
|
||||
<justauth.version>1.16.7</justauth.version>
|
||||
<justauth-starter.version>1.4.0</justauth-starter.version>
|
||||
<jimureport.version>2.1.3</jimureport.version>
|
||||
<jimubi.version>2.3.0</jimubi.version>
|
||||
<jimureport.version>2.3.2</jimureport.version>
|
||||
<jimubi.version>2.3.2</jimubi.version>
|
||||
<weixin-java.version>4.7.9-20251224.161447</weixin-java.version>
|
||||
<alipay-sdk-java.version>4.40.607.ALL</alipay-sdk-java.version>
|
||||
<alipay-sdk-java.version>4.40.771.ALL</alipay-sdk-java.version>
|
||||
<!-- 专属于 JDK8 安全漏洞升级 -->
|
||||
<logback.version>1.2.13</logback.version> <!-- 无法使用 1.3.X 版本,启动会报错 -->
|
||||
</properties>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package cn.iocoder.yudao.framework.common.util.http;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.map.TableMap;
|
||||
import cn.hutool.core.net.url.UrlBuilder;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
|
|
@ -70,9 +68,7 @@ public class HttpUtils {
|
|||
public static String replaceUrlQuery(String url, String key, String value) {
|
||||
UrlBuilder builder = UrlBuilder.of(url, Charset.defaultCharset());
|
||||
// 先移除
|
||||
TableMap<CharSequence, CharSequence> query = (TableMap<CharSequence, CharSequence>)
|
||||
ReflectUtil.getFieldValue(builder.getQuery(), "query");
|
||||
query.remove(key);
|
||||
builder.getQuery().remove(key);
|
||||
// 后添加
|
||||
builder.addQuery(key, value);
|
||||
return builder.build();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package cn.iocoder.yudao.framework.common.util.http;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class HttpUtilsTest {
|
||||
|
||||
@Test
|
||||
public void testReplaceUrlQuery() {
|
||||
// 定义测试用例:{原始URL, Key, Value, 期望结果}
|
||||
String[][] testCases = {
|
||||
// 场景1: 替换已存在的参数 (注意参数顺序可能会变,因为 UrlQuery 内部是 List)
|
||||
{"https://example.com/path?a=1&b=2", "a", "3", "https://example.com/path?b=2&a=3"},
|
||||
// 场景2: 添加不存在的参数
|
||||
{"https://example.com/path?a=1", "b", "2", "https://example.com/path?a=1&b=2"},
|
||||
// 场景3: URL 本身没有查询参数
|
||||
{"https://example.com/path", "a", "1", "https://example.com/path?a=1"},
|
||||
// 场景4: 值为空 (根据原逻辑,空值通常会被移除或不添加,这里假设是移除)
|
||||
// 注意:你需要根据 HttpUtils 实际对 null/empty 的处理来调整 expected
|
||||
{"https://example.com/path?a=1", "a", "", "https://example.com/path?a="},
|
||||
};
|
||||
|
||||
System.out.println("开始运行 HttpUtils.replaceUrlQuery 测试...");
|
||||
|
||||
for (int i = 0; i < testCases.length; i++) {
|
||||
String[] currentCase = testCases[i]; // 必须先取出当前这一行的数组
|
||||
|
||||
String url = currentCase[0];
|
||||
String key = currentCase[1];
|
||||
String value = currentCase[2];
|
||||
String expected = currentCase[3];
|
||||
|
||||
// 调用你优化后的方法
|
||||
String actual = HttpUtils.replaceUrlQuery(url, key, value);
|
||||
|
||||
// 核心验证:断言实际结果必须等于期望结果
|
||||
// 如果不相等,测试会直接报错,并打印出是哪一行错了
|
||||
try {
|
||||
assertEquals(expected, actual, "测试用例 " + (i + 1) + " 失败: " + url);
|
||||
System.out.println("✅ 用例 " + (i + 1) + " 通过: " + actual);
|
||||
} catch (AssertionError e) {
|
||||
System.err.println("❌ 用例 " + (i + 1) + " 失败!");
|
||||
System.err.println(" 输入: " + url + " | " + key + "=" + value);
|
||||
System.err.println(" 期望: " + expected);
|
||||
System.err.println(" 实际: " + actual);
|
||||
throw e; // 抛出错误,让测试标记为失败
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue