[jboss-svn-commits] JBL Code SVN: r27491 - labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 3 07:44:21 EDT 2009


Author: mark.little at jboss.com
Date: 2009-07-03 07:44:21 -0400 (Fri, 03 Jul 2009)
New Revision: 27491

Modified:
   labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java
Log:
https://jira.jboss.org/jira/browse/JBTM-577

Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java	2009-07-03 11:36:15 UTC (rev 27490)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/jts/utils/Utility.java	2009-07-03 11:44:21 UTC (rev 27491)
@@ -226,17 +226,18 @@
 	byte[] b = theUid.getBytes();
 	byte[] nodeName = TxControl.getXANodeName();
 
-	otid.tid = new byte[b.length+nodeName.length+2];
-	otid.bqual_length = b.length+nodeName.length+2;
+	otid.formatID = 0;
+	otid.tid = new byte[b.length+nodeName.length];
+	otid.bqual_length = nodeName.length;
+	
+	/*
+	 * gtrid must be first then immediately followed by bqual.
+	 * bqual must be between 1 and 64 bytes if for XA.
+	 */
 
-	System.arraycopy(nodeName, 0, otid.tid, 0, nodeName.length);
+	System.arraycopy(b, 0, otid.tid, 0, b.length);
+	System.arraycopy(nodeName, 0, otid.tid, b.length, nodeName.length);
 
-	otid.tid[nodeName.length] = XATxConverter.NODE_SEPARATOR;
-
-	System.arraycopy(b, 0, otid.tid, nodeName.length+1, b.length);
-
-	otid.tid[otid.bqual_length-1] = (byte) '\0';
-
 	b = null;
 
 	return otid;
@@ -253,30 +254,23 @@
     {
 	if (otid.bqual_length > 0)
 	{
-	    int nodeNameIndex = 0;
-
-	    for (int i = 0; i < otid.bqual_length; i++)
-	    {
-		if (otid.tid[i] == XATxConverter.NODE_SEPARATOR)
-		{
-		    nodeNameIndex = i + 1;
-		    break;
-		}
-	    }
-
-	    int uidLength = otid.bqual_length - nodeNameIndex - 1;
+	    int uidLength = otid.tid.length - otid.bqual_length;
 	    byte[] theUid = new byte[uidLength];  // don't need null terminating character
-
-	    System.arraycopy(otid.tid, nodeNameIndex, theUid, 0, uidLength);
-
+	    
+	    System.arraycopy(otid.tid, 0, theUid, 0, uidLength);
+	    
 	    Uid u = new Uid(new String(theUid), true);  // errors in string give NIL_UID
-
+	    
+	    /*
+	     * Currently we ignore bqual. THIS WILL BE AN ISSUE FOR INTEROPERABILITY!!
+	     */
+	    
 	    theUid = null;
-
+	    
 	    return u;
 	}
 	else
-	    return Uid.nullUid();
+	    return Uid.nullUid();  // error, deal with in caller!
     }
 
 }




More information about the jboss-svn-commits mailing list