directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235326 [8/28] - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ jdbm-partition...
Date Tue, 24 Jan 2012 16:15:29 GMT
Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/SnapshotRecordManager.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
  */
 package jdbm.recman;
 
+
 import java.io.IOException;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -46,179 +47,182 @@ public class SnapshotRecordManager imple
 {
     /** Wrapped RecordManager */
     protected RecordManager recordManager;
-    
+
     /** Per thread action context */
-    private static final ThreadLocal < ActionContext > actionContextVar = 
-         new ThreadLocal < ActionContext > () 
-         {
-             @Override 
-             protected ActionContext initialValue()
-             {
-                 return null;
-             }
+    private static final ThreadLocal<ActionContext> actionContextVar =
+        new ThreadLocal<ActionContext>()
+        {
+            @Override
+            protected ActionContext initialValue()
+            {
+                return null;
+            }
         };
-     
+
     /** Used for keeping track of actions versions */
     ActionVersioning versioning = new ActionVersioning();
-    
+
     /** Versioned cache */
     LRUCache<Long, Object> versionedCache;
-    
+
     /** Passed to cache as IO callback */
     RecordIO recordIO = new RecordIO();
-    
+
     /** Lock used to serialize write actions and some management operatins */
     Lock bigLock = new ReentrantLock();
 
+
     /**
      * Construct a SanshotRecordManager wrapping another RecordManager
      *
      * @param recordManager Wrapped RecordManager
      */
-    public SnapshotRecordManager( RecordManager recordManager, int size)
+    public SnapshotRecordManager( RecordManager recordManager, int size )
     {
-        if ( recordManager == null ) 
+        if ( recordManager == null )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_517 ) );
         }
 
         this.recordManager = recordManager;
-        
-        versionedCache = new LRUCache<Long ,Object>(recordIO, size);
+
+        versionedCache = new LRUCache<Long, Object>( recordIO, size );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ActionContext beginAction( boolean readOnly, String whoStarted )
+    {
+        ActionContext actionContext = new ActionContext();
+        ActionVersioning.Version version;
+
+        if ( readOnly )
+        {
+            version = versioning.beginReadAction();
+        }
+        else
+        {
+            bigLock.lock();
+            version = versioning.beginWriteAction();
+        }
+
+        actionContext.beginAction( readOnly, version, whoStarted );
+        setCurrentActionContext( actionContext );
+
+        return actionContext;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCurrentActionContext( ActionContext context )
+    {
+        ActionContext actionContext = actionContextVar.get();
+
+        if ( actionContext != null )
+        {
+            throw new IllegalStateException( "Action Context Not Null: " + actionContext.getWhoStarted() );
+        }
+
+        actionContextVar.set( context );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void unsetCurrentActionContext( ActionContext context )
+    {
+        ActionContext actionContext = actionContextVar.get();
+
+        if ( actionContext != context )
+        {
+            throw new IllegalStateException( "Trying to end action context not set in the thread context variable"
+                + context +
+                " " + actionContext );
+        }
+
+        actionContextVar.set( null );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void endAction( ActionContext actionContext )
+    {
+        ActionVersioning.Version minVersion = null;
+
+        if ( actionContext.isReadOnlyAction() )
+        {
+            ActionVersioning.Version version = actionContext.getVersion();
+            minVersion = versioning.endReadAction( version );
+            actionContext.endAction();
+        }
+        else if ( actionContext.isWriteAction() )
+        {
+            minVersion = versioning.endWriteAction();
+            actionContext.endAction();
+            bigLock.unlock();
+        }
+        else
+        {
+            throw new IllegalStateException( " Wrong action type " + actionContext );
+        }
+
+        unsetCurrentActionContext( actionContext );
+
+        if ( minVersion != null )
+        {
+            versionedCache.advanceMinReadVersion( minVersion.getVersion() );
+        }
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
-     */     
-     public ActionContext beginAction( boolean readOnly , String whoStarted )
-     {
-         ActionContext actionContext = new ActionContext();
-         ActionVersioning.Version version;
-         
-         if ( readOnly )
-         {
-             version = versioning.beginReadAction();
-         }
-         else
-         {
-             bigLock.lock();
-             version = versioning.beginWriteAction();
-         }
-         
-         actionContext.beginAction( readOnly, version, whoStarted );
-         setCurrentActionContext( actionContext );
-         
-         return actionContext;
-     }
-     
-     /**
-      * {@inheritDoc}
-      */
-     public void setCurrentActionContext( ActionContext context )
-     {
-         ActionContext actionContext = actionContextVar.get();
-         
-         if ( actionContext != null )
-         {
-             throw new IllegalStateException( "Action Context Not Null: " + actionContext.getWhoStarted() );
-         }
-
-         actionContextVar.set( context );
-     }
-     
-     
-     /**
-      * {@inheritDoc}
-      */
-     public void unsetCurrentActionContext( ActionContext context )
-     {
-         ActionContext actionContext = actionContextVar.get();
-         
-         if ( actionContext != context )
-         {
-             throw new IllegalStateException( "Trying to end action context not set in the thread context variable" + context + 
-                     " " + actionContext );
-         }
-
-         actionContextVar.set( null );
-     }
-     
-     
-     /**
-      * {@inheritDoc}
-      */
-     public void endAction( ActionContext actionContext )
-     {
-         ActionVersioning.Version minVersion = null;
-         
-         if ( actionContext.isReadOnlyAction() )
-         {
-             ActionVersioning.Version version = actionContext.getVersion(); 
-             minVersion = versioning.endReadAction( version );
-             actionContext.endAction();
-         }
-         else if ( actionContext.isWriteAction() )
-         {
-             minVersion = versioning.endWriteAction();
-             actionContext.endAction();
-             bigLock.unlock();
-         }
-         else
-         {
-             throw new IllegalStateException( " Wrong action type " + actionContext );
-         }
-         
-         unsetCurrentActionContext( actionContext );
-         
-         if ( minVersion != null )
-         {
-             versionedCache.advanceMinReadVersion( minVersion.getVersion() );
-         }
-     }
-     
-     
-     /**
-      * {@inheritDoc}
-      */
-     public void abortAction( ActionContext actionContext )
-     {
-         ActionVersioning.Version minVersion = null;
-         
-         if ( actionContext.isReadOnlyAction() )
-         {
-             ActionVersioning.Version version = actionContext.getVersion(); 
-             minVersion = versioning.endReadAction( version );
-             actionContext.endAction();
-         }
-         else if ( actionContext.isWriteAction() )
-         {
-             /*
-              *  Do not let versioning know that write action is complete,
-              *  so that the readers wont see the effect of the aborted
-              *  txn. The sensible thing to do would be to have the underling
-              *  record manager expose a abort action interface. When that lacks.
-              *  the right thing for the upper layer to do would is to rollback whatever 
-              *  is part of what JDBM calls a txn.
-              */
-             
-             actionContext.endAction();
-             bigLock.unlock();
-         }
-         else
-         {
-             throw new IllegalStateException( "Wrong action context type " + actionContext );
-         }
-         
-         unsetCurrentActionContext( actionContext );
-         
-         if ( minVersion != null )
-         {
-             versionedCache.advanceMinReadVersion( minVersion.getVersion() );
-         }
-     }
-     
-         
+     */
+    public void abortAction( ActionContext actionContext )
+    {
+        ActionVersioning.Version minVersion = null;
+
+        if ( actionContext.isReadOnlyAction() )
+        {
+            ActionVersioning.Version version = actionContext.getVersion();
+            minVersion = versioning.endReadAction( version );
+            actionContext.endAction();
+        }
+        else if ( actionContext.isWriteAction() )
+        {
+            /*
+             *  Do not let versioning know that write action is complete,
+             *  so that the readers wont see the effect of the aborted
+             *  txn. The sensible thing to do would be to have the underling
+             *  record manager expose a abort action interface. When that lacks.
+             *  the right thing for the upper layer to do would is to rollback whatever 
+             *  is part of what JDBM calls a txn.
+             */
+
+            actionContext.endAction();
+            bigLock.unlock();
+        }
+        else
+        {
+            throw new IllegalStateException( "Wrong action context type " + actionContext );
+        }
+
+        unsetCurrentActionContext( actionContext );
+
+        if ( minVersion != null )
+        {
+            versionedCache.advanceMinReadVersion( minVersion.getVersion() );
+        }
+    }
+
+
     /**
      * Get the underlying Record Manager.
      *
@@ -229,7 +233,7 @@ public class SnapshotRecordManager imple
         return recordManager;
     }
 
-    
+
     /**
      * Inserts a new record using a custom serializer.
      *
@@ -241,8 +245,8 @@ public class SnapshotRecordManager imple
     {
         return insert( obj, DefaultSerializer.INSTANCE );
     }
-        
-        
+
+
     /**
      * Inserts a new record using a custom serializer.
      *
@@ -254,26 +258,26 @@ public class SnapshotRecordManager imple
     public long insert( Object obj, Serializer serializer ) throws IOException
     {
         checkIfClosed();
-        
+
         ActionContext actionContext = actionContextVar.get();
         boolean startedAction = false;
         boolean abortedAction = false;
-        
+
         if ( actionContext == null )
         {
             actionContext = beginAction( false, "insert missing action" );
             startedAction = true;
         }
-        
+
         long recid = 0;
-        
+
         try
         {
             recid = recordManager.insert( obj, serializer );
-            
+
             versionedCache.put( Long.valueOf( recid ), obj, actionContext.getVersion().getVersion(),
                 serializer, false );
-        } 
+        }
         catch ( IOException e )
         {
             if ( startedAction )
@@ -281,19 +285,19 @@ public class SnapshotRecordManager imple
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw e;
         }
-        catch ( CacheEvictionException except ) 
+        catch ( CacheEvictionException except )
         {
             if ( startedAction )
             {
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw new IOException( except.getLocalizedMessage() );
-        }       
+        }
         finally
         {
             if ( startedAction && !abortedAction )
@@ -301,7 +305,7 @@ public class SnapshotRecordManager imple
                 endAction( actionContext );
             }
         }
-        
+
         return recid;
     }
 
@@ -315,19 +319,19 @@ public class SnapshotRecordManager imple
     public void delete( long recid ) throws IOException
     {
         checkIfClosed();
-        
+
         ActionContext actionContext = actionContextVar.get();
         boolean startedAction = false;
         boolean abortedAction = false;
-        
+
         if ( actionContext == null )
         {
             actionContext = beginAction( false, "delete missing action" );
             startedAction = true;
         }
-        
+
         // Update the cache
-        try 
+        try
         {
             versionedCache.put( Long.valueOf( recid ), null, actionContext.getVersion().getVersion(),
                 null, false );
@@ -339,17 +343,17 @@ public class SnapshotRecordManager imple
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw e;
         }
-        catch ( CacheEvictionException except ) 
+        catch ( CacheEvictionException except )
         {
             if ( startedAction )
             {
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw new IOException( except.getLocalizedMessage() );
         }
         finally
@@ -373,7 +377,7 @@ public class SnapshotRecordManager imple
     {
         update( recid, obj, DefaultSerializer.INSTANCE );
     }
-    
+
 
     /**
      * Updates a record using a custom serializer.
@@ -389,17 +393,17 @@ public class SnapshotRecordManager imple
         ActionContext actionContext = actionContextVar.get();
         boolean startedAction = false;
         boolean abortedAction = false;
-        
+
         if ( actionContext == null )
         {
             actionContext = beginAction( false, "update missing action" );
             startedAction = true;
         }
 
-        try 
+        try
         {
-           versionedCache.put( Long.valueOf( recid ), obj, actionContext.getVersion().getVersion(),
-               serializer, recid < 0 );       
+            versionedCache.put( Long.valueOf( recid ), obj, actionContext.getVersion().getVersion(),
+                serializer, recid < 0 );
         }
         catch ( IOException e )
         {
@@ -408,24 +412,24 @@ public class SnapshotRecordManager imple
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw e;
         }
-        catch ( CacheEvictionException except ) 
+        catch ( CacheEvictionException except )
         {
             if ( startedAction )
             {
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw new IOException( except.getLocalizedMessage() );
-        }       
+        }
         finally
         {
             if ( startedAction && !abortedAction )
             {
-                endAction ( actionContext );
+                endAction( actionContext );
             }
         }
     }
@@ -443,7 +447,7 @@ public class SnapshotRecordManager imple
         return fetch( recid, DefaultSerializer.INSTANCE );
     }
 
-        
+
     /**
      * Fetches a record using a custom serializer.
      *
@@ -457,21 +461,21 @@ public class SnapshotRecordManager imple
         checkIfClosed();
         Object obj;
         ActionContext actionContext = actionContextVar.get();
-        
+
         boolean startedAction = false;
         boolean abortedAction = false;
-        
+
         if ( actionContext == null )
         {
             actionContext = beginAction( false, "fetch missing action" );
             startedAction = true;
         }
-        
-        try 
+
+        try
         {
-           obj = versionedCache.get( Long.valueOf( recid ), actionContext.getVersion().getVersion(),
-               serializer );
-        } 
+            obj = versionedCache.get( Long.valueOf( recid ), actionContext.getVersion().getVersion(),
+                serializer );
+        }
         catch ( IOException e )
         {
             if ( startedAction )
@@ -479,7 +483,7 @@ public class SnapshotRecordManager imple
                 abortAction( actionContext );
                 abortedAction = true;
             }
-            
+
             throw e;
         }
         finally
@@ -489,7 +493,7 @@ public class SnapshotRecordManager imple
                 endAction( actionContext );
             }
         }
-        
+
         return obj;
     }
 
@@ -533,7 +537,7 @@ public class SnapshotRecordManager imple
     public long getRoot( int id ) throws IOException
     {
         bigLock.lock();
-        
+
         try
         {
             checkIfClosed();
@@ -554,7 +558,7 @@ public class SnapshotRecordManager imple
     public void setRoot( int id, long rowid ) throws IOException
     {
         bigLock.lock();
-        
+
         try
         {
             checkIfClosed();
@@ -574,11 +578,11 @@ public class SnapshotRecordManager imple
     public void commit() throws IOException
     {
         bigLock.lock();
-        
+
         try
         {
             checkIfClosed();
-        
+
             recordManager.commit();
         }
         finally
@@ -593,7 +597,7 @@ public class SnapshotRecordManager imple
      */
     public void rollback() throws IOException
     {
-      // TODO handle this by quiecesing all actions and throwing away the cache contents
+        // TODO handle this by quiecesing all actions and throwing away the cache contents
     }
 
 
@@ -604,7 +608,7 @@ public class SnapshotRecordManager imple
     public long getNamedObject( String name ) throws IOException
     {
         bigLock.lock();
-        
+
         try
         {
             checkIfClosed();
@@ -624,7 +628,7 @@ public class SnapshotRecordManager imple
     public void setNamedObject( String name, long recid ) throws IOException
     {
         bigLock.lock();
-        
+
         try
         {
             checkIfClosed();
@@ -636,7 +640,8 @@ public class SnapshotRecordManager imple
             bigLock.unlock();
         }
     }
-    
+
+
     @Override
     public String toString()
     {
@@ -644,7 +649,7 @@ public class SnapshotRecordManager imple
         sb.append( "SnapshotRecordManager: " );
         sb.append( "(lruCache:" ).append( versionedCache );
         sb.append( ")\n" );
-        
+
         return sb.toString();
     }
 
@@ -654,36 +659,36 @@ public class SnapshotRecordManager imple
      */
     private void checkIfClosed() throws IllegalStateException
     {
-        if ( recordManager == null ) 
+        if ( recordManager == null )
         {
             throw new IllegalStateException( I18n.err( I18n.ERR_538 ) );
         }
     }
-   
-    
+
     private class RecordIO implements EntryIO<Long, Object>
     {
-        public Object read( Long key, Serializer serializer) throws IOException
+        public Object read( Long key, Serializer serializer ) throws IOException
         {
             // Meta objects are kept in memory only
             if ( key < 0 )
             {
                 return null;
             }
-            
+
             return recordManager.fetch( key.longValue(), serializer );
         }
-        
+
+
         public void write( Long key, Object value, Serializer serializer ) throws IOException
         {
             if ( key < 0 )
             {
                 return;
             }
-            
+
             if ( value != null )
             {
-                recordManager.update( key.longValue(), value , serializer );
+                recordManager.update( key.longValue(), value, serializer );
             }
             else
             {

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TransactionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TransactionManager.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TransactionManager.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TransactionManager.java Tue Jan 24 16:15:05 2012
@@ -47,11 +47,13 @@
 
 package jdbm.recman;
 
+
 import java.io.*;
 import java.util.*;
 
 import org.apache.directory.server.i18n.I18n;
 
+
 /**
  *  This class manages the transaction log that belongs to every
  *  {@link RecordFile}. The transaction log is either clean, or
@@ -65,7 +67,8 @@ import org.apache.directory.server.i18n.
 // TODO: Handle the case where we are recovering lg9 and lg0, were we
 // should start with lg9 instead of lg0!
 
-public final class TransactionManager {
+public final class TransactionManager
+{
     private RecordFile owner;
 
     // streams for transaction log.
@@ -96,19 +99,21 @@ public final class TransactionManager {
     /** Extension of a log file. */
     static final String extension = ".lg";
 
+
     /**
      *  Instantiates a transaction manager instance. If recovery
      *  needs to be performed, it is done.
      *
      *  @param owner the RecordFile instance that owns this transaction mgr.
      */
-    TransactionManager(RecordFile owner) throws IOException {
+    TransactionManager( RecordFile owner ) throws IOException
+    {
         this.owner = owner;
         recover();
         open();
     }
 
-    
+
     /**
      * Synchronize log file data with the main database file.
      * <p>
@@ -122,7 +127,7 @@ public final class TransactionManager {
         synchronizeLogFromMemory();
     }
 
-    
+
     /**
      * Set the maximum number of transactions to record in
      * the log (and keep in memory) before the log is
@@ -134,40 +139,48 @@ public final class TransactionManager {
     public void setMaximumTransactionsInLog( int maxTxns )
         throws IOException
     {
-        if ( maxTxns <= 0 ) {
+        if ( maxTxns <= 0 )
+        {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_563 ) );
         }
-        if ( curTxn != -1 ) {
+        if ( curTxn != -1 )
+        {
             throw new IllegalStateException( I18n.err( I18n.ERR_564 ) );
         }
         _maxTxns = maxTxns;
-        txns = new ArrayList[ maxTxns ];
+        txns = new ArrayList[maxTxns];
     }
 
-    
+
     /** Builds logfile name  */
-    private String makeLogName() {
+    private String makeLogName()
+    {
         return owner.getFileName() + extension;
     }
 
 
     /** Synchs in-core transactions to data file and opens a fresh log */
-    private void synchronizeLogFromMemory() throws IOException {
+    private void synchronizeLogFromMemory() throws IOException
+    {
         close();
 
         TreeSet blockList = new TreeSet( new BlockIoComparator() );
 
-        for (int i = 0; i < _maxTxns; i++) {
-            if (txns[i] == null)
+        for ( int i = 0; i < _maxTxns; i++ )
+        {
+            if ( txns[i] == null )
                 continue;
             // Add each block to the blockList, replacing the old copy of this
             // block if necessary, thus avoiding writing the same block twice
-            for (Iterator k = txns[i].iterator(); k.hasNext(); ) {
-                BlockIo block = (BlockIo)k.next();
-                if ( blockList.contains( block ) ) {
+            for ( Iterator k = txns[i].iterator(); k.hasNext(); )
+            {
+                BlockIo block = ( BlockIo ) k.next();
+                if ( blockList.contains( block ) )
+                {
                     block.decrementTransactionCount();
                 }
-                else {
+                else
+                {
                     blockList.add( block );
                 }
             }
@@ -175,7 +188,7 @@ public final class TransactionManager {
             txns[i] = null;
         }
         // Write the blocks from the blockList to disk
-        synchronizeBlocks(blockList.iterator(), true);
+        synchronizeBlocks( blockList.iterator(), true );
 
         owner.sync();
         open();
@@ -183,58 +196,75 @@ public final class TransactionManager {
 
 
     /** Opens the log file */
-    private void open() throws IOException {
-        fos = new FileOutputStream(makeLogName());
-        oos = new ObjectOutputStream(fos);
-        oos.writeShort(Magic.LOGFILE_HEADER);
+    private void open() throws IOException
+    {
+        fos = new FileOutputStream( makeLogName() );
+        oos = new ObjectOutputStream( fos );
+        oos.writeShort( Magic.LOGFILE_HEADER );
         oos.flush();
         curTxn = -1;
     }
 
+
     /** Startup recovery on all files */
-    private void recover() throws IOException {
+    private void recover() throws IOException
+    {
         String logName = makeLogName();
-        File logFile = new File(logName);
-        if (!logFile.exists())
+        File logFile = new File( logName );
+        if ( !logFile.exists() )
             return;
-        if (logFile.length() == 0) {
+        if ( logFile.length() == 0 )
+        {
             logFile.delete();
             return;
         }
 
-        FileInputStream fis = new FileInputStream(logFile);
-        ObjectInputStream ois = new ObjectInputStream(fis);
+        FileInputStream fis = new FileInputStream( logFile );
+        ObjectInputStream ois = new ObjectInputStream( fis );
 
-        try {
-            if (ois.readShort() != Magic.LOGFILE_HEADER) {
+        try
+        {
+            if ( ois.readShort() != Magic.LOGFILE_HEADER )
+            {
                 ois.close();
                 throw new Error( I18n.err( I18n.ERR_565 ) );
             }
-        } catch (IOException e) {
+        }
+        catch ( IOException e )
+        {
             // corrupted/empty logfile
             ois.close();
             logFile.delete();
             return;
         }
 
-        while (true) {
+        while ( true )
+        {
             ArrayList blocks = null;
-            try {
-                blocks = (ArrayList) ois.readObject();
-            } catch (ClassNotFoundException e) {
+            try
+            {
+                blocks = ( ArrayList ) ois.readObject();
+            }
+            catch ( ClassNotFoundException e )
+            {
                 ois.close();
                 throw new Error( I18n.err( I18n.ERR_566, e ) );
-            } catch (IOException e) {
+            }
+            catch ( IOException e )
+            {
                 // corrupted logfile, ignore rest of transactions
                 break;
             }
-            synchronizeBlocks(blocks.iterator(), false);
+            synchronizeBlocks( blocks.iterator(), false );
 
             // ObjectInputStream must match exactly each
             // ObjectOutputStream created during writes
-            try {
-                ois = new ObjectInputStream(fis);
-            } catch (IOException e) {
+            try
+            {
+                ois = new ObjectInputStream( fis );
+            }
+            catch ( IOException e )
+            {
                 // corrupted logfile, ignore rest of transactions
                 break;
             }
@@ -244,17 +274,22 @@ public final class TransactionManager {
         logFile.delete();
     }
 
+
     /** Synchronizes the indicated blocks with the owner. */
-    private void synchronizeBlocks(Iterator blockIterator, boolean fromCore)
-    throws IOException {
+    private void synchronizeBlocks( Iterator blockIterator, boolean fromCore )
+        throws IOException
+    {
         // write block vector elements to the data file.
-        while ( blockIterator.hasNext() ) {
-            BlockIo cur = (BlockIo)blockIterator.next();
-            owner.sync(cur);
-            if (fromCore) {
+        while ( blockIterator.hasNext() )
+        {
+            BlockIo cur = ( BlockIo ) blockIterator.next();
+            owner.sync( cur );
+            if ( fromCore )
+            {
                 cur.decrementTransactionCount();
-                if (!cur.isInTransaction()) {
-                    owner.releaseFromTransaction(cur, true);
+                if ( !cur.isInTransaction() )
+                {
+                    owner.releaseFromTransaction( cur, true );
                 }
             }
         }
@@ -262,84 +297,103 @@ public final class TransactionManager {
 
 
     /** Set clean flag on the blocks. */
-    private void setClean(ArrayList blocks)
-    throws IOException {
-        for (Iterator k = blocks.iterator(); k.hasNext(); ) {
-            BlockIo cur = (BlockIo) k.next();
+    private void setClean( ArrayList blocks )
+        throws IOException
+    {
+        for ( Iterator k = blocks.iterator(); k.hasNext(); )
+        {
+            BlockIo cur = ( BlockIo ) k.next();
             cur.setClean();
         }
     }
 
+
     /** Discards the indicated blocks and notify the owner. */
-    private void discardBlocks(ArrayList blocks)
-    throws IOException {
-        for (Iterator k = blocks.iterator(); k.hasNext(); ) {
-            BlockIo cur = (BlockIo) k.next();
+    private void discardBlocks( ArrayList blocks )
+        throws IOException
+    {
+        for ( Iterator k = blocks.iterator(); k.hasNext(); )
+        {
+            BlockIo cur = ( BlockIo ) k.next();
             cur.decrementTransactionCount();
-            if (!cur.isInTransaction()) {
-                owner.releaseFromTransaction(cur, false);
+            if ( !cur.isInTransaction() )
+            {
+                owner.releaseFromTransaction( cur, false );
             }
         }
     }
 
+
     /**
      *  Starts a transaction. This can block if all slots have been filled
      *  with full transactions, waiting for the synchronization thread to
      *  clean out slots.
      */
-    void start() throws IOException {
+    void start() throws IOException
+    {
         curTxn++;
-        if (curTxn == _maxTxns) {
+        if ( curTxn == _maxTxns )
+        {
             synchronizeLogFromMemory();
             curTxn = 0;
         }
         txns[curTxn] = new ArrayList();
     }
 
+
     /**
      *  Indicates the block is part of the transaction.
      */
-    void add(BlockIo block) throws IOException {
+    void add( BlockIo block ) throws IOException
+    {
         block.incrementTransactionCount();
-        txns[curTxn].add(block);
+        txns[curTxn].add( block );
     }
 
+
     /**
      *  Commits the transaction to the log file.
      */
-    void commit() throws IOException {
-        oos.writeObject(txns[curTxn]);
+    void commit() throws IOException
+    {
+        oos.writeObject( txns[curTxn] );
         sync();
 
         // set clean flag to indicate blocks have been written to log
-        setClean(txns[curTxn]);
+        setClean( txns[curTxn] );
 
         // reset ObjectOutputStream in order to store
         // newer states of BlockIo
-        oos = new ObjectOutputStream(fos);
+        oos = new ObjectOutputStream( fos );
         oos.reset();
     }
 
+
     /** Flushes and syncs */
-    private void sync() throws IOException {
+    private void sync() throws IOException
+    {
         oos.flush();
         fos.flush();
         fos.getFD().sync();
     }
 
+
     /**
      *  Shutdowns the transaction manager. Resynchronizes outstanding
      *  logs.
      */
-    void shutdown() throws IOException {
+    void shutdown() throws IOException
+    {
         synchronizeLogFromMemory();
         close();
     }
 
+
     /**
      *  Closes open files.
      */
-    private void close() throws IOException {
+    private void close() throws IOException
+    {
         sync();
         oos.close();
         fos.close();
@@ -347,29 +401,34 @@ public final class TransactionManager {
         fos = null;
     }
 
+
     /**
      * Force closing the file without synchronizing pending transaction data.
      * Used for testing purposes only.
      */
-    void forceClose() throws IOException {
+    void forceClose() throws IOException
+    {
         oos.close();
         fos.close();
         oos = null;
         fos = null;
     }
 
+
     /**
      * Use the disk-based transaction log to synchronize the data file.
      * Outstanding memory logs are discarded because they are believed
      * to be inconsistent.
      */
-    void synchronizeLogFromDisk() throws IOException {
+    void synchronizeLogFromDisk() throws IOException
+    {
         close();
 
-        for ( int i=0; i < _maxTxns; i++ ) {
-            if (txns[i] == null)
+        for ( int i = 0; i < _maxTxns; i++ )
+        {
+            if ( txns[i] == null )
                 continue;
-            discardBlocks(txns[i]);
+            discardBlocks( txns[i] );
             txns[i] = null;
         }
 
@@ -377,7 +436,6 @@ public final class TransactionManager {
         open();
     }
 
-
     /** INNER CLASS.
      *  Comparator class for use by the tree set used to store the blocks
      *  to write for this transaction.  The BlockIo objects are ordered by
@@ -387,24 +445,30 @@ public final class TransactionManager {
         implements Comparator
     {
 
-        public int compare( Object o1, Object o2 ) {
-            BlockIo block1 = (BlockIo)o1;
-            BlockIo block2 = (BlockIo)o2;
+        public int compare( Object o1, Object o2 )
+        {
+            BlockIo block1 = ( BlockIo ) o1;
+            BlockIo block2 = ( BlockIo ) o2;
             int result = 0;
-            if ( block1.getBlockId() == block2.getBlockId() ) {
+            if ( block1.getBlockId() == block2.getBlockId() )
+            {
                 result = 0;
             }
-            else if ( block1.getBlockId() < block2.getBlockId() ) {
+            else if ( block1.getBlockId() < block2.getBlockId() )
+            {
                 result = -1;
             }
-            else {
+            else
+            {
                 result = 1;
             }
             return result;
         }
 
-        public boolean equals(Object obj) {
-            return super.equals(obj);
+
+        public boolean equals( Object obj )
+        {
+            return super.equals( obj );
         }
     } // class BlockIOComparator
 

Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TranslationPage.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TranslationPage.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TranslationPage.java (original)
+++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/recman/TranslationPage.java Tue Jan 24 16:15:05 2012
@@ -47,41 +47,40 @@
 package jdbm.recman;
 
 
-
 /**
  * Class describing a page that holds translations from physical rowids
  * to logical rowids. In fact, the page just holds physical rowids - the
  * page's block is the block for the logical rowid, the offset serve
  * as offset for the rowids.
  */
-final class TranslationPage extends PageHeader 
+final class TranslationPage extends PageHeader
 {
     /** Offset of the PageHeader */
     static final short O_TRANS = PageHeader.SIZE; // short count
-    
+
     /** Number of PhysicalRowId in this page */
     static final short ELEMS_PER_PAGE = ( RecordFile.BLOCK_SIZE - O_TRANS ) / PhysicalRowId.SIZE;
-    
+
     /** The table of PhysicalRowId */
     final PhysicalRowId[] slots = new PhysicalRowId[ELEMS_PER_PAGE];
 
-    
+
     /**
      * Constructs a data page view from the indicated block.
      */
-    TranslationPage( BlockIo blockIo ) 
+    TranslationPage( BlockIo blockIo )
     {
         super( blockIo );
     }
-    
+
 
     /**
      * Factory method to create or return a data page for the indicated block.
      */
-    static TranslationPage getTranslationPageView( BlockIo blockIo ) 
+    static TranslationPage getTranslationPageView( BlockIo blockIo )
     {
         BlockView view = blockIo.getView();
-        
+
         if ( ( view != null ) && view instanceof TranslationPage )
         {
             return ( TranslationPage ) view;
@@ -91,45 +90,45 @@ final class TranslationPage extends Page
             return new TranslationPage( blockIo );
         }
     }
-    
+
 
     /** Returns the value of the indicated rowid on the page */
-    PhysicalRowId get( short offset ) 
+    PhysicalRowId get( short offset )
     {
         int slot = ( offset - O_TRANS ) / PhysicalRowId.SIZE;
-        
+
         if ( slots[slot] == null )
         {
             slots[slot] = new PhysicalRowId( blockIo, offset );
         }
-        
+
         return slots[slot];
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public String toString() 
+    public String toString()
     {
         StringBuilder sb = new StringBuilder();
-        
+
         sb.append( "TranslationPage ( " );
-        
+
         // The blockIO
         sb.append( super.toString() ).append( ", " );
-        
+
         // Dump the Physical row id
         for ( int i = 0; i < ELEMS_PER_PAGE; i++ )
         {
             if ( slots[i] != null )
             {
                 sb.append( ", [" ).append( i ).append( "]=<" ).
-                append( slots[i].getBlock() ).append( ", " ).
-                append( slots[i].getOffset() ).append( ">" );
+                    append( slots[i].getBlock() ).append( ", " ).
+                    append( slots[i].getOffset() ).append( ">" );
             }
         }
-        
+
         sb.append( ")" );
         return sb.toString();
     }

Modified: directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestSnapshotBTree.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestSnapshotBTree.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestSnapshotBTree.java (original)
+++ directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestSnapshotBTree.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
  */
 package jdbm.btree;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
@@ -38,6 +39,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
+
 /**
  * 
  * TODO SnapshotBTree.
@@ -48,41 +50,45 @@ public class TestSnapshotBTree
 {
     @Rule
     public TemporaryFolder folder = new TemporaryFolder();
-    
+
     private static class IntWrapper implements Serializable
     {
         int value;
+
+
         IntWrapper( int value )
         {
             this.value = value;
         }
     }
-    
+
+
     private String getTemporaryFile( String name ) throws IOException
     {
         String file = folder.newFile( name ).getAbsolutePath();
         return file;
     }
-    
+
+
     @Test
     public void testBasic1() throws IOException, InterruptedException
     {
         RecordManager recman;
         BTree<Integer, IntWrapper> tree;
-      
+
         int idx;
         int numReadThreads = 1;
         BasicTestThread readThreads[] = new BasicTestThread[numReadThreads];
         BasicTestThread updateThread;
-        
+
         Semaphore browseSem = new Semaphore( 0 );
         Semaphore updateSem = new Semaphore( 0 );
 
         recman = RecordManagerFactory.createRecordManager( getTemporaryFile( "testBasic1" ) );
         SnapshotRecordManager snapshotRecman = new SnapshotRecordManager( recman, 1 << 12 );
-        
+
         tree = new BTree<Integer, IntWrapper>( snapshotRecman, new IntegerComparator() );
-     
+
         for ( idx = 0; idx < 1024; idx++ )
         {
             tree.insert( new Integer( idx ), new IntWrapper( idx ), true );
@@ -92,27 +98,24 @@ public class TestSnapshotBTree
         {
             readThreads[idx] = new BasicTestThread( true, tree, browseSem, updateSem, numReadThreads );
         }
-        updateThread = new BasicTestThread( false, tree, browseSem, updateSem, numReadThreads );      
-        
+        updateThread = new BasicTestThread( false, tree, browseSem, updateSem, numReadThreads );
+
         updateThread.start();
-        
+
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
             readThreads[idx].start();
         }
-        
+
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
             readThreads[idx].join();
         }
         updateThread.join();
-        
+
         snapshotRecman.close();
     }
-    
-   
-    
-    
+
     class BasicTestThread extends Thread
     {
         boolean readOnly;
@@ -121,8 +124,9 @@ public class TestSnapshotBTree
         Semaphore updateSem;
         int numReadThreads;
 
+
         BasicTestThread( boolean readOnly, BTree<Integer, IntWrapper> btree, Semaphore firstBrowse,
-                    Semaphore updateDone, int numReadThreads )
+            Semaphore updateDone, int numReadThreads )
         {
             this.readOnly = readOnly;
             this.btree = btree;
@@ -132,7 +136,6 @@ public class TestSnapshotBTree
         }
 
 
-
         private void readOnlyActions() throws IOException, InterruptedException
         {
             int count = 0;
@@ -149,12 +152,12 @@ public class TestSnapshotBTree
             assertEquals( tuple.getKey().intValue(), 1 );
             count++;
 
-            while( browser.getNext( tuple ) )
+            while ( browser.getNext( tuple ) )
             {
                 count++;
 
                 // Sleep a little randomly.                                                                                                                                                               
-                if ( (count & 7) == 0 )
+                if ( ( count & 7 ) == 0 )
                 {
                     Thread.sleep( 1 );
                 }
@@ -162,7 +165,6 @@ public class TestSnapshotBTree
                 assertTrue( tuple.getValue().value != -1 );
             }
 
-
             System.out.println( "count is " + count );
             assertEquals( count, 1024 );
             browser.close();
@@ -171,7 +173,7 @@ public class TestSnapshotBTree
             browser = btree.browse( new Integer( 10 ) );
 
             browseSem.release();
-            
+
             for ( idx = 20; idx < 1024; idx++ )
             {
                 assertTrue( browser.getNext( tuple ) );
@@ -179,10 +181,11 @@ public class TestSnapshotBTree
                 //System.out.println( "key:"+ tuple.getKey().intValue() + " idx:" + idx );
                 assertTrue( tuple.getKey().intValue() == idx );
             }
-            
+
             browser.close();
         }
-        
+
+
         private void readWriteActions() throws IOException
         {
             int idx;
@@ -192,29 +195,28 @@ public class TestSnapshotBTree
                 browseSem.acquireUninterruptibly();
             }
 
-            
             Integer key = new Integer( 1023 );
             IntWrapper value = btree.find( key );
             value.value = -1;
             btree.insert( key, value, true );
-            
-            key = new Integer(512);
+
+            key = new Integer( 512 );
             value = btree.find( key );
             value.value = -1;
-            
-            btree.insert( key, value , true );
+
+            btree.insert( key, value, true );
             for ( idx = 1024; idx < 2048; idx++ )
             {
                 btree.insert( new Integer( idx ), new IntWrapper( idx ), true );
             }
 
-            key = new Integer(1);
+            key = new Integer( 1 );
             value = btree.find( key );
             value.value = -1;
-            
-            btree.insert( key, value , true );
-            btree.insert( new Integer(1024), new IntWrapper( -1 ), true );
-            
+
+            btree.insert( key, value, true );
+            btree.insert( new Integer( 1024 ), new IntWrapper( -1 ), true );
+
             for ( idx = 10; idx < 20; idx++ )
             {
                 btree.remove( new Integer( idx ) );
@@ -252,38 +254,38 @@ public class TestSnapshotBTree
                     this.readWriteActions();
                 }
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            catch( InterruptedException e )
+            catch ( InterruptedException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            
+
         }
     } // end of class BasicTestThread
-    
-    
+
+
     @Test
     public void testLongBrowsing() throws IOException, InterruptedException
     {
         RecordManager recman;
         BTree<Integer, IntWrapper> tree;
         int numElements = 10000;
-      
+
         int idx;
         int numReadThreads = 4;
         LongBrowsingTestThread readThreads[] = new LongBrowsingTestThread[numReadThreads];
         LongBrowsingTestThread updateThread;
-        
+
         recman = RecordManagerFactory.createRecordManager( getTemporaryFile( "testLongBrowsing" ) );
         SnapshotRecordManager snapshotRecman = new SnapshotRecordManager( recman, 1 << 10 );
-        
+
         tree = new BTree<Integer, IntWrapper>( snapshotRecman, new IntegerComparator() );
-     
+
         for ( idx = 0; idx < numElements; idx++ )
         {
             tree.insert( new Integer( idx ), new IntWrapper( 0 ), true );
@@ -291,41 +293,40 @@ public class TestSnapshotBTree
 
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
-            readThreads[idx] = new LongBrowsingTestThread( true, tree, numElements);
+            readThreads[idx] = new LongBrowsingTestThread( true, tree, numElements );
         }
-        updateThread = new LongBrowsingTestThread( false, tree, numElements );      
-        
-        
+        updateThread = new LongBrowsingTestThread( false, tree, numElements );
+
         readThreads[0].start();
-        
+
         Thread.sleep( 10 );
-        
+
         updateThread.start();
-        
+
         for ( idx = 1; idx < numReadThreads; idx++ )
         {
             Thread.sleep( 1000 );
             readThreads[idx].start();
         }
-        
+
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
             readThreads[idx].join();
         }
-        
+
         updateThread.join();
-        
+
         snapshotRecman.close();
     }
-    
+
     class LongBrowsingTestThread extends Thread
     {
         boolean readOnly;
         BTree<Integer, IntWrapper> btree;
         int numElements;
-       
-        
-        LongBrowsingTestThread( boolean readOnly, BTree<Integer, IntWrapper> btree, int numElements)
+
+
+        LongBrowsingTestThread( boolean readOnly, BTree<Integer, IntWrapper> btree, int numElements )
         {
             this.readOnly = readOnly;
             this.btree = btree;
@@ -333,47 +334,46 @@ public class TestSnapshotBTree
         }
 
 
-
         private void readOnlyActions() throws IOException, InterruptedException
         {
             int count = 0;
             TupleBrowser<Integer, IntWrapper> browser = btree.browse();
             Tuple<Integer, IntWrapper> tuple = new Tuple();
-           
+
             assertTrue( browser.getNext( tuple ) );
             int max = tuple.getValue().value;
             count++;
-            System.out.println( " TestLongBrowsing read thread min key is"  + tuple.getKey() + "max value is" + max );
-            
-            while( browser.getNext( tuple ) )
+            System.out.println( " TestLongBrowsing read thread min key is" + tuple.getKey() + "max value is" + max );
+
+            while ( browser.getNext( tuple ) )
             {
                 count++;
 
                 // Sleep for a while to keep browsing long                                                                                                                                                               
                 Thread.sleep( 10 );
 
-                
                 if ( tuple.getValue().value > max )
                 {
-                    System.out.println(" tupe value:" + tuple.getValue().value + " Expected max:" + max + " count:" + count);
-                    
+                    System.out.println( " tupe value:" + tuple.getValue().value + " Expected max:" + max + " count:"
+                        + count );
+
                 }
-                
+
                 assertTrue( tuple.getValue().value <= max );
-                
-            }
 
+            }
 
             System.out.println( "TestLongBrowsing read thread count is " + count );
             assertEquals( count, numElements );
             browser.close();
         }
-        
+
+
         private void readWriteActions()
         {
             int idx;
             Random updateRandomizer = new Random();
-            
+
             try
             {
                 for ( idx = 1; idx < 100; idx++ )
@@ -382,23 +382,23 @@ public class TestSnapshotBTree
                     IntWrapper value = btree.find( key );
                     value.value = idx;
                     btree.insert( key, value, true );
-                    
+
                     for ( int updates = 0; updates < 2048; updates++ )
                     {
                         key = new Integer( updateRandomizer.nextInt( numElements ) );
                         value = btree.find( key );
-                        
+
                         assertTrue( value.value <= idx );
-                        
+
                         value.value = idx;
                         btree.insert( key, value, true );
                     }
                 }
-                
+
                 System.out.println( "TestLongBrowsing updates ended" );
-            
+
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
@@ -419,41 +419,40 @@ public class TestSnapshotBTree
                     this.readWriteActions();
                 }
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            catch( InterruptedException e )
+            catch ( InterruptedException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            
+
         }
     } // end of class LongBrowsingTestThread
-    
-    
-    
+
+
     @Test
     public void testRemoveInsert() throws IOException, InterruptedException
     {
         RecordManager recman;
         BTree<Integer, IntWrapper> tree;
         int numElements = 10000;
-      
+
         int idx;
         int numReadThreads = 4;
         RemoveInsertTestThread readThreads[] = new RemoveInsertTestThread[numReadThreads];
         RemoveInsertTestThread updateThread;
-        
+
         Semaphore browseSem = new Semaphore( 0 );
-        
+
         recman = RecordManagerFactory.createRecordManager( getTemporaryFile( "testRemoveInsert" ) );
         SnapshotRecordManager snapshotRecman = new SnapshotRecordManager( recman, 1 << 12 );
-        
+
         tree = new BTree<Integer, IntWrapper>( snapshotRecman, new IntegerComparator() );
-     
+
         for ( idx = 0; idx < numElements; idx++ )
         {
             tree.insert( new Integer( idx ), new IntWrapper( 0 ), true );
@@ -463,28 +462,25 @@ public class TestSnapshotBTree
         {
             readThreads[idx] = new RemoveInsertTestThread( true, tree, numElements, browseSem, numReadThreads );
         }
-        updateThread = new RemoveInsertTestThread( false, tree, numElements, browseSem, numReadThreads );      
-        
-        
+        updateThread = new RemoveInsertTestThread( false, tree, numElements, browseSem, numReadThreads );
+
         updateThread.start();
-        
+
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
             Thread.sleep( 1000 );
             readThreads[idx].start();
         }
-        
+
         for ( idx = 0; idx < numReadThreads; idx++ )
         {
             readThreads[idx].join();
         }
         updateThread.join();
-        
+
         snapshotRecman.close();
     }
-    
-    
-    
+
     class RemoveInsertTestThread extends Thread
     {
         boolean readOnly;
@@ -492,8 +488,10 @@ public class TestSnapshotBTree
         int numElements;
         Semaphore browseSem;
         int numReadThreads;
-        
-        RemoveInsertTestThread( boolean readOnly, BTree<Integer, IntWrapper> btree, int numElements,  Semaphore browseSem, int numReadThreads )
+
+
+        RemoveInsertTestThread( boolean readOnly, BTree<Integer, IntWrapper> btree, int numElements,
+            Semaphore browseSem, int numReadThreads )
         {
             this.readOnly = readOnly;
             this.btree = btree;
@@ -502,83 +500,82 @@ public class TestSnapshotBTree
             this.numReadThreads = numReadThreads;
         }
 
+
         private void readOnlyActions() throws IOException, InterruptedException
         {
             int count = 0;
             TupleBrowser<Integer, IntWrapper> browser = btree.browse();
             Tuple<Integer, IntWrapper> tuple = new Tuple();
-           
+
             browseSem.release();
-            
-            while( browser.getNext( tuple ) )
+
+            while ( browser.getNext( tuple ) )
             {
                 count++;
 
                 // Sleep for a while to keep browsing long                                                                                                                                                               
                 Thread.sleep( 10 );
 
-                
                 if ( tuple.getValue().value == -1 )
                 {
-                    System.out.println(" tupe key:" + tuple.getKey() + " value:" + tuple.getValue().value);
-                    
+                    System.out.println( " tupe key:" + tuple.getKey() + " value:" + tuple.getValue().value );
+
                 }
-                
+
                 assertTrue( tuple.getValue().value != -1 );
             }
 
-
             System.out.println( "TestRemoveInsert read thread count is " + count );
             assertEquals( count, numElements );
             browser.close();
         }
-        
+
+
         private void readWriteActions() throws IOException, InterruptedException
         {
             int idx;
             Random updateRandomizer = new Random();
-            
+
             for ( idx = 0; idx < numReadThreads; idx++ )
             {
                 browseSem.acquireUninterruptibly();
             }
-            
-          
+
             Integer key;
             IntWrapper value = new IntWrapper( -1 );
-            
+
             for ( idx = 0; idx < 10; idx++ )
             {
                 Thread.sleep( 10000 );
-                
+
                 int startingIndex = updateRandomizer.nextInt( numElements );
-                
+
                 for ( int updates = 0; updates < 32; updates++ )
-                {                    
+                {
                     key = new Integer( startingIndex + updates );
-                    
+
                     if ( key.intValue() >= numElements )
                     {
                         break;
-                    }   
-                        
+                    }
+
                     btree.remove( key );
                 }
-                
+
                 for ( int updates = 0; updates < 32; updates++ )
                 {
                     key = new Integer( startingIndex + updates );
                     btree.insert( key, value, true );
                 }
             }
-            
+
             System.out.println( "TestRemoveInsert updates ended" );
-            
+
         }
 
 
         public void run()
-        {         
+        {
             try
             {
                 if ( readOnly )
@@ -590,18 +587,17 @@ public class TestSnapshotBTree
                     this.readWriteActions();
                 }
             }
-            catch( IOException e )
+            catch ( IOException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            catch( InterruptedException e )
+            catch ( InterruptedException e )
             {
                 e.printStackTrace();
                 assertTrue( false );
             }
-            
-            
+
         }
     } // end of class RemoveInsertTestThread
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestStreamCorrupted.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestStreamCorrupted.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestStreamCorrupted.java (original)
+++ directory/apacheds/trunk/jdbm/src/test/java/jdbm/btree/TestStreamCorrupted.java Tue Jan 24 16:15:05 2012
@@ -56,6 +56,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
+
 /**
  * Contributed test case for BTree by Christof Dallermassl (cdaller@iicm.edu):
  *
@@ -123,13 +124,13 @@ public class TestStreamCorrupted
 
         // action:
         // insert data
-        for( int count = 0; count < iterations; count++ ) 
+        for ( int count = 0; count < iterations; count++ )
         {
             btree.insert( "num" + count, Integer.valueOf( count ), true );
         }
 
         // delete data
-        for( int count = 0; count < iterations; count++ ) 
+        for ( int count = 0; count < iterations; count++ )
         {
             btree.remove( "num" + count );
         }

Modified: directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java (original)
+++ directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestActionVersioning.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
  */
 package jdbm.helper;
 
+
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
@@ -27,6 +28,7 @@ import org.junit.runner.RunWith;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
+
 /**
  * 
  * TODO TestActionVersioning.
@@ -43,35 +45,35 @@ public class TestActionVersioning
         ActionVersioning.Version version1, version2;
         ActionVersioning.Version writeVersion;
         ActionVersioning.Version minVersion;
-        
+
         ActionVersioning versioning = new ActionVersioning();
         version1 = versioning.beginReadAction();
-        assertEquals( version1.getVersion(),  0 );
-        
-        writeVersion = versioning.beginWriteAction();      
+        assertEquals( version1.getVersion(), 0 );
+
+        writeVersion = versioning.beginWriteAction();
         assertEquals( writeVersion.getVersion(), 1 );
-        
+
         version2 = versioning.beginReadAction();
         assertEquals( version2.getVersion(), 0 );
-        
+
         minVersion = versioning.endWriteAction();
         assertEquals( minVersion.getVersion(), 0 );
-        
+
         writeVersion = versioning.beginWriteAction();
         assertEquals( writeVersion.getVersion(), 2 );
-        
+
         minVersion = versioning.endWriteAction();
         assertEquals( minVersion.getVersion(), 0 );
-        
+
         versioning.endReadAction( version1 );
         minVersion = versioning.endReadAction( version2 );
         assertEquals( minVersion.getVersion(), 2 );
-        
-        version1  = versioning.beginReadAction();
+
+        version1 = versioning.beginReadAction();
         assertEquals( version1.getVersion(), 2 );
-        
+
         minVersion = versioning.endReadAction( version1 );
         assertEquals( minVersion, null );
-        
+
     }
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java (original)
+++ directory/apacheds/trunk/jdbm/src/test/java/jdbm/helper/TestVersionedCache.java Tue Jan 24 16:15:05 2012
@@ -30,6 +30,7 @@ import org.junit.runner.RunWith;
 import com.mycila.junit.concurrent.Concurrency;
 import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 
+
 /**
  * 
  * TODO TestVersionedCache.
@@ -42,40 +43,40 @@ public class TestVersionedCache
 {
     private int expectedSum;
     static final int THREAD_NUMBER = 5;
-    
-    
+
+
     @Test
     public void testBasics() throws IOException, CacheEvictionException
     {
         int idx;
         int numEntries = 1024;
         Integer intsArray[] = new Integer[numEntries];
-        
-        for ( idx = 0; idx < numEntries; idx++  )
+
+        for ( idx = 0; idx < numEntries; idx++ )
         {
             intsArray[idx] = new Integer( 1 );
         }
-        
-        ArrayEntryIO arrayIO = new ArrayEntryIO(intsArray);
-        
+
+        ArrayEntryIO arrayIO = new ArrayEntryIO( intsArray );
+
         LRUCache<Integer, Integer> cache = new LRUCache<Integer, Integer>( arrayIO, numEntries );
-        
-        Integer val = cache.get( new Integer ( 5 ), 0, null );
+
+        Integer val = cache.get( new Integer( 5 ), 0, null );
         assertEquals( val.intValue(), 1 );
-        
-        val = cache.get( new Integer ( 20 ), 0, null );
+
+        val = cache.get( new Integer( 20 ), 0, null );
         assertEquals( val.intValue(), 1 );
-        
-        cache.put( new Integer(1), 2, 1, null, false );
-        cache.put( new Integer(5), 2, 1, null, false );
-        cache.put( new Integer(30), 2, 1, null, false );
-        
+
+        cache.put( new Integer( 1 ), 2, 1, null, false );
+        cache.put( new Integer( 5 ), 2, 1, null, false );
+        cache.put( new Integer( 30 ), 2, 1, null, false );
+
         int sum = 0;
         for ( idx = 0; idx < numEntries; idx++ )
         {
             sum += cache.get( new Integer( idx ), 0, null ).intValue();
         }
-        
+
         assertEquals( sum, numEntries );
 
         sum = 0;
@@ -84,30 +85,31 @@ public class TestVersionedCache
         {
             sum += cache.get( new Integer( idx ), 1, null ).intValue();
         }
-        
-        System.out.println( "Sum is: "+ sum);
+
+        System.out.println( "Sum is: " + sum );
         assertEquals( sum, ( numEntries + 3 ) );
-        
+
     }
-    
+
+
     @Test
     public void testMultiThreadedAccess() throws IOException, CacheEvictionException
     {
         int idx;
         int numEntries = 1024;
         Integer intsArray[] = new Integer[numEntries];
-        
-        for ( idx = 0; idx < numEntries; idx++  )
+
+        for ( idx = 0; idx < numEntries; idx++ )
         {
             intsArray[idx] = new Integer( 1 );
         }
-        
-        ArrayEntryIO arrayIO = new ArrayEntryIO(intsArray, 10, 20);
-        
+
+        ArrayEntryIO arrayIO = new ArrayEntryIO( intsArray, 10, 20 );
+
         LRUCache<Integer, Integer> cache = new LRUCache<Integer, Integer>( arrayIO, numEntries );
-        
-        TestThread[] threadPool =  new TestThread[THREAD_NUMBER];
-    
+
+        TestThread[] threadPool = new TestThread[THREAD_NUMBER];
+
         // create content for the tree, different content for different threads!
         for ( int threadCount = 0; threadCount < THREAD_NUMBER; threadCount++ )
         {
@@ -115,7 +117,7 @@ public class TestVersionedCache
                 threadPool[threadCount] = new TestThread( false, intsArray, cache );
             else
                 threadPool[threadCount] = new TestThread( true, intsArray, cache );
-                
+
             threadPool[threadCount].start();
         }
 
@@ -131,39 +133,40 @@ public class TestVersionedCache
         {
             ignore.printStackTrace();
         }
-        
+
         int sum = 0;
-        cache.advanceMinReadVersion( 2 );        
+        cache.advanceMinReadVersion( 2 );
         for ( idx = 0; idx < intsArray.length; idx++ )
         {
             sum += cache.get( new Integer( idx ), 2, null ).intValue();
         }
-        
+
         assertEquals( sum, expectedSum );
-        
 
     }
-    
-    
+
     private class ArrayEntryIO implements EntryIO<Integer, Integer>
     {
         Integer intsArray[];
         int readSleepTime;
         int writeSleepTime;
-        
+
+
         public ArrayEntryIO( Integer intsArray[] )
         {
             this.intsArray = intsArray;
         }
-        
+
+
         public ArrayEntryIO( Integer intsArray[], int readSleepTIme, int writeSleepTime )
         {
             this.intsArray = intsArray;
             this.readSleepTime = readSleepTime;
             this.writeSleepTime = writeSleepTime;
         }
-        
-        public Integer read( Integer key, Serializer serializer) throws IOException
+
+
+        public Integer read( Integer key, Serializer serializer ) throws IOException
         {
             if ( readSleepTime != 0 )
             {
@@ -176,10 +179,11 @@ public class TestVersionedCache
                     // ignore
                 }
             }
-            
+
             return intsArray[key.intValue()];
         }
-        
+
+
         public void write( Integer key, Integer value, Serializer serializer ) throws IOException
         {
             if ( writeSleepTime != 0 )
@@ -193,19 +197,19 @@ public class TestVersionedCache
                     // ignore
                 }
             }
-            
+
             intsArray[key.intValue()] = value;
         }
     }
-    
-    
+
     class TestThread extends Thread
     {
         boolean readOnly;
         Integer intsArray[];
         LRUCache<Integer, Integer> cache;
 
-        TestThread( boolean readOnly, Integer intsArray[] , LRUCache<Integer, Integer> cache)
+
+        TestThread( boolean readOnly, Integer intsArray[], LRUCache<Integer, Integer> cache )
         {
             this.readOnly = readOnly;
             this.intsArray = intsArray;
@@ -213,42 +217,41 @@ public class TestVersionedCache
         }
 
 
-
         private void action() throws IOException, CacheEvictionException
         {
             int idx;
             int sum = 0;
             if ( readOnly )
             {
-               
+
                 for ( idx = 0; idx < intsArray.length; idx++ )
                 {
                     sum += cache.get( new Integer( idx ), 0, null ).intValue();
                 }
-                
+
                 assertEquals( sum, intsArray.length );
             }
             else
             {
                 expectedSum = intsArray.length;
-                
-                for ( idx = 0; idx <= intsArray.length; idx = idx + 100)
+
+                for ( idx = 0; idx <= intsArray.length; idx = idx + 100 )
                 {
                     cache.put( new Integer( idx ), 2, 1, null, false );
                     expectedSum = expectedSum + 1;
                 }
-                
-                for ( idx = 0; idx <= intsArray.length; idx = idx + 100)
+
+                for ( idx = 0; idx <= intsArray.length; idx = idx + 100 )
                 {
                     cache.put( new Integer( idx ), 3, 2, null, false );
                     expectedSum = expectedSum + 1;
                 }
-                
+
                 for ( idx = 0; idx < intsArray.length; idx++ )
                 {
                     sum += cache.get( new Integer( idx ), 2, null ).intValue();
                 }
-                
+
                 assertEquals( sum, expectedSum );
             }
         }
@@ -260,10 +263,10 @@ public class TestVersionedCache
             {
                 this.action();
             }
-            catch ( IOException e)
+            catch ( IOException e )
             {
             }
-            catch ( CacheEvictionException e)
+            catch ( CacheEvictionException e )
             {
             }
         }

Modified: directory/apacheds/trunk/jdbm/src/test/java/jdbm/recman/BlockIoTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/test/java/jdbm/recman/BlockIoTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm/src/test/java/jdbm/recman/BlockIoTest.java (original)
+++ directory/apacheds/trunk/jdbm/src/test/java/jdbm/recman/BlockIoTest.java Tue Jan 24 16:15:05 2012
@@ -19,45 +19,48 @@
  */
 package jdbm.recman;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
 import org.junit.Before;
 import org.junit.Test;
 
+
 public class BlockIoTest
 {
     BlockIo blockIo;
     BlockIo blockIoData;
-    
+
+
     @Before
     public void init()
     {
         blockIo = new BlockIo( 0L, new byte[1024] );
-        
+
         // Init the blockIo with 1024 bytes from 0x00 to 0xFF, 4 times
         for ( int i = 0; i < 1024; i++ )
         {
-            blockIo.writeByte( i, (byte)( i & 0x00fff ) );
+            blockIo.writeByte( i, ( byte ) ( i & 0x00fff ) );
         }
-        
+
         blockIoData = new BlockIo( 0L, new byte[1024] );
         blockIoData.writeLong( 0, 0x8081828384858687L );
         blockIoData.writeInt( 8, 0x000000ff );
-        
+
         for ( int i = 0; i < 256; i++ )
         {
-            blockIoData.writeByte( 12+i, (byte)0x80 );
+            blockIoData.writeByte( 12 + i, ( byte ) 0x80 );
         }
     }
 
-    
+
     @Test
     public void testReadByte()
     {
-        assertEquals( (byte)0x00, blockIo.readByte( 0 ) );
-        assertEquals( (byte)0xff, blockIo.readByte( 1023 ) );
-        
+        assertEquals( ( byte ) 0x00, blockIo.readByte( 0 ) );
+        assertEquals( ( byte ) 0xff, blockIo.readByte( 1023 ) );
+
         try
         {
             blockIo.readByte( -1 );
@@ -67,7 +70,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readByte( 1024 );
@@ -79,7 +82,7 @@ public class BlockIoTest
         }
     }
 
-    
+
     @Test
     public void testReadInt()
     {
@@ -91,7 +94,7 @@ public class BlockIoTest
         assertEquals( 0x80818283, blockIo.readInt( 128 ) );
         assertEquals( 0xfbfcfdfe, blockIo.readInt( 1019 ) );
         assertEquals( 0xfcfdfeff, blockIo.readInt( 1020 ) );
-        
+
         try
         {
             blockIo.readInt( -1 );
@@ -101,7 +104,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readInt( 1021 );
@@ -111,7 +114,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readInt( 1024 );
@@ -123,7 +126,7 @@ public class BlockIoTest
         }
     }
 
-    
+
     @Test
     public void testReadShort()
     {
@@ -132,10 +135,10 @@ public class BlockIoTest
         assertEquals( 0x7d7e, blockIo.readShort( 125 ) );
         assertEquals( 0x7e7f, blockIo.readShort( 126 ) );
         assertEquals( 0x7f80, blockIo.readShort( 127 ) );
-        assertEquals( (short)0x8081, blockIo.readShort( 128 ) );
-        assertEquals( (short)0xfdfe, blockIo.readShort( 1021 ) );
-        assertEquals( (short)0xfeff, blockIo.readShort( 1022 ) );
-        
+        assertEquals( ( short ) 0x8081, blockIo.readShort( 128 ) );
+        assertEquals( ( short ) 0xfdfe, blockIo.readShort( 1021 ) );
+        assertEquals( ( short ) 0xfeff, blockIo.readShort( 1022 ) );
+
         try
         {
             blockIo.readShort( -1 );
@@ -145,7 +148,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readShort( 1023 );
@@ -155,7 +158,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readShort( 1024 );
@@ -167,7 +170,7 @@ public class BlockIoTest
         }
     }
 
-    
+
     @Test
     public void testReadLong()
     {
@@ -183,7 +186,7 @@ public class BlockIoTest
         assertEquals( 0x8081828384858687L, blockIo.readLong( 128 ) );
         assertEquals( 0xf7f8f9fafbfcfdfeL, blockIo.readLong( 1015 ) );
         assertEquals( 0xf8f9fafbfcfdfeffL, blockIo.readLong( 1016 ) );
-        
+
         try
         {
             blockIo.readLong( -1 );
@@ -193,7 +196,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readLong( 1017 );
@@ -203,7 +206,7 @@ public class BlockIoTest
         {
             // Expected
         }
-        
+
         try
         {
             blockIo.readLong( 1024 );

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosDecoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosDecoder.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosDecoder.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosDecoder.java Tue Jan 24 16:15:05 2012
@@ -85,12 +85,14 @@ public class KerberosDecoder extends Pro
 
     /** the key used while storing message container in the session */
     private static final String KERBEROS_MESSAGE_CONTAINER = "kerberosMessageContainer";
-    
+
+
     public void decode( IoSession session, IoBuffer in, ProtocolDecoderOutput out ) throws IOException
     {
         ByteBuffer buf = in.buf();
-        KerberosMessageContainer kerberosMessageContainer = ( KerberosMessageContainer ) session.getAttribute( KERBEROS_MESSAGE_CONTAINER );
-        
+        KerberosMessageContainer kerberosMessageContainer = ( KerberosMessageContainer ) session
+            .getAttribute( KERBEROS_MESSAGE_CONTAINER );
+
         if ( kerberosMessageContainer == null )
         {
             kerberosMessageContainer = new KerberosMessageContainer();
@@ -99,7 +101,7 @@ public class KerberosDecoder extends Pro
             kerberosMessageContainer.setGathering( true );
             kerberosMessageContainer.setTCP( !session.getTransportMetadata().isConnectionless() );
         }
-        
+
         if ( kerberosMessageContainer.isTCP() )
         {
             if ( buf.remaining() > 4 )
@@ -122,7 +124,7 @@ public class KerberosDecoder extends Pro
             try
             {
                 asn1Decoder.decode( buf, kerberosMessageContainer );
-                
+
                 if ( kerberosMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
                     if ( IS_DEBUG )
@@ -130,9 +132,9 @@ public class KerberosDecoder extends Pro
                         LOG.debug( "Decoded KerberosMessage : " + kerberosMessageContainer.getMessage() );
                         buf.mark();
                     }
-        
+
                     out.write( kerberosMessageContainer.getMessage() );
-        
+
                     kerberosMessageContainer.clean();
                 }
             }
@@ -147,8 +149,8 @@ public class KerberosDecoder extends Pro
             }
         }
     }
-    
-    
+
+
     /**
      * Decode an EncrytedData structure
      * 
@@ -161,7 +163,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncryptedData Container
         Asn1Container encryptedDataContainer = new EncryptedDataContainer();
 
@@ -182,8 +184,8 @@ public class KerberosDecoder extends Pro
 
         return encryptedData;
     }
-    
-    
+
+
     /**
      * Decode an PaEncTsEnc structure
      * 
@@ -196,7 +198,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a PaEncTsEnc Container
         Asn1Container paEncTsEncContainer = new PaEncTsEncContainer();
 
@@ -217,8 +219,8 @@ public class KerberosDecoder extends Pro
 
         return paEncTsEnc;
     }
-    
-    
+
+
     /**
      * Decode an EncApRepPart structure
      * 
@@ -231,7 +233,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncApRepPart Container
         Asn1Container encApRepPartContainer = new EncApRepPartContainer( stream );
 
@@ -252,8 +254,8 @@ public class KerberosDecoder extends Pro
 
         return encApRepPart;
     }
-    
-    
+
+
     /**
      * Decode an EncKdcRepPart structure
      * 
@@ -266,7 +268,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncKdcRepPart Container
         Asn1Container encKdcRepPartContainer = new EncKdcRepPartContainer( stream );
 
@@ -287,8 +289,8 @@ public class KerberosDecoder extends Pro
 
         return encKdcRepPart;
     }
-    
-    
+
+
     /**
      * Decode an EncKrbPrivPart structure
      * 
@@ -301,7 +303,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncKrbPrivPart Container
         Asn1Container encKrbPrivPartContainer = new EncKrbPrivPartContainer( stream );
 
@@ -322,8 +324,8 @@ public class KerberosDecoder extends Pro
 
         return encKrbPrivPart;
     }
-    
-    
+
+
     /**
      * Decode an EncTicketPart structure
      * 
@@ -336,7 +338,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncTicketPart Container
         Asn1Container encTicketPartContainer = new EncTicketPartContainer( stream );
 
@@ -357,8 +359,8 @@ public class KerberosDecoder extends Pro
 
         return encTicketPart;
     }
-    
-    
+
+
     /**
      * Decode an EncryptionKey structure
      * 
@@ -371,7 +373,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncryptionKey Container
         Asn1Container encryptionKeyContainer = new EncryptionKeyContainer();
 
@@ -392,8 +394,8 @@ public class KerberosDecoder extends Pro
 
         return encryptionKey;
     }
-    
-    
+
+
     /**
      * Decode an PrincipalName structure
      * 
@@ -406,7 +408,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a PrincipalName Container
         Asn1Container principalNameContainer = new PrincipalNameContainer();
 
@@ -427,8 +429,8 @@ public class KerberosDecoder extends Pro
 
         return principalName;
     }
-    
-    
+
+
     /**
      * Decode a Ticket structure
      * 
@@ -441,7 +443,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a Ticket Container
         Asn1Container ticketContainer = new TicketContainer( stream );
 
@@ -462,8 +464,8 @@ public class KerberosDecoder extends Pro
 
         return ticket;
     }
-    
-    
+
+
     /**
      * Decode a Authenticator structure
      * 
@@ -476,7 +478,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a Authenticator Container
         Asn1Container authenticatorContainer = new AuthenticatorContainer( stream );
 
@@ -497,8 +499,8 @@ public class KerberosDecoder extends Pro
 
         return authenticator;
     }
-    
-    
+
+
     /**
      * Decode a AuthorizationData structure
      * 
@@ -511,7 +513,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a AuthorizationData Container
         Asn1Container authorizationDataContainer = new AuthorizationDataContainer();
 
@@ -528,12 +530,13 @@ public class KerberosDecoder extends Pro
         }
 
         // get the decoded AuthorizationData
-        AuthorizationData authorizationData = ( ( AuthorizationDataContainer ) authorizationDataContainer ).getAuthorizationData();
+        AuthorizationData authorizationData = ( ( AuthorizationDataContainer ) authorizationDataContainer )
+            .getAuthorizationData();
 
         return authorizationData;
     }
 
-    
+
     /**
      * Decode a AP-REP structure
      * 
@@ -546,7 +549,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a ApRep Container
         Asn1Container apRepContainer = new ApRepContainer( stream );
 
@@ -568,7 +571,7 @@ public class KerberosDecoder extends Pro
         return apRep;
     }
 
-    
+
     /**
      * Decode a AP-REQ structure
      * 
@@ -581,7 +584,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a ApReq Container
         Asn1Container apReqContainer = new ApReqContainer( stream );
 
@@ -603,7 +606,7 @@ public class KerberosDecoder extends Pro
         return apReq;
     }
 
-    
+
     /**
      * Decode a KRB-PRIV structure
      * 
@@ -616,7 +619,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a KrbPriv Container
         Asn1Container krbPrivContainer = new KrbPrivContainer( stream );
 
@@ -637,8 +640,8 @@ public class KerberosDecoder extends Pro
 
         return krbPriv;
     }
-    
-    
+
+
     /**
      * Decode an EncAsRepPart structure
      * 
@@ -651,7 +654,7 @@ public class KerberosDecoder extends Pro
         ByteBuffer stream = ByteBuffer.allocate( data.length );
         stream.put( data );
         stream.flip();
-        
+
         // Allocate a EncAsRepPart Container
         Asn1Container encAsRepPartContainer = new EncAsRepPartContainer( stream );
 

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosEncoder.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosEncoder.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/protocol/codec/KerberosEncoder.java Tue Jan 24 16:15:05 2012
@@ -41,10 +41,10 @@ public class KerberosEncoder extends Pro
         boolean isTcp = !session.getTransportMetadata().isConnectionless();
         IoBuffer response = null;
         IoBuffer kerberosMessage = null;
-        
+
         int responseLength = asn1Obj.computeLength();
         kerberosMessage = IoBuffer.allocate( responseLength );
-        
+
         if ( isTcp )
         {
             response = IoBuffer.allocate( responseLength + 4 );
@@ -59,7 +59,7 @@ public class KerberosEncoder extends Pro
             asn1Obj.encode( kerberosMessage.buf() );
 
             if ( isTcp )
-            { 
+            {
                 response.putInt( responseLength );
                 response.put( kerberosMessage.buf().array() );
             }
@@ -68,9 +68,9 @@ public class KerberosEncoder extends Pro
 
             out.write( response );
         }
-        catch( EncoderException e )
+        catch ( EncoderException e )
         {
-            throw new IOException(e.getMessage());
+            throw new IOException( e.getMessage() );
         }
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/package-info.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/package-info.java (original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/package-info.java Tue Jan 24 16:15:05 2012
@@ -25,3 +25,5 @@
  */
 
 package org.apache.directory.server.kerberos.shared.crypto.checksum;
+
+



Mime
View raw message