Commit 0507e1ff authored by Mark's avatar Mark
Browse files

The JAR-PATHNAME objects in the cache have :NEWEST version

Since by default MERGE-PATHNAMES produces a PATHNAME with version
:NEWEST, we normalize the uses of JAR-PATHNAME as a key in the zip
cache to have version :NEWEST in all cases.
parent 7681280e
......@@ -111,7 +111,8 @@ public class JarPathname
.copyFrom(p)
.setDirectory(NIL)
.setName(NIL)
.setType(NIL);
.setType(NIL)
.setVersion(Keyword.NEWEST);
Pathname entryPath = p.getEntryPath();
LispObject device = result.getDevice();
device = device.reverse().push(entryPath).reverse();
......@@ -151,11 +152,17 @@ public class JarPathname
};
static public JarPathname createFromFile(String s) {
return JarPathname.create(JAR_URI_PREFIX + "file:" + s + JAR_URI_SUFFIX);
JarPathname result
= JarPathname.create(JAR_URI_PREFIX + "file:" + s + JAR_URI_SUFFIX);
result.setVersion(Keyword.NEWEST);
return result;
}
static public JarPathname createEntryFromFile(String jar, String entry) {
return JarPathname.create(JAR_URI_PREFIX + "file:" + jar + JAR_URI_SUFFIX + entry);
JarPathname result
= JarPathname.create(JAR_URI_PREFIX + "file:" + jar + JAR_URI_SUFFIX + entry);
result.setVersion(Keyword.NEWEST);
return result;
}
static public JarPathname createEntryFromJar(JarPathname jar, String entry) {
......@@ -173,7 +180,8 @@ public class JarPathname
result
.setDirectory(p.getDirectory())
.setName(p.getName())
.setType(p.getType());
.setType(p.getType())
.setVersion(Keyword.NEWEST);
return result;
}
......
......@@ -224,6 +224,7 @@ public class ZipCache {
populateAllEntries();
}
entry.setVersion(Keyword.NEWEST);
ByteArrayOutputStream bytes = contents.get(entry);
if (bytes != null) {
return new ByteArrayInputStream(bytes.toByteArray());
......@@ -235,6 +236,7 @@ public class ZipCache {
if (!populated) {
populateAllEntries();
}
entry.setVersion(Keyword.NEWEST);
ZipEntry result = entries.get(entry);
return result;
}
......@@ -330,6 +332,7 @@ public class ZipCache {
}
public ZipEntry getEntry(JarPathname entryPathname) {
entryPathname.setVersion(Keyword.NEWEST);
ZipEntry result = entries.get(entryPathname);
if (result != null) {
return result;
......@@ -371,6 +374,7 @@ public class ZipCache {
InputStream getEntryAsInputStream(JarPathname entry) {
InputStream result = null;
entry.setVersion(Keyword.NEWEST);
ZipEntry zipEntry = getEntry(entry);
try {
......@@ -427,6 +431,7 @@ public class ZipCache {
// ??? we assume that DIRECTORY, NAME, and TYPE components are NIL
synchronized public static Archive getArchive(JarPathname jar) {
jar.setVersion(Keyword.NEWEST);
Archive result = cache.get(jar);
if (result != null) {
long time = result.getLastModified();
......@@ -456,7 +461,8 @@ public class ZipCache {
new Cons(innerJars.car(), NIL)))
.setDirectory(NIL)
.setName(NIL)
.setType(NIL);
.setType(NIL)
.setVersion(Keyword.NEWEST);
innerJars = innerJars.cdr();
while (innerJars.car() != NIL) {
......@@ -467,7 +473,8 @@ public class ZipCache {
.setDevice(nextArchive.getDevice())
.setDirectory(nextJarArchive.getDirectory())
.setName(nextJarArchive.getName())
.setType(nextJarArchive.getType());
.setType(nextJarArchive.getType())
.setVersion(Keyword.NEWEST);
// FIXME
// The pathnames for subsquent entries in a PATHNAME-JAR
// are relative. Should they be?
......@@ -531,6 +538,7 @@ public class ZipCache {
public static Archive getArchiveURL(JarPathname jar) {
Pathname rootJar = (Pathname) jar.getRootJar();
jar.setVersion(Keyword.NEWEST);
URL rootJarURL = null;
try {
......@@ -547,6 +555,7 @@ public class ZipCache {
}
static public Archive getArchiveFile(JarPathname jar) {
jar.setVersion(Keyword.NEWEST);
try {
ArchiveFile result = new ArchiveFile(jar);
cache.put(jar, result);
......@@ -656,6 +665,7 @@ public class ZipCache {
}
synchronized public static boolean remove(JarPathname p) {
p.setVersion(Keyword.NEWEST);
Archive archive = cache.get(p);
if (archive != null) {
archive.close();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment