Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B2B28183B5 for ; Fri, 14 Aug 2015 19:07:38 +0000 (UTC) Received: (qmail 75275 invoked by uid 500); 14 Aug 2015 19:07:37 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 75231 invoked by uid 500); 14 Aug 2015 19:07:37 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 73158 invoked by uid 99); 14 Aug 2015 19:07:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2015 19:07:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A5904E7160; Fri, 14 Aug 2015 19:07:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rajith@apache.org To: commits@qpid.apache.org Date: Fri, 14 Aug 2015 19:08:01 -0000 Message-Id: <5ed7474c2d6c40ecb8b9c0f44c2ebbc3@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer 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. 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 Authored: Tue May 12 10:57:12 2015 -0400 Committer: Rajith Attapattu 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