ozeigermann    2004/08/09 02:35:20

  Modified:    src/stores/org/apache/slide/store/txfile
                        AbstractTxFileStoreService.java
                        TxXMLFileDescriptorsStore.java
  Log:
  Replaced characters special in some file system with harmless ones as
  indicated by Christophe in
  http://issues.apache.org/bugzilla/show_bug.cgi?id=30499
  
  Revision  Changes    Path
  1.16      +17 -9     
jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java
  
  Index: AbstractTxFileStoreService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractTxFileStoreService.java   28 Jul 2004 09:33:59 -0000      1.15
  +++ AbstractTxFileStoreService.java   9 Aug 2004 09:35:20 -0000       1.16
  @@ -190,7 +190,7 @@
       }
   
       public synchronized int prepare(Xid xid) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread " + currentThread + " prepares transaction branch " + txId,
  @@ -217,7 +217,7 @@
       }
   
       public synchronized void rollback(Xid xid) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread " + currentThread + " rolls back transaction branch " + txId,
  @@ -238,7 +238,7 @@
       }
   
       public synchronized void commit(Xid xid, boolean onePhase) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread " + currentThread + " commits transaction branch " + txId,
  @@ -263,7 +263,7 @@
       }
   
       public synchronized void end(Xid xid, int flags) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread "
  @@ -280,7 +280,7 @@
                   break;
               case TMFAIL :
                   try {
  -                    rm.markTransactionForRollback(XidWrapper.wrap(xid));
  +                    rm.markTransactionForRollback(wrap(xid));
                   } catch (ResourceManagerException e) {
                       throw createXAException(e);
                   }
  @@ -292,7 +292,7 @@
       }
   
       public synchronized void start(Xid xid, int flags) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread "
  @@ -452,5 +452,13 @@
           }
       }
   
  +    protected String wrap(Xid xid) {
  +        String sxid = XidWrapper.wrap(xid).toString();
  +        // XXX for tx file store replace :, ', \ and / which might be part of the 
identifier with chars not 
  +        // offensive to any file system specific chars
  +        sxid = sxid.replace('\'', '.').replace('"', '.').replace(':', 
'.').replace('/', '.').replace('\\', '.');
  +        return sxid;
  +    }
  +    
       abstract protected String getLogChannel();
   }
  
  
  
  1.19      +11 -12    
jakarta-slide/src/stores/org/apache/slide/store/txfile/TxXMLFileDescriptorsStore.java
  
  Index: TxXMLFileDescriptorsStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/TxXMLFileDescriptorsStore.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TxXMLFileDescriptorsStore.java    8 Aug 2004 12:24:03 -0000       1.18
  +++ TxXMLFileDescriptorsStore.java    9 Aug 2004 09:35:20 -0000       1.19
  @@ -25,7 +25,6 @@
   
   import org.apache.commons.transaction.file.ResourceManager;
   import org.apache.commons.transaction.file.ResourceManagerException;
  -import org.apache.commons.transaction.util.xa.XidWrapper;
   import org.apache.slide.common.*;
   import org.apache.slide.store.*;
   import org.apache.slide.structure.*;
  @@ -395,7 +394,7 @@
           try {
               super.commit(xid, onePhase);
           } finally {
  -            Object txId = XidWrapper.wrap(xid);
  +            Object txId = wrap(xid);
               activeContexts.remove(txId);
               suspendedContexts.remove(txId);
               activeTransactionBranch.set(null);
  @@ -406,7 +405,7 @@
           try {
               super.rollback(xid);
           } finally {
  -            Object txId = XidWrapper.wrap(xid);
  +            Object txId = wrap(xid);
               activeContexts.remove(txId);
               suspendedContexts.remove(txId);
               activeTransactionBranch.set(null);
  @@ -414,7 +413,7 @@
       }
       
       public synchronized int prepare(Xid xid) throws XAException {
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           getLogger().log(
               "Thread " + Thread.currentThread() + " prepares transaction branch " + 
txId,
               LOG_CHANNEL,
  @@ -473,7 +472,7 @@
           if (getActiveTxId() == null) {
               throw new XAException(XAException.XAER_INVAL);
           }
  -        Object txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread "
  @@ -492,7 +491,7 @@
                   break;
               case TMFAIL :
                   try {
  -                    rm.markTransactionForRollback(XidWrapper.wrap(xid));
  +                    rm.markTransactionForRollback(wrap(xid));
                   } catch (ResourceManagerException e) {
                       throw createXAException(e);
                   }
  @@ -505,7 +504,7 @@
       }
   
       public synchronized void start(Xid xid, int flags) throws XAException {
  -        Xid txId = XidWrapper.wrap(xid);
  +        Object txId = wrap(xid);
           Thread currentThread = Thread.currentThread(); 
           getLogger().log(
               "Thread "
  @@ -608,10 +607,10 @@
       }
   
       private static class TxContext {
  -        public Xid xid;
  +        public Object xid;
           public Map descriptors = new HashMap();
           
  -        public TxContext(Xid xid) {
  +        public TxContext(Object xid) {
               this.xid = xid;
           }
           
  
  
  

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

Reply via email to