Revert "fix(error): URLUtil 异常不再吞没,改为抛出 IllegalArgumentException"

This reverts commit 0dfee8ab22.
This commit is contained in:
yukaidi
2026-05-29 00:37:18 +08:00
parent 0699c4a127
commit efb135ee48

View File

@@ -24,17 +24,14 @@ public class URLUtil {
if (query != null) { if (query != null) {
String[] pairs = query.split("&"); String[] pairs = query.split("&");
for (String pair : pairs) { for (String pair : pairs) {
if (pair == null || pair.isEmpty()) { String[] keyValue = pair.split("=");
continue;
}
String[] keyValue = pair.split("=", 2);
String key = URLDecoder.decode(keyValue[0], StandardCharsets.UTF_8); String key = URLDecoder.decode(keyValue[0], StandardCharsets.UTF_8);
String value = keyValue.length > 1 ? URLDecoder.decode(keyValue[1], StandardCharsets.UTF_8) : ""; String value = keyValue.length > 1 ? URLDecoder.decode(keyValue[1], StandardCharsets.UTF_8) : "";
queryParams.put(key, value); queryParams.put(key, value);
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new IllegalArgumentException("URL解析失败: " + url, e); e.printStackTrace();
} }
} }