[jboss-svn-commits] JBL Code SVN: r26566 - labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/xa.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri May 15 11:40:53 EDT 2009


Author: jhalliday
Date: 2009-05-15 11:40:53 -0400 (Fri, 15 May 2009)
New Revision: 26566

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/xa/XID.java
Log:
Modified XID.toString implementation for more informative logging. JBTM-297


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/xa/XID.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/xa/XID.java	2009-05-15 15:21:08 UTC (rev 26565)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/arjuna/xa/XID.java	2009-05-15 15:40:53 UTC (rev 26566)
@@ -1,20 +1,20 @@
 /*
  * JBoss, Home of Professional Open Source
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors 
- * as indicated by the @author tags. 
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
  * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
+ * full listing of individual contributors.
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
  * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
- * 
+ *
  * (C) 2005-2006,
  * @author JBoss Inc.
  */
@@ -24,7 +24,7 @@
  * Arjuna Solutions Limited,
  * Newcastle upon Tyne,
  * Tyne and Wear,
- * UK.  
+ * UK.
  *
  * $Id: XID.java 2342 2006-03-30 13:06:17Z  $
  */
@@ -35,7 +35,7 @@
 
 /**
  * An X/Open XID implementation.
- * 
+ *
  * @author Mark Little (mark at arjuna.com)
  * @version $Id: XID.java 2342 2006-03-30 13:06:17Z  $
  * @since JTS 1.0.
@@ -139,18 +139,22 @@
 
 	public String toString ()
 	{
-	    String toReturn = "< " + formatID + ", " + gtrid_length + ", "
-				+ bqual_length + ", ";
+        // controversial and not too robust. see JBTM-297 before messing with this.
 
-	    for (int i = 0; i < gtrid_length; i++)
-		toReturn += data[i];
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append("< ");
+        stringBuilder.append(formatID);
+        stringBuilder.append(", ");
+        stringBuilder.append(gtrid_length);
+        stringBuilder.append(", ");
+        stringBuilder.append(bqual_length);
+        stringBuilder.append(", ");
+        stringBuilder.append(new String(data, 0, gtrid_length)); // gtrid
+        stringBuilder.append(", ");
+        stringBuilder.append(new String(data, gtrid_length, bqual_length)); // the bqual
+        stringBuilder.append(" >");
 
-	    for (int j = 0; j < bqual_length; j++)
-		toReturn += data[gtrid_length+j];
-
-	    toReturn += " >";
-
-	    return toReturn;
+        return stringBuilder.toString();
 	}
 
 	public int formatID; /* format identifier (0 for OSI) */




More information about the jboss-svn-commits mailing list