提交 b08a327b 编写于 作者: O o2null

Merge branch 'cherry-pick-b1ac5de4' into 'release'

增加encode方法,统一java11,java8

See merge request o2oa/o2oa!5383
package com.x.base.core.project.tools;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.RegExUtils;
import org.apache.commons.lang3.StringUtils;
public class URLTools {
......@@ -15,4 +21,17 @@ public class URLTools {
}
}
}
/*
* Java8 URLEncoder.encode throw Exception,Java11 URLEncoder.encode 不抛出错误
* 统一这两个方法.
*/
public static String encode(String str) {
try {
return URLEncoder.encode(str, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册