Rafael H. Schloming commented on PROTON-261:

It means null/unset/pending. We could add another value to the enum for 
clarity, although for this kind of thing in C it's fairly typical in my 
experience to use zero directly, or at least expose the fact that the 
unset/pending value of the enum is actually zero so you can do things like if 
(pn_delivery_remote_state(...)) { ... }.
> pn_delivery_local_state and pn_delivery_remote_state can return a zero value 
> (outside that defined by the pn_disposition_t enum)
> --------------------------------------------------------------------------------------------------------------------------------
>                 Key: PROTON-261
>                 URL: https://issues.apache.org/jira/browse/PROTON-261
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: proton-c
>    Affects Versions: 0.5
>            Reporter: Keith Wall
> In proton-c, pn_delivery_local_state and pn_delivery_remote_state are defined 
> as returning an pn_disposition_t:
> PN_EXTERN pn_disposition_t pn_delivery_local_state(pn_delivery_t *delivery);
> PN_EXTERN pn_disposition_t pn_delivery_remote_state(pn_delivery_t *delivery);
> with pn_disposition_t defined as:
> typedef enum pn_disposition_t {
> } pn_disposition_t;
> However, there are circumstances when the proton-c implementation returns a 
> value outside this enumeration - value 0 - coming for the struct 
> initialisation in pn_delivery().  What does this value mean and how is an 
> application supposed to react to this value?   Are there an implicit 
> restrictions regarding when an application may call 
> pn_delivery_local_state/pn_delivery_remote_state?
> btw.  This question arises from work on PROTON-257.  Proton-jni (Swig 
> generated code) is failing to decode the enum when testing the state of a 
> newly created Delivery.
> test(org.apache.qpid.proton.systemtests.ProtonEngineExampleTest)  Time 
> elapsed: 0.109 sec  <<< ERROR!
> java.lang.IllegalArgumentException: No enum class 
> org.apache.qpid.proton.jni.pn_disposition_t with value 0
>         at 
> org.apache.qpid.proton.jni.pn_disposition_t.swigToEnum(pn_disposition_t.java:32)
>         at 
> org.apache.qpid.proton.jni.Proton.pn_delivery_local_state(Proton.java:624)
>         at 
> org.apache.qpid.proton.engine.jni.JNIDelivery.getLocalState(JNIDelivery.java:100)
>         at 
> org.apache.qpid.proton.systemtests.ProtonEngineExampleTest.test(ProtonEngineExampleTest.java:190)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to