Author: rgodfrey
Date: Wed Oct 24 10:24:45 2012
New Revision: 1401609
URL: http://svn.apache.org/viewvc?rev=1401609&view=rev
Log:
PROTON-85 : Fix python shim for Java for UUID in message-id/correlation-id
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java
qpid/proton/trunk/proton-j/src/main/scripts/proton.py
Modified:
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java?rev=1401609&r1=1401608&r2=1401609&view=diff
==============================================================================
---
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java
(original)
+++
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/codec/ListType.java
Wed Oct 24 10:24:45 2012
@@ -75,7 +75,12 @@ public class ListType extends AbstractPr
for(int i = 0; i < count; i++)
{
Object element = val.get(i);
- TypeEncoding elementEncoding =
encoder.getType(element).getEncoding(element);
+ AMQPType type = encoder.getType(element);
+ if(type == null)
+ {
+ throw new IllegalArgumentException("No encoding defined for
type: " + element.getClass());
+ }
+ TypeEncoding elementEncoding = type.getEncoding(element);
len +=
elementEncoding.getConstructorSize()+elementEncoding.getValueSize(element);
}
return len;
Modified: qpid/proton/trunk/proton-j/src/main/scripts/proton.py
URL:
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/scripts/proton.py?rev=1401609&r1=1401608&r2=1401609&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/scripts/proton.py (original)
+++ qpid/proton/trunk/proton-j/src/main/scripts/proton.py Wed Oct 24 10:24:45
2012
@@ -17,6 +17,7 @@
# under the License.
#
+from uuid import UUID
from org.apache.qpid.proton.engine import EndpointState, TransportException
from org.apache.qpid.proton.engine.impl import ConnectionImpl, SessionImpl, \
SenderImpl, ReceiverImpl, TransportImpl
@@ -25,7 +26,7 @@ from org.apache.qpid.proton.message impo
from org.apache.qpid.proton.type.messaging import Source, Target, Accepted
from org.apache.qpid.proton.type import UnsignedInteger
from jarray import zeros
-from java.util import EnumSet
+from java.util import EnumSet, UUID as JUUID
class Skipped(Exception):
skipped = True
@@ -464,14 +465,24 @@ class Message(object):
self.impl.decode(data,0,len(data))
def _get_id(self):
- return self.impl.getMessageId()
+ id = self.impl.getMessageId()
+ if isinstance(id, JUUID):
+ id = UUID( id.toString() )
+ return id
def _set_id(self, value):
+ if isinstance(value, UUID):
+ value = JUUID.fromString( str(value) )
return self.impl.setMessageId(value)
id = property(_get_id, _set_id)
def _get_correlation_id(self):
- return self.impl.getCorrelationId()
+ id = self.impl.getCorrelationId()
+ if isinstance(id, JUUID):
+ id = UUID( id.toString() )
+ return id
def _set_correlation_id(self, value):
+ if isinstance(value, UUID):
+ value = JUUID.fromString( str(value) )
return self.impl.setCorrelationId(value)
correlation_id = property(_get_correlation_id, _set_correlation_id)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]