[ 
https://issues.apache.org/jira/browse/PROTON-261?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Keith Wall updated PROTON-261:
------------------------------

    Description: 
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_RECEIVED=1,
  PN_ACCEPTED=2,
  PN_REJECTED=3,
  PN_RELEASED=4,
  PN_MODIFIED=5
} 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 - so called "Proper enums" - see 
http://www.swig.org/Doc2.0/Java.html#Java_proper_enums_classes) 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)


  was:
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_RECEIVED=1,
  PN_ACCEPTED=2,
  PN_REJECTED=3,
  PN_RELEASED=4,
  PN_MODIFIED=5
} 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)


    
> 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_RECEIVED=1,
>   PN_ACCEPTED=2,
>   PN_REJECTED=3,
>   PN_RELEASED=4,
>   PN_MODIFIED=5
> } 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 - so called "Proper enums" - see 
> http://www.swig.org/Doc2.0/Java.html#Java_proper_enums_classes) 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