Hi Angus,

Good catch - definitely a bug.  And your fix looks good.

Would you be so kind as to open a new bug against qpid, and include your patch 
below?

See 
https://issues.apache.org/jira/browse/qpid  - the "bug" link at the top right 
of the page.

Could you "attach" your patch to the bug, can you check the box to "Grant 
license to ASF for inclusion in ASF works" so I can submit it upstream?

thanks,

-K

----- Original Message -----
> Hi
> 
> I have:
> 
> cat schema-1.xml
> <schema package="org.foobar">
> <class name="apple">
> <method name="rott" desc="rott">
> <arg name="speed" dir="I" type="uint32"/>
> <arg name="review" dir="O" type="sstr"/>
> </method>
> </class>
> </schema>
> 
> Then I run "qmf-gen -2 schema-1.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.7/site-packages/qmfgen/generate.py", line 467,
> in makeV2PackageFile
> stream = template.expand (schema)
> File "/usr/lib/python2.7/site-packages/qmfgen/generate.py", line 100,
> in expand
> self.expandLine (line, stream, object)
> File "/usr/lib/python2.7/site-packages/qmfgen/generate.py", line 88,
> in
> expandLine
> self.handler.substHandler (object, stream, tagObject, tagName)
> File "/usr/lib/python2.7/site-packages/qmfgen/generate.py", line 392,
> in
> substHandler
> eval (call)
> File "<string>", line 1, in <module>
> File "/usr/lib/python2.7/site-packages/qmfgen/schema.py", line
> 1734, in genV2ClassDefines
> if stat.unit:
> UnboundLocalError: local variable 'stat' referenced before assignment
> 
> Looking at git this hasn't changed in a while, am I doing something
> wrong?
> 
> If not this looks like what we need:
> 
> diff --git a/qpid/cpp/managementgen/qmfgen/schema.py
> b/qpid/cpp/managementgen/qmfgen/schema.py
> index afdfe42..59e951f 100755
> --- a/qpid/cpp/managementgen/qmfgen/schema.py
> +++ b/qpid/cpp/managementgen/qmfgen/schema.py
> @@ -1731,9 +1731,9 @@ class SchemaPackage:
> stream.write(" qmf::SchemaProperty arg(\"%s\", %s);\n" % (arg.name,
> typeName))
> if subType:
> stream.write(" arg.setSubtype(\"%s\");\n" % subType)
> - if stat.unit:
> + if arg.unit:
> stream.write(" arg.setUnit(\"%s\");\n" % arg.unit)
> - if stat.desc:
> + if arg.desc:
> stream.write(" arg.setDesc(\"%s\");\n" % arg.desc)
> stream.write(" arg.setDirection(%s);\n" % self.qmfv2Dir(arg.dir))
> stream.write(" method.addArgument(arg);\n")
> 
> Regards
> Angus Salkeld
> 
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:[email protected]

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to