From commits-return-11568-apmail-qpid-commits-archive=qpid.apache.org@qpid.apache.org Thu Dec 17 17:23:05 2009 Return-Path: Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: (qmail 94225 invoked from network); 17 Dec 2009 17:23:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Dec 2009 17:23:04 -0000 Received: (qmail 66470 invoked by uid 500); 17 Dec 2009 17:23:04 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 66456 invoked by uid 500); 17 Dec 2009 17:23:04 -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 66447 invoked by uid 99); 17 Dec 2009 17:23:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2009 17:23:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2009 17:23:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4B8A62388AB9; Thu, 17 Dec 2009 17:22:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r891805 - in /qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java common/src/main/java/org/apache/qpid/transport/util/Functions.java Date: Thu, 17 Dec 2009 17:22:42 -0000 To: commits@qpid.apache.org From: rajith@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091217172242.4B8A62388AB9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rajith Date: Thu Dec 17 17:22:41 2009 New Revision: 891805 URL: http://svn.apache.org/viewvc?rev=891805&view=rev Log: This is a fix for QPID-1830 I have removed the checkReadable() method from the toBodyString() This will enable the toString() method to be used any time on message. I have also modified the Functions.str() to take in an additional parameter to denote to the starting position of the buffer. Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java?rev=891805&r1=891804&r2=891805&view=diff ============================================================================== --- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java (original) +++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/message/AbstractBytesMessage.java Thu Dec 17 17:22:41 2009 @@ -85,11 +85,18 @@ } public String toBodyString() throws JMSException - { - checkReadable(); + { try { - return Functions.str(_data.buf(), 100); + if (_data != null) + { + return Functions.str(_data.buf(), 100,0); + } + else + { + return ""; + } + } catch (Exception e) { Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java?rev=891805&r1=891804&r2=891805&view=diff ============================================================================== --- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java (original) +++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/util/Functions.java Thu Dec 17 17:22:41 2009 @@ -57,12 +57,17 @@ public static final String str(ByteBuffer buf, int limit) { + return str(buf, limit,buf.position()); + } + + public static final String str(ByteBuffer buf, int limit,int start) + { StringBuilder str = new StringBuilder(); str.append('"'); for (int i = 0; i < min(buf.remaining(), limit); i++) { - byte c = buf.get(buf.position() + i); + byte c = buf.get(start + i); if (c > 31 && c < 127 && c != '\\') { --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscribe@qpid.apache.org