Permalink
Browse files

Fix issue #71, don't go trying to read the last modified time for doc…

…uments on the source port.
  • Loading branch information...
ndw committed Feb 7, 2013
1 parent a70e3ab commit 85aefdaeb102c70adae636905c08a14c28d78e1f
Showing with 13 additions and 2 deletions.
  1. +13 −2 src/com/xmlcalabash/extensions/Zip.java
@@ -11,6 +11,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URISyntaxException;
import java.util.Date;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Hashtable;
@@ -130,14 +131,14 @@ public void run() throws SaxonApiException {
throw new XProcException(step.getNode(), "The cx:zip manifest must be a c:zip-manifest.");
}
parseManifest(man);
while (source.moreDocuments()) {
XdmNode doc = source.read();
XdmNode root = S9apiUtils.getDocumentElement(doc);
srcManifest.put(root.getBaseURI().toASCIIString(), doc);
}
parseManifest(man);
File zipFile = null;
try {
zipFile = new File(new URI(zipFn));
@@ -438,6 +439,7 @@ public void delete(ZipFile inZip, ZipOutputStream outZip) {
private class FileToZip {
private String zipName = null;
private URI href = null;
private String origHref = null;
private int method = -1;
private int level = -1;
private String comment = null;
@@ -446,6 +448,7 @@ public void delete(ZipFile inZip, ZipOutputStream outZip) {
public FileToZip(String zipName, String href, int method, int level, String comment, XdmNode entry) {
try {
origHref = href;
this.zipName = zipName;
this.href = new URI(href);
this.method = method;
@@ -498,6 +501,14 @@ public long getLastModified() {
}
private long readLastModified(URI uri) {
if (srcManifest.containsKey(origHref)) {
// If the document to be zipped is in the set of source documents,
// don't try to read its timestamp from the disk or the web.
// Use "now".
Date date = new Date();
return date.getTime();
}
if (uri.getScheme().equals("file")) {
String fn = uri.toASCIIString();
if (fn.startsWith("file:")) {

0 comments on commit 85aefda

Please sign in to comment.