Fixed bug where DbMapping was not created for zipped prototype

if it didn't contain a type.properties file.
This commit is contained in:
hns 2001-06-28 14:44:47 +00:00
parent 3cee7707ad
commit 0f42a7b624

View file

@ -47,6 +47,9 @@ public class ZippedAppFile implements Updatable {
} else {
ZipFile zip = null;
// collect created protos - we need this to check DbMappings for each created
// prototype afterwards
HashSet newPrototypes = new HashSet ();
try {
lastmod = file.lastModified ();
// System.err.println ("UPDATING ZIP FILE "+this);
@ -60,8 +63,10 @@ public class ZippedAppFile implements Updatable {
String fname = st.nextToken ();
// System.err.println ("ZIPENTRY: "+ dir +" ~ "+fname);
Prototype proto = app.typemgr.getPrototype (dir);
if (proto == null)
if (proto == null) {
proto = app.typemgr.createPrototype (dir);
newPrototypes.add (proto);
}
if (fname.endsWith (".hac")) {
String name = fname.substring (0, fname.lastIndexOf ("."));
String content = getZipEntryContent (zip, entry);
@ -100,6 +105,15 @@ public class ZippedAppFile implements Updatable {
}
}
}
for (Iterator it = newPrototypes.iterator (); it.hasNext (); ) {
Prototype proto = (Prototype) it.next ();
if (app.getDbMapping (proto.getName ()) == null) {
// DbMapping doesn't exist, we still need to create one
SystemProperties props = new SystemProperties ();
// DbMapping does its own registering, just construct it.
new DbMapping (app, proto.getName (), props);
}
}
} catch (Throwable x) {
System.err.println ("Error updating ZipFile: "+x);
} finally {