Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Manually apply #178, report NPEs more explicitly
- Loading branch information
Showing
with
6 additions
and
0 deletions.
-
+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); |
|
|
} |
|
|
|
|
|