ozeigermann    2003/12/18 05:14:40

  Modified:    src/share/org/apache/slide/util XidWrapper.java
  Log:
  Replaced characters offending filenames of tx file store to make it work with JBoss' 
TM.
  
  Revision  Changes    Path
  1.3       +25 -19    jakarta-slide/src/share/org/apache/slide/util/XidWrapper.java
  
  Index: XidWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/XidWrapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XidWrapper.java   21 Nov 2003 11:50:13 -0000      1.2
  +++ XidWrapper.java   18 Dec 2003 13:14:40 -0000      1.3
  @@ -13,7 +13,7 @@
    * 
    */
   public class XidWrapper implements Xid {
  -    
  +
       public static final Xid wrap(Xid xid) {
           return wrap(xid, false); // for Slide branch qualifier must not be included 
in onePhase commit
       }
  @@ -29,11 +29,17 @@
       private XidWrapper(Xid xid, boolean includeBranch) {
           this.xid = xid;
           // do calculations once for performance
  -        asString =
  +        String tmpString =
               new String(xid.getGlobalTransactionId())
                   + (includeBranch ? "-" + new String(xid.getBranchQualifier()) : "");
  -        hashCode = asString.hashCode();
   
  +        // XXX for tx file store replace :, \ and / which might be part of the 
identifier with chars not 
  +        // offensive to any file system specific chars
  +        tmpString = tmpString.replace(':', '.');
  +        tmpString = tmpString.replace('/', '-');
  +        asString = tmpString.replace('\\', '_');
  +
  +        hashCode = asString.hashCode();
       }
   
       public Xid getXid() {
  @@ -53,22 +59,22 @@
       }
   
       public boolean equals(Object o) {
  -       return (o != null && asString.equals(o.toString()));
  -       /*
  -        if (this == o) {
  -            return true;
  -        }
  -
  -        if (o != null && o instanceof Xid) {
  -            Xid xid2 = (Xid) o;
  -            // we do not need equality of format Id 
  -            return (
  -                Arrays.equals(xid.getGlobalTransactionId(), 
xid2.getGlobalTransactionId())
  -                    && Arrays.equals(xid.getBranchQualifier(), 
xid2.getBranchQualifier()));
  -        }
  -
  -        return false;
  -        */
  +        return (o != null && asString.equals(o.toString()));
  +        /*
  +         if (this == o) {
  +             return true;
  +         }
  +        
  +         if (o != null && o instanceof Xid) {
  +             Xid xid2 = (Xid) o;
  +             // we do not need equality of format Id 
  +             return (
  +                 Arrays.equals(xid.getGlobalTransactionId(), 
xid2.getGlobalTransactionId())
  +                     && Arrays.equals(xid.getBranchQualifier(), 
xid2.getBranchQualifier()));
  +         }
  +        
  +         return false;
  +         */
       }
   
       public String toString() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to