* Check if changeSet is null in commitCompilation() to avoid NullPointerException.

Fixed bug http://helma.org/bugs/show_bug.cgi?id=466
This commit is contained in:
hns 2007-09-26 12:46:21 +00:00
parent e9e11ddb9a
commit f03f405f04

View file

@ -889,40 +889,43 @@ public final class RhinoCore implements ScopeProvider {
recorder.stopRecording(); recorder.stopRecording();
Set changedProperties = recorder.getChangeSet(); Set changedProperties = recorder.getChangeSet();
recorder.clearChangeSet();
// ignore all properties that were defined before we started if (changedProperties != null) {
// compilation. We won't manage these properties, even recorder.clearChangeSet();
// if they were set during compilation.
changedProperties.removeAll(predefinedProperties);
// remove all renewed properties from the previously compiled // ignore all properties that were defined before we started
// property names so we can remove those properties that were not // compilation. We won't manage these properties, even
// renewed in this compilation // if they were set during compilation.
compiledProperties.removeAll(changedProperties); changedProperties.removeAll(predefinedProperties);
boolean isGlobal = "global".equals(frameworkProto.getLowerCaseName()); // remove all renewed properties from the previously compiled
// property names so we can remove those properties that were not
// renewed in this compilation
compiledProperties.removeAll(changedProperties);
Iterator it = compiledProperties.iterator(); boolean isGlobal = "global".equals(frameworkProto.getLowerCaseName());
while (it.hasNext()) {
String key = (String) it.next(); Iterator it = compiledProperties.iterator();
if (isGlobal && (prototypes.containsKey(key.toLowerCase()) while (it.hasNext()) {
|| "JavaPackage".equals(key))) { String key = (String) it.next();
// avoid removing HopObject constructor if (isGlobal && (prototypes.containsKey(key.toLowerCase())
predefinedProperties.add(key); || "JavaPackage".equals(key))) {
continue; // avoid removing HopObject constructor
} predefinedProperties.add(key);
try { continue;
objProto.setAttributes(key, 0); }
objProto.delete(key); try {
} catch (Exception px) { objProto.setAttributes(key, 0);
app.logEvent("Error unsetting property "+key+" on "+ objProto.delete(key);
frameworkProto.getName()); } catch (Exception px) {
app.logEvent("Error unsetting property "+key+" on "+
frameworkProto.getName());
}
} }
// update compiled properties
compiledProperties = changedProperties;
} }
// update compiled properties
compiledProperties = changedProperties;
} }
// mark this type as updated again so it reflects // mark this type as updated again so it reflects