You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/09/15 09:14:17 UTC
svn commit: r695361 - in /directory/apacheds/trunk/jdbm-store/src:
main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
Author: elecharny
Date: Mon Sep 15 00:14:17 2008
New Revision: 695361
URL: http://svn.apache.org/viewvc?rev=695361&view=rev
Log:
Partiatlly applied patch for DIRSERVER-1255
Modified:
directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
Modified: directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=695361&r1=695360&r2=695361&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Mon Sep 15 00:14:17 2008
@@ -155,7 +155,17 @@
base.disableTransactions();
this.recMan = new CacheRecordManager( base, new MRU( cacheSize ) );
- initTables();
+ try
+ {
+ initTables();
+ }
+ catch ( IOException e )
+ {
+ // clean up
+ close();
+ throw e;
+ }
+
initialized = true;
}
@@ -623,8 +633,16 @@
*/
public synchronized void close() throws IOException
{
- forward.close();
- reverse.close();
+ if (forward != null)
+ {
+ forward.close();
+ }
+
+ if (reverse != null)
+ {
+ reverse.close();
+ }
+
recMan.commit();
recMan.close();
}
Modified: directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=695361&r1=695360&r2=695361&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/trunk/jdbm-store/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Mon Sep 15 00:14:17 2008
@@ -143,12 +143,12 @@
public void testAttributeId() throws Exception
{
// uninitialized index
- JdbmIndex jdbmIndex = new JdbmIndex();
- jdbmIndex.setAttributeId( "foo" );
- assertEquals( "foo", jdbmIndex.getAttributeId() );
+ JdbmIndex jdbmIndex1= new JdbmIndex();
+ jdbmIndex1.setAttributeId( "foo" );
+ assertEquals( "foo", jdbmIndex1.getAttributeId() );
- jdbmIndex = new JdbmIndex( "bar" );
- assertEquals( "bar", jdbmIndex.getAttributeId() );
+ JdbmIndex jdbmIndex2 = new JdbmIndex( "bar" );
+ assertEquals( "bar", jdbmIndex2.getAttributeId() );
// initialized index
initIndex();
@@ -568,5 +568,6 @@
{
JdbmIndex jdbmIndex = new JdbmIndex();
jdbmIndex.init( registry.lookup( SchemaConstants.CREATORS_NAME_AT ), dbFileDir );
+ jdbmIndex.close();
}
}