[jboss-jira] [JBoss JIRA] Commented: (JBAS-7495) TestManagedConnection GlobalXID is broken

Jonathan Halliday (JIRA) jira-events at lists.jboss.org
Wed Dec 2 07:38:30 EST 2009


    [ https://jira.jboss.org/jira/browse/JBAS-7495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12497713#action_12497713 ] 

Jonathan Halliday commented on JBAS-7495:
-----------------------------------------

the following appears to work:

      public GlobalXID(Xid xid)
      {
         gid = xid.getGlobalTransactionId();
         hashCode = Arrays.hashCode(gid);
      }

      public boolean equals(Object obj)
      {
         if (obj == null || obj instanceof GlobalXID == false)
            return false;
         GlobalXID other = (GlobalXID) obj;
        return Arrays.equals(gid, other.gid);
      }

> TestManagedConnection GlobalXID is broken
> -----------------------------------------
>
>                 Key: JBAS-7495
>                 URL: https://jira.jboss.org/jira/browse/JBAS-7495
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Test Suite
>    Affects Versions: JBossAS-6.0.0.M1
>            Reporter: Jonathan Halliday
>            Assignee: Shelly McGowan
>             Fix For: JBossAS-6.0.0.M2
>
>
> org.jboss.test.jca.adapter.TestManagedConnection uses the GlobalXID class to wrap Xids. Setting aside that this is largely unnecessary abstraction, the implementation of GlobalXID is wrong. It converts a byte[] to a String, an activity which has undefined results where the byte[] contains arbitrary data that does not necessarily map to valid code points in the default charset.  In particular, it can cause non-equal Xids to result in equal GlobalXIDs, which breaks the test. Having all methods on GlobalXID delegate to a wrapped Xid is better, or just remove the GlobalXID abstraction completely.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list