From 0f42a7b624201a1a35622c242154ef1419b4ac95 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 28 Jun 2001 14:44:47 +0000 Subject: [PATCH] Fixed bug where DbMapping was not created for zipped prototype if it didn't contain a type.properties file. --- src/helma/framework/core/ZippedAppFile.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/helma/framework/core/ZippedAppFile.java b/src/helma/framework/core/ZippedAppFile.java index 9bd9d439..2a78d43a 100644 --- a/src/helma/framework/core/ZippedAppFile.java +++ b/src/helma/framework/core/ZippedAppFile.java @@ -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 {