mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-03 04:13:49 +08:00
fix code
This commit is contained in:
parent
912c3e116d
commit
5bd54dcd39
@ -55,7 +55,6 @@ public class JarClassLoader extends URLClassLoader {
|
||||
try {
|
||||
final Method method = MethodUtil.getMethod(URLClassLoader.class, "addURL", URL.class);
|
||||
if (null != method) {
|
||||
method.setAccessible(true);
|
||||
final List<File> jars = loopJar(jarFile);
|
||||
for (final File jar : jars) {
|
||||
MethodUtil.invoke(loader, method, jar.toURI().toURL());
|
||||
|
@ -308,6 +308,9 @@ public class XmlUtil {
|
||||
|
||||
// 3.得到解读器
|
||||
reader = parse.getXMLReader();
|
||||
// 防止XEE攻击,见:https://www.jianshu.com/p/1a857905b22c
|
||||
reader.setFeature("http://xml.org/sax/features/external-general-entities",false);
|
||||
reader.setFeature("http://xml.org/sax/features/external-parameter-entities",false);
|
||||
reader.setContentHandler(contentHandler);
|
||||
reader.parse(source);
|
||||
} catch (final ParserConfigurationException | SAXException e) {
|
||||
@ -616,6 +619,8 @@ public class XmlUtil {
|
||||
public static void transform(final Source source, final Result result, final String charset, final int indent, final boolean omitXmlDeclaration) {
|
||||
final TransformerFactory factory = TransformerFactory.newInstance();
|
||||
try {
|
||||
// 防止XXE攻击,见:https://www.jianshu.com/p/1a857905b22c
|
||||
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
final Transformer xformer = factory.newTransformer();
|
||||
if (indent > 0) {
|
||||
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
|
@ -213,8 +213,9 @@ class LZWEncoder {
|
||||
if (free_ent < maxmaxcode) {
|
||||
codetab[i] = free_ent++; // code -> hashtable
|
||||
htab[i] = fcode;
|
||||
} else
|
||||
} else {
|
||||
cl_block(outs);
|
||||
}
|
||||
}
|
||||
// Put out the final code.
|
||||
output(ent, outs);
|
||||
|
Loading…
Reference in New Issue
Block a user