[jboss-cvs] JBoss Messaging SVN: r2267 - trunk/src/main/org/jboss/messaging/core/tx.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Feb 11 13:01:46 EST 2007


Author: timfox
Date: 2007-02-11 13:01:46 -0500 (Sun, 11 Feb 2007)
New Revision: 2267

Modified:
   trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java
Log:
Improved toString



Modified: trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java	2007-02-11 18:00:16 UTC (rev 2266)
+++ trunk/src/main/org/jboss/messaging/core/tx/MessagingXid.java	2007-02-11 18:01:46 UTC (rev 2267)
@@ -124,10 +124,28 @@
 
    public String toString()
    {
-      return getClass().getName() + "(GID: " + new String(getGlobalTransactionId()) +
-                                    ", Branch: " + new String(getBranchQualifier()) +
+      return getClass().getName() + "(GID: " + stringRep(getGlobalTransactionId()) +
+                                    ", Branch: " + stringRep(getBranchQualifier()) +
                                     ", Format: " + getFormatId() + ")";
    }
+   
+   private String stringRep(byte[] bytes)
+   {
+      StringBuffer buff = new StringBuffer();
+      for (int i = 0; i < bytes.length; i++)
+      {
+         byte b = bytes[i];
+         
+         buff.append(b);
+         
+         if (i != bytes.length - 1)
+         {
+            buff.append('.');
+         }
+      }
+      
+      return buff.toString();
+   }
 
    public void read(DataInputStream in) throws Exception
    {




More information about the jboss-cvs-commits mailing list