Permalink
Browse files

Manually apply #178, report NPEs more explicitly

  • Loading branch information...
ndw committed Mar 4, 2018
1 parent b72e2f3 commit f19da5ce89d4658052676777b66ecc3b8e483b7d
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/main/java/com/xmlcalabash/extensions/Zip.java
@@ -143,6 +143,9 @@ public void run() throws SaxonApiException {
final String zipFn = getOption(_href).getString();
XdmNode man = S9apiUtils.getDocumentElement(manifest.read());
if (man == null) {
throw new NullPointerException("XML document " + man.getDocumentURI() + " has no root element.");
}
if (!c_zip_manifest.equals(man.getNodeName())) {
throw new XProcException(step.getNode(), "The cx:zip manifest must be a c:zip-manifest.");
@@ -151,6 +154,9 @@ public void run() throws SaxonApiException {
while (source.moreDocuments()) {
XdmNode doc = source.read();
XdmNode root = S9apiUtils.getDocumentElement(doc);
if (root == null) {
throw new NullPointerException("XML document " + doc.getDocumentURI() + " has no root element.");
}
srcManifest.put(root.getBaseURI().toASCIIString(), doc);
}

0 comments on commit f19da5c

Please sign in to comment.