From fa53c338acf922c2c7ef4d5ee7b23097a0fad6cc Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 13 Sep 2002 13:24:28 +0000 Subject: [PATCH] Fixed bug where type.properties of newly created prototypes were potentially not updated correctly because another freshly created DbMapping was still missing. --- src/helma/framework/core/TypeManager.java | 24 ++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/helma/framework/core/TypeManager.java b/src/helma/framework/core/TypeManager.java index d7021ef5..9db81755 100644 --- a/src/helma/framework/core/TypeManager.java +++ b/src/helma/framework/core/TypeManager.java @@ -124,17 +124,23 @@ public final class TypeManager { zipfiles.put (filename, zipped); } } - } else { - // update prototype's type mapping - DbMapping dbmap = proto.getDbMapping (); - if (dbmap != null && dbmap.needsUpdate ()) { - dbmap.update (); + } + } + + // loop through prototypes and check if type.properties needs updates + // it's important that we do this _after_ potentially new prototypes + // have been created in the previous loop. + for (Iterator i=prototypes.values().iterator(); i.hasNext(); ) { + Prototype proto = (Prototype) i.next (); + // update prototype's type mapping + DbMapping dbmap = proto.getDbMapping (); + if (dbmap != null && dbmap.needsUpdate ()) { + dbmap.update (); // set parent prototype, in case it has changed. String parentName = dbmap.getExtends (); if (parentName == null) parentName = "hopobject"; proto.setParentPrototype (getPrototype (parentName)); - } } } @@ -150,9 +156,9 @@ public final class TypeManager { private boolean isValidTypeName (String str) { - if (str == null) - return false; - char[] c = str.toCharArray (); + if (str == null) + return false; + char[] c = str.toCharArray (); for (int i=0; i