diff --git a/src/main/java/com/github/pjfanning/xlsx/XmlUtils.java b/src/main/java/com/github/pjfanning/xlsx/XmlUtils.java index 99e52fa9..57d00b3d 100644 --- a/src/main/java/com/github/pjfanning/xlsx/XmlUtils.java +++ b/src/main/java/com/github/pjfanning/xlsx/XmlUtils.java @@ -29,7 +29,7 @@ public static Document readDocument(InputStream inp) throws IOException, SAXExce return DocumentHelper.readDocument(inp); } - public static NodeList searchForNodeList(Document document, String xpath) { + public static NodeList searchForNodeList(Document document, String xpath) throws ParseException { try { XPath xp = XPathFactory.newInstance().newXPath(); xp.setNamespaceContext(transitionalFormatNamespaceContext); diff --git a/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoXmlStrictConverterUtils.java b/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoXmlStrictConverterUtils.java index 93decfc3..e995e89e 100644 --- a/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoXmlStrictConverterUtils.java +++ b/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoXmlStrictConverterUtils.java @@ -1,5 +1,6 @@ package com.github.pjfanning.xlsx.impl.ooxml; +import com.github.pjfanning.xlsx.exceptions.ReadException; import org.apache.poi.util.Beta; import java.io.*; @@ -34,7 +35,7 @@ public static Properties readMappings() { } } catch (IOException e) { - throw new RuntimeException(e); + throw new ReadException("Failed to read mappings", e); } return props; } diff --git a/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoxmlReader.java b/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoxmlReader.java index f436b884..e738e184 100644 --- a/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoxmlReader.java +++ b/src/main/java/com/github/pjfanning/xlsx/impl/ooxml/OoxmlReader.java @@ -71,7 +71,8 @@ public class OoxmlReader extends XSSFReader { */ @Internal public OoxmlReader(StreamingReader.Builder builder, - OPCPackage pkg, boolean strictOoxmlChecksNeeded) throws IOException, OpenXML4JException { + OPCPackage pkg, boolean strictOoxmlChecksNeeded) + throws IOException, OpenXML4JException, POIXMLException { super(pkg, true); PackageRelationship coreDocRelationship = this.pkg.getRelationshipsByType( @@ -183,9 +184,12 @@ static class OoxmlSheetReader { * Construct a new SheetIterator * * @param wb package part holding workbook.xml + * @throws IOException if reading the data from the package fails + * @throws POIXMLException if the package data is invalid */ OoxmlSheetReader(final StreamingReader.Builder builder, - final PackagePart wb, final boolean strictOoxmlChecksNeeded) throws IOException { + final PackagePart wb, final boolean strictOoxmlChecksNeeded) + throws IOException, POIXMLException { this.builder = builder; this.strictOoxmlChecksNeeded = strictOoxmlChecksNeeded; /* @@ -245,7 +249,7 @@ SheetData getSheetData(final XSSFSheetRef sheetRef) { return sd; } - private ArrayList createSheetListFromWB(PackagePart wb) throws IOException { + private ArrayList createSheetListFromWB(PackagePart wb) throws IOException, OpenException, POIXMLException { XMLSheetRefReader xmlSheetRefReader = new XMLSheetRefReader(); XMLReader xmlReader;