Bug 704227

Summary: qmf-gen crashes if a schema does not contain statistics
Product: [Fedora] Fedora Reporter: Andrew Beekhof <andrew>
Component: qpid-cppAssignee: Nuno Santos <nsantos>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 14CC: aortega, jose.p.oliveira.oss, matahari-maint, nsantos
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-qmf-devel-0.10-2.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-17 18:34:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 704353    
Attachments:
Description Flags
Patch none

Description Andrew Beekhof 2011-05-12 13:45:12 UTC
Description of problem:

qmf-gen crashes if a schema does not contain statistics 

Version-Release number of selected component (if applicable):

qpid-qmf-0.8-6

How reproducible:

Every time

Steps to Reproduce:
1. Save the following to schema.xml

<schema package="org.matahariproject">
  <class name="Network">
   <property name="hostname"         type="sstr"  access="RO" desc="Hostname" index="y" />
   <method name="list"          desc="List IP addresses">
     <arg name="iface_map"      dir="O"  type="list" />
   </method>
 </class>
</schema>

2. Run /usr/bin/qmf-gen -2 -o ./qmf schema.x
  
Actual results:

# /usr/bin/qmf-gen -2 -o ./qmf schema.xml
Traceback (most recent call last):
  File "/usr/bin/qmf-gen", line 80, in <module>
    gen.makeV2PackageFile("V2Package.cpp", package, vars=vargs)
  File "/usr/lib/python2.6/site-packages/qmfgen/generate.py", line 467, in makeV2PackageFile
    stream = template.expand (schema)
  File "/usr/lib/python2.6/site-packages/qmfgen/generate.py", line 100, in expand
    self.expandLine (line, stream, object)
  File "/usr/lib/python2.6/site-packages/qmfgen/generate.py", line 88, in expandLine
    self.handler.substHandler (object, stream, tagObject, tagName)
  File "/usr/lib/python2.6/site-packages/qmfgen/generate.py", line 392, in substHandler
    eval (call)
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/qmfgen/schema.py", line 1734, in genV2ClassDefines
    if stat.unit:
UnboundLocalError: local variable 'stat' referenced before assignment


Expected results:

Generated: qmf/org/matahariproject/QmfPackage.cpp

Additional info:

Comment 1 Nuno Santos 2011-05-12 14:37:33 UTC
Created attachment 498557 [details]
Patch

Comment 2 Nuno Santos 2011-05-17 18:34:27 UTC

*** This bug has been marked as a duplicate of bug 692795 ***