From 6df937ec6bde5aad5dbcd9cbc558cc623b24a406 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 24 Jun 2017 07:30:07 +0000 Subject: Add StaxHelper to ensure that StAX parsers have sensible defaults, including settings to avoid XML Entity Expansion issues git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799734 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/sl/draw/DrawSimpleShape.java | 3 ++- src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/java/org/apache/poi/sl/draw') diff --git a/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java b/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java index d2e9991e1e..912cf3e7a0 100644 --- a/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java +++ b/src/java/org/apache/poi/sl/draw/DrawSimpleShape.java @@ -53,6 +53,7 @@ import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint; import org.apache.poi.sl.usermodel.Shadow; import org.apache.poi.sl.usermodel.SimpleShape; import org.apache.poi.util.IOUtils; +import org.apache.poi.util.StaxHelper; import org.apache.poi.util.Units; @@ -363,7 +364,7 @@ public class DrawSimpleShape extends DrawShape { }; try { - XMLInputFactory staxFactory = XMLInputFactory.newInstance(); + XMLInputFactory staxFactory = StaxHelper.newXMLInputFactory(); XMLEventReader staxReader = staxFactory.createXMLEventReader(presetIS); XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter); // Ignore StartElement: diff --git a/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java b/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java index ad2553fbe7..a188e6e255 100644 --- a/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java +++ b/src/java/org/apache/poi/sl/draw/geom/PresetGeometries.java @@ -37,6 +37,7 @@ import javax.xml.stream.events.XMLEvent; import org.apache.poi.sl.draw.binding.CTCustomGeometry2D; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; +import org.apache.poi.util.StaxHelper; /** * @@ -59,7 +60,7 @@ public class PresetGeometries extends LinkedHashMap { } }; - XMLInputFactory staxFactory = XMLInputFactory.newFactory(); + XMLInputFactory staxFactory = StaxHelper.newXMLInputFactory(); XMLEventReader staxReader = staxFactory.createXMLEventReader(is); XMLEventReader staxFiltRd = staxFactory.createFilteredReader(staxReader, startElementFilter); // ignore StartElement: -- cgit v1.2.3