-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 06/07/10 17:20, [email protected] wrote: > Author: elecharny > Date: Mon Jun 7 15:20:46 2010 > New Revision: 952265 > > URL: http://svn.apache.org/viewvc?rev=952265&view=rev > Log: > Reverted a wrong check on the keySerializer. > > Modified: > directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java > > Modified: directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java > URL: > http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java?rev=952265&r1=952264&r2=952265&view=diff > ============================================================================== > --- directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java > (original) > +++ directory/apacheds/trunk/jdbm/src/main/java/jdbm/btree/BTree.java Mon Jun > 7 15:20:46 2010 > @@ -55,13 +55,13 @@ import java.io.Serializable; > import java.util.Comparator; > import java.util.concurrent.atomic.AtomicInteger; > > -import org.apache.directory.server.i18n.I18n; > - > import jdbm.RecordManager; > import jdbm.helper.Serializer; > import jdbm.helper.Tuple; > import jdbm.helper.TupleBrowser; > > +import org.apache.directory.server.i18n.I18n; > + > > /** > * B+Tree persistent indexing data structure. B+Trees are optimized for > @@ -206,12 +206,12 @@ public class BTree<K, V> implements Exte > throw new IllegalArgumentException( I18n.err( I18n.ERR_519 ) ); > } > > - if ( keySerializer != null ) > + if ( ( keySerializer != null ) && ! ( keySerializer instanceof > Serializable ) ) > { > throw new IllegalArgumentException( I18n.err( I18n.ERR_520 ) ); > } > > - if ( valueSerializer != null && !( valueSerializer instanceof > Serializable ) ) > + if ( ( valueSerializer != null ) && !( valueSerializer instanceof > Serializable ) ) > { > throw new IllegalArgumentException( I18n.err( I18n.ERR_521 ) ); > }
IMO this doesn't solves the problem doing the instanceOf check. The method params are declared as jdbm.helper.Serializer which extends Serializable. Therefore keySerializer and valueSerializer must be instance of Serializable in the if restriction. If they can be instanceOf anything else the method footprint needs to be changed for not getting an IllegalArgument exception? > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwNEnAACgkQ2lZVCB08qHEj6ACgnS2X2ftiyvJAe4ADWxWxhf+j ubcAoJ7nRUC+lf/XCIW0feX3McFKo6jZ =2KCh -----END PGP SIGNATURE-----
