diff options
| author | Rajith Muditha Attapattu <rajith@apache.org> | 2012-06-10 23:38:23 +0000 |
|---|---|---|
| committer | Rajith Muditha Attapattu <rajith@apache.org> | 2012-06-10 23:38:23 +0000 |
| commit | 2012533afb67397403142cd165ecded7e5a0f8bb (patch) | |
| tree | f96bc624692b01aff3487baba6ce7ec71c0efc79 /qpid/java/client-api/src | |
| parent | 47584d3e42d04b85a133b834411d405b196ab41d (diff) | |
| download | qpid-python-2012533afb67397403142cd165ecded7e5a0f8bb.tar.gz | |
QPID-4027 when retrieving objects from the map they are now directly
returned with being assigned to a local jobject, as it then looses the
type information when received at the Java layer.
The code now avoids using cached JNIEnv pointers as if it gets called
from a different thread the ref will be now and a seg fault will occur.
The encoding type is set for String properties.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/address-refactor2@1348682 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client-api/src')
3 files changed, 18 insertions, 11 deletions
diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppReceiver.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppReceiver.java index 102820850f..8c95b1468e 100644 --- a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppReceiver.java +++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppReceiver.java @@ -42,7 +42,7 @@ public class CppReceiver implements Receiver public Message fetch(long timeout) { org.apache.qpid.messaging.cpp.jni.Message m = _cppReceiver.fetch(); - return new TextMessage(m.getContent()); + return new TextMessage(m); } @Override diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppTest.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppTest.java index 5214a66caf..9e28f7bcc5 100644 --- a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppTest.java +++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/CppTest.java @@ -51,12 +51,16 @@ public class CppTest System.out.println("Received message " + m + " with content type : " + m.getContentType() + " and content : " + m.getContent()); Map<String,Object> props = m.getProperties(); - if (props != null) + System.out.println("Props size : " + props.size()); + System.out.println("Props empty : " + props.isEmpty()); + System.out.println("Contains key 'color' : " + props.containsKey("color")); + for (String key : props.keySet()) { - //System.out.println("Color : " + m.getProperties().get("color")); - System.out.println("Price : " + props.get("price")); + System.out.println("Key=" + key + ", value=" + props.get(key)); } + System.out.println("Unspecified property : " + props.get("Unspecified-Prop")); + ssn.close(); con.close(); } diff --git a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/TextMessage.java b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/TextMessage.java index 0ee90e3339..1602a486b3 100644 --- a/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/TextMessage.java +++ b/qpid/java/client-api/src/main/java/org/apache/qpid/messaging/cpp/TextMessage.java @@ -23,18 +23,22 @@ public class TextMessage implements org.apache.qpid.messaging.Message { org.apache.qpid.messaging.cpp.jni.Message _cppMessage; - + public TextMessage(String text) { _cppMessage = new org.apache.qpid.messaging.cpp.jni.Message(text); _cppMessage.setContentType("text/plain"); } - + + public TextMessage(org.apache.qpid.messaging.cpp.jni.Message msg) + { + _cppMessage = msg; + } + @Override public Object getContent() { - // TODO Auto-generated method stub - return null; + return _cppMessage.getContent(); } @Override @@ -67,8 +71,7 @@ public class TextMessage implements org.apache.qpid.messaging.Message @Override public String getContentType() { - // TODO Auto-generated method stub - return null; + return _cppMessage.getContentType(); } @Override @@ -200,7 +203,7 @@ public class TextMessage implements org.apache.qpid.messaging.Message { _cppMessage.setProperty(key, value); } - + protected org.apache.qpid.messaging.cpp.jni.Message getCppMessage() { return _cppMessage; |
