* 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();
Set changedProperties = recorder.getChangeSet();
recorder.clearChangeSet();
// ignore all properties that were defined before we started
// compilation. We won't manage these properties, even
// if they were set during compilation.
changedProperties.removeAll(predefinedProperties);
if (changedProperties != null) {
recorder.clearChangeSet();
// 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);
// ignore all properties that were defined before we started
// compilation. We won't manage these properties, even
// if they were set during compilation.
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();
while (it.hasNext()) {
String key = (String) it.next();
if (isGlobal && (prototypes.containsKey(key.toLowerCase())
|| "JavaPackage".equals(key))) {
// avoid removing HopObject constructor
predefinedProperties.add(key);
continue;
}
try {
objProto.setAttributes(key, 0);
objProto.delete(key);
} catch (Exception px) {
app.logEvent("Error unsetting property "+key+" on "+
frameworkProto.getName());
boolean isGlobal = "global".equals(frameworkProto.getLowerCaseName());
Iterator it = compiledProperties.iterator();
while (it.hasNext()) {
String key = (String) it.next();
if (isGlobal && (prototypes.containsKey(key.toLowerCase())
|| "JavaPackage".equals(key))) {
// avoid removing HopObject constructor
predefinedProperties.add(key);
continue;
}
try {
objProto.setAttributes(key, 0);
objProto.delete(key);
} 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