Skip to content

Sandbox loadSADFile does not handle component with simple property with no explicit <kind> tag specified #18

@pacman128

Description

@pacman128

The DTD file for a PRF file specifies that the <simple> tag has an optional <kind> child:

<!ELEMENT simple 
        ( description?
        , value?
        , units?
        , range?
        , enumerations?
        , kind*
        , action?
        )>

<!ELEMENT kind EMPTY>
<!ATTLIST kind
        kindtype        (allocation | property | configure | test | execparam | factoryparam | event | message) 
"configure">

However, the loadSADFile function assumes that the <kind> tag is always present

                _prf = parsers.prf.parse(prfFilename)
                execprops = []
                configurable[instanceName] = []
                for prop_check in _prf.get_simple():
                    if prop_check.get_kind()[0].get_kindtype() == 'execparam':                                                                                                                                               
                        execprops.append(str(prop_check.get_id()))
                    if prop_check.get_kind()[0].get_kindtype() == 'configure':
                        if prop_check.get_mode() == 'readwrite' or prop_check.get_mode() == 'writeonly':
                            configurable[instanceName].append(str(prop_check.get_id()))
                    if prop_check.get_kind()[0].get_kindtype() == 'property':
                        if prop_check.get_mode() == 'readwrite' or prop_check.get_mode() == 'writeonly':
                            configurable[instanceName].append(str(prop_check.get_id()))

Calling loadSADFile with a waveform with a component that has a simple property without a <kind> tag will result in an error message:

DEBUG:ossie.utils.sb.domainless:COMPONENT PLACEMENT component spd file id 'PSD_a9532f88-cd71-4e79-938e-fb84c67b0722'
DEBUG:ossie.utils.sb.domainless:COMPONENT PLACEMENT component instantiation id 'PSD_1'
DEBUG:ossie.utils.sb.domainless:COMPONENT PLACEMENT component startorder '1'
DEBUG:ossie.utils.sb.domainless:COMPONENT PLACEMENT component name 'PSD_1'
DEBUG:ossie.utils.sb.domainless:launching component 'PSD_1'
DEBUG:ossie.utils.sandbox.launcher:Killing process group 74527 with signal 2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/redhawk/core/lib/python/ossie/utils/sb/domainless.py", line 1097, in loadSADFile
    raise RuntimeError(msg)
RuntimeError:  ERROR - Failed to load sad file: /var/redhawk/sdr/dom/waveforms/MockDetectorWaveform/MockDetectorWaveform.sad.xml REASON: list index out of range

The list index out of range exception is coming from the line:

 if prop_check.get_kind()[0].get_kindtype() == 'execparam': 

I believe the code should check for a missing tag and use the default configure value in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions