Commit 05faded9 authored by Andrey Filippov's avatar Andrey Filippov

Bug fix: was wrong sequence of initialization of the control interfaces

parent 5c95f009
......@@ -385,6 +385,14 @@ public class XMLConfig extends Config {
private void initControlInterfaces() throws ConfigException {
for(Iterator ci = controlInterfaceList.iterator(); ci.hasNext();)
((ControlInterface)ci.next()).init();
//Andrey: had to split in two separate passes, otherwise failed to initialize types
//when parent control interface was not yet set up (only name was known)
//Alternatively it was possible to check baseInterfaceName if baseInterface was null,
//Replace null name with BasicInterface, ...
for(Iterator ci = controlInterfaceList.iterator(); ci.hasNext();)
((ControlInterface)ci.next()).initTypes();
}
private void checkConfig() throws ConfigException {
......
......@@ -77,13 +77,44 @@ public class ControlInterface implements Inheritable {
// we don't check base interface absence, because in
// such a case a cyclic inheritance error would happen
}
/*
for(Iterator ti = typedefList.iterator(); ti.hasNext();)
((TypeDef)ti.next()).init(this);
*/
initialized = true;
}
public void initTypes() throws ConfigException {
/* if(initialized)
throw new ConfigException("Control interface cannot be re-initialized");
if(!name.equals(BASIC_INTERFACE_NAME)) {
if(baseInterfaceName == null)
baseInterfaceName = BASIC_INTERFACE_NAME;
baseInterface = config.findControlInterface(baseInterfaceName);
if(baseInterface == null) {
if(!baseInterfaceName.equals(BASIC_INTERFACE_NAME))
throw new ConfigException("Base interface '" + baseInterfaceName +
"' of control interface '" + name +
"' is absent");
else
throw new ConfigException("The basic interface '" + BASIC_INTERFACE_NAME +
"' is absent");
}
} else {
// we don't check base interface absence, because in
// such a case a cyclic inheritance error would happen
}
*/
for(Iterator ti = typedefList.iterator(); ti.hasNext();)
((TypeDef)ti.next()).init(this);
// initialized = true;
}
public void check() throws ConfigException {
Checks.checkCyclicInheritance(this, "control interface");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment