qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [28/50] [abbrv] qpid-proton git commit: Added null checks to String and Symbol. Added a temp hack to get around string encoding. Needs further investigation.
Date Fri, 14 Aug 2015 19:08:01 GMT
Added null checks to String and Symbol.
Added a temp hack to get around string encoding. Needs further investigation.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/9c86177c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/9c86177c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/9c86177c

Branch: refs/heads/rajith-codec
Commit: 9c86177cdf119c59c25cbfdd4e857b2fb7e92f2a
Parents: 1fb126e
Author: Rajith Attapattu <rajith@apache.org>
Authored: Tue May 12 10:57:12 2015 -0400
Committer: Rajith Attapattu <rajith@apache.org>
Committed: Thu Jul 9 09:12:38 2015 -0400

----------------------------------------------------------------------
 .../org/apache/qpid/proton/codec2/AbstractDecoder.java    |  3 ++-
 .../org/apache/qpid/proton/codec2/AbstractEncoder.java    | 10 ++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9c86177c/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
index 032c2bf..af047df 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractDecoder.java
@@ -463,7 +463,8 @@ public abstract class AbstractDecoder implements Decoder
         case Encodings.STR32:
             return new String(readBytes(offset, size), StandardCharsets.UTF_8);
         default:
-            throw new IllegalStateException("cannot convert to a string: " + Type.typeOf(code));
+            return new String(readBytes(offset, size), StandardCharsets.UTF_8);
+            //throw new IllegalStateException("cannot convert to a string: " + Type.typeOf(code));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/9c86177c/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractEncoder.java
----------------------------------------------------------------------
diff --git a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractEncoder.java b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractEncoder.java
index 97147dd..01c3aed 100644
--- a/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractEncoder.java
+++ b/proton-j/src/main/java/org/apache/qpid/proton/codec2/AbstractEncoder.java
@@ -280,6 +280,11 @@ public abstract class AbstractEncoder implements Encoder
 
     @Override
     public void putString(String s) {
+        if(s == null)
+        {
+            putNull();
+            return;
+        }
         byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
         putString(bytes, 0, bytes.length);
     }
@@ -300,6 +305,11 @@ public abstract class AbstractEncoder implements Encoder
 
     @Override
     public void putSymbol(String s) {
+        if(s == null)
+        {
+            putNull();
+            return;
+        }
         byte[] bytes = s.getBytes(StandardCharsets.US_ASCII);
         putSymbol(bytes, 0, bytes.length);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message