diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-11 15:59:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-11 18:20:27 +0200 |
commit | 85acb1724e617c5f6f4877cf51f11d97691bbb39 (patch) | |
tree | 577b2d23aae24287693f3dcce24a80bbd2189919 /scripting | |
parent | 941c0614ff1821cb5254ed674afdb6283a6a4e60 (diff) |
cid#1608302 XML external entity processing enabled
reformat to get it seen by scanner
Change-Id: I44ce2c6ecd24e81e3b146b7f8b42b51f7d426e90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171731
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java index dec4fc440415..7e67c3b384e5 100644 --- a/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java +++ b/scripting/java/com/sun/star/script/framework/container/XMLParserFactory.java @@ -64,18 +64,22 @@ public class XMLParserFactory { public DefaultParser() { factory = DocumentBuilderFactory.newInstance(); - String[] featuresToDisable = { - "http://xml.org/sax/features/external-general-entities", - "http://xml.org/sax/features/external-parameter-entities", - "http://apache.org/xml/features/nonvalidating/load-external-dtd" - }; - - for (String feature : featuresToDisable) { - try { - factory.setFeature(feature, false); - } catch (ParserConfigurationException e) { - LogUtils.DEBUG(LogUtils.getTrace(e)); - } + try { + factory.setFeature("http://xml.org/sax/features/external-general-entities", false); + } catch (ParserConfigurationException e) { + LogUtils.DEBUG(LogUtils.getTrace(e)); + } + + try { + factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + } catch (ParserConfigurationException e) { + LogUtils.DEBUG(LogUtils.getTrace(e)); + } + + try { + factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + } catch (ParserConfigurationException e) { + LogUtils.DEBUG(LogUtils.getTrace(e)); } try { |