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

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

parent 5c95f009
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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 {
+33 −2
Original line number Diff line number Diff line
@@ -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");