directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1422722 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/api/subtree/ core-api/src/test/java/org/apache/directory/server/core/api/entry/ core-avl/src/test/java/org/apache/directory/server/core/avltree...
Date Mon, 17 Dec 2012 00:19:04 GMT
Author: elecharny
Date: Mon Dec 17 00:19:02 2012
New Revision: 1422722

URL: http://svn.apache.org/viewvc?rev=1422722&view=rev
Log:
o Deleted some unused classes
o Removed unused code
o Closed some streams
o Fixed some warnings (improper Generic) 
o Used a MINA class to find an available port
o 

Removed:
    directory/apacheds/trunk/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/DummyAttributeTypeRegistry.java
    directory/apacheds/trunk/interceptors/authz/src/test/java/org/apache/directory/server/core/authz/support/DummyOidRegistry.java
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java
    directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
    directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
    directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
    directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
    directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
    directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
    directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
    directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
    directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubtreeEvaluator.java
Mon Dec 17 00:19:02 2012
@@ -80,8 +80,6 @@ public class SubtreeEvaluator
         Dn subentryBaseDn = apDn;
         subentryBaseDn = subentryBaseDn.add( subtree.getBase() );
 
-        String s = subentryBaseDn.toString();
-
         if ( !entryDn.isDescendantOf( subentryBaseDn ) )
         {
             // The entry Dn is not part of the subtree specification, get out

Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
(original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/entry/SchemaAwareEntryTest.java
Mon Dec 17 00:19:02 2012
@@ -762,8 +762,6 @@ public class SchemaAwareEntryTest
         byte[] b3 = Strings.getBytesUtf8( "test3" );
 
         Value<String> test1 = new StringValue( atDC, "test1" );
-        Value<String> test2 = new StringValue( atDC, "test2" );
-        Value<String> test3 = new StringValue( atDC, "test3" );
 
         Value<String> testEMail1 = new StringValue( atEMail, "test1" );
         Value<String> testEMail2 = new StringValue( atEMail, "test2" );

Modified: directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
(original)
+++ directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMapTest.java
Mon Dec 17 00:19:02 2012
@@ -165,7 +165,6 @@ public class AvlTreeMapTest
     }
 
 
-    @SuppressWarnings("unchecked")
     @Test
     public void testDuplicateKeyInsert()
     {
@@ -183,12 +182,12 @@ public class AvlTreeMapTest
         assertTrue( 1 == tree.insert( 3, 1 ) );// should be ignored
         assertTrue( 1 == tree.getSize() );
 
-        LinkedAvlMapNode node = tree.find( 3 );
+        LinkedAvlMapNode<Integer, Integer> node = tree.find( 3 );
         assertNotNull( node );
 
         assertTrue( node.value.getOrderedSet().getClass() == AvlTreeImpl.class );
 
-        AvlTree dupsTree = ( ( SingletonOrOrderedSet ) node.value ).getOrderedSet();
+        AvlTree<Integer> dupsTree = ( ( SingletonOrOrderedSet<Integer> ) node.value
).getOrderedSet();
         assertEquals( 3, dupsTree.getSize() );
     }
 

Modified: directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
(original)
+++ directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeMarshallerTest.java
Mon Dec 17 00:19:02 2012
@@ -437,6 +437,8 @@ public class AvlTreeMarshallerTest
 
         byte[] data = new byte[( int ) treeFile.length()];
         fin.read( data );
+        
+        fin.close();
 
         AvlTree<Integer> unmarshalledTree = treeMarshaller.deserialize( data );
 

Modified: directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
(original)
+++ directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreePerfTest.java
Mon Dec 17 00:19:02 2012
@@ -33,8 +33,6 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -69,8 +67,6 @@ public class AvlTreePerfTest
 
     AvlTreeMarshaller<Integer> treeMarshaller = new AvlTreeMarshaller<Integer>(
comparator, new IntegerKeyMarshaller() );
 
-    private final static Logger LOG = LoggerFactory.getLogger( AvlTreePerfTest.class );
-
 
     @Before
     public void createTree()
@@ -264,11 +260,12 @@ public class AvlTreePerfTest
 
         start = System.nanoTime();
 
-        set = ( HashSet ) objIn.readObject();
+        set = ( HashSet<Integer> ) objIn.readObject();
 
         end = System.nanoTime();
 
         System.out.println( "total time taken for reconstructing a serialized HashSet ->"
+ getTime( start, end ) );
+        objIn.close();
     }
 
 
@@ -311,6 +308,7 @@ public class AvlTreePerfTest
 
         end = System.nanoTime();
         System.out.println( "total time taken for reconstructing a serialized AVLTree ->"
+ getTime( start, end ) );
+        fin.close();
     }
 
 

Modified: directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
(original)
+++ directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/AvlTreeTest.java
Mon Dec 17 00:19:02 2012
@@ -314,7 +314,7 @@ public class AvlTreeTest
         assertNotNull( tree.find( 11 ) );
         assertNull( tree.find( 0 ) );
 
-        ( ( AvlTreeImpl ) tree ).setRoot( null );
+        ( ( AvlTreeImpl<Integer> ) tree ).setRoot( null );
         assertNull( tree.find( 3 ) );
     }
 

Modified: directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
(original)
+++ directory/apacheds/trunk/core-avl/src/test/java/org/apache/directory/server/core/avltree/avl/AvlTreePerfTest.java
Mon Dec 17 00:19:02 2012
@@ -35,8 +35,6 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -71,8 +69,6 @@ public class AvlTreePerfTest
 
     AvlTreeMarshaller<Integer> treeMarshaller = new AvlTreeMarshaller<Integer>(
comparator, new IntegerKeyMarshaller() );
 
-    private final static Logger LOG = LoggerFactory.getLogger( AvlTreePerfTest.class );
-
 
     @Before
     public void createTree()
@@ -258,11 +254,12 @@ public class AvlTreePerfTest
 
         start = System.nanoTime();
 
-        set = ( HashSet ) objIn.readObject();
+        set = ( HashSet<Integer> ) objIn.readObject();
 
         end = System.nanoTime();
 
         System.out.println( "total time taken for reconstructing a serialized HashSet ->"
+ getTime( start, end ) );
+        objIn.close();
     }
 
 

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
(original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Mon Dec 17 00:19:02 2012
@@ -73,7 +73,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.util.JndiUtils;
 import org.apache.directory.shared.util.Strings;
 
@@ -565,7 +564,6 @@ public abstract class ServerDirContext e
         }
 
         Dn target = buildTarget( JndiUtils.fromName( name ) );
-        Rdn rdn = target.getRdn();
 
         attrs = AttributeUtils.toCaseInsensitive( attrs );
         Attributes attributes = ( Attributes ) attrs.clone();

Modified: directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
Mon Dec 17 00:19:02 2012
@@ -305,30 +305,6 @@ public class NormalizationInterceptor ex
     }
 
 
-    /**
-     * {@inheritDoc}
-     */
-    private String[] normalizeAttrsId( String[] attrIds ) throws LdapException
-    {
-        if ( attrIds == null )
-        {
-            return attrIds;
-        }
-
-        String[] normalizedAttrIds = new String[attrIds.length];
-        int pos = 0;
-
-        for ( String id : attrIds )
-        {
-            String oid = schemaManager.lookupAttributeTypeRegistry( id ).getOid();
-            
-            normalizedAttrIds[pos++] = oid;
-        }
-
-        return normalizedAttrIds;
-    }
-
-
     // ------------------------------------------------------------------------
     // Normalize all Name based arguments for other interface operations
     // ------------------------------------------------------------------------

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Mon Dec 17 00:19:02 2012
@@ -84,7 +84,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
-import org.apache.directory.shared.ldap.model.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.model.schema.ObjectClass;
 import org.apache.directory.shared.ldap.model.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
@@ -754,7 +753,7 @@ public class SchemaInterceptor extends B
                         if ( ( newAttribute.size() == 0 ) && !newAttribute.isValid(
attributeType ) )
                         {
                             // This is an error.
-                            String msg = I18n.err( I18n.ERR_54, null );
+                            String msg = I18n.err( I18n.ERR_54, (Object[])null );
                             LOG.error( msg );
                             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
msg );
                         }
@@ -866,51 +865,6 @@ public class SchemaInterceptor extends B
 
 
     /**
-     * Filter the attributes by removing the ones which are not allowed
-     */
-    // This will suppress PMD.EmptyCatchBlock warnings in this method
-    @SuppressWarnings("PMD.EmptyCatchBlock")
-    private void filterAttributeTypes( SearchOperationContext operation, Entry result )
-    {
-        if ( operation.getReturningAttributes() == null )
-        {
-            return;
-        }
-
-        for ( AttributeTypeOptions attrOptions : operation.getReturningAttributes() )
-        {
-            Attribute attribute = result.get( attrOptions.getAttributeType() );
-
-            if ( attrOptions.hasOption() )
-            {
-                for ( String option : attrOptions.getOptions() )
-                {
-                    if ( "binary".equalsIgnoreCase( option ) )
-                    {
-                        continue;
-                    }
-                    else
-                    {
-                        try
-                        {
-                            if ( result.contains( attribute ) )
-                            {
-                                result.remove( attribute );
-                            }
-                        }
-                        catch ( LdapException ne )
-                        {
-                            // Do nothings
-                        }
-                        break;
-                    }
-                }
-            }
-        }
-    }
-
-    
-    /**
      * Filters objectClass attribute to inject top when not present.
      */
     private class TopFilter implements EntryFilter

Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
(original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
Mon Dec 17 00:19:02 2012
@@ -208,37 +208,42 @@ public class SchemaLdifToPartitionExtrac
             boolean first = true;
             LdifEntry ldifEntry = null;
 
-            while ( ldifReader.hasNext() )
+            try
             {
-                if ( first )
+                while ( ldifReader.hasNext() )
                 {
-                    ldifEntry = ldifReader.next();
-
-                    if ( ldifEntry.get( SchemaConstants.ENTRY_UUID_AT ) == null )
+                    if ( first )
                     {
-                        // No UUID, let's create one
-                        UUID entryUuid = UUID.randomUUID();
-                        ldifEntry.addAttribute( SchemaConstants.ENTRY_UUID_AT, entryUuid.toString()
);
+                        ldifEntry = ldifReader.next();
+    
+                        if ( ldifEntry.get( SchemaConstants.ENTRY_UUID_AT ) == null )
+                        {
+                            // No UUID, let's create one
+                            UUID entryUuid = UUID.randomUUID();
+                            ldifEntry.addAttribute( SchemaConstants.ENTRY_UUID_AT, entryUuid.toString()
);
+                        }
+                        if ( ldifEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null )
+                        {
+                            // No CSN, let's create one
+                            Csn csn = csnFactory.newInstance();
+                            ldifEntry.addAttribute( SchemaConstants.ENTRY_CSN_AT, csn.toString()
);
+                        }
+    
+                        first = false;
                     }
-                    if ( ldifEntry.get( SchemaConstants.ENTRY_CSN_AT ) == null )
+                    else
                     {
-                        // No CSN, let's create one
-                        Csn csn = csnFactory.newInstance();
-                        ldifEntry.addAttribute( SchemaConstants.ENTRY_CSN_AT, csn.toString()
);
+                        // throw an exception : we should not have more than one entry per
schema ldif file
+                        String msg = I18n.err( I18n.ERR_08003, source );
+                        LOG.error( msg );
+                        throw new InvalidObjectException( msg );
                     }
-
-                    first = false;
-                }
-                else
-                {
-                    // throw an exception : we should not have more than one entry per schema
ldif file
-                    String msg = I18n.err( I18n.ERR_08003, source );
-                    LOG.error( msg );
-                    throw new InvalidObjectException( msg );
                 }
             }
-
-            ldifReader.close();
+            finally
+            {
+                ldifReader.close();
+            }
 
             // inject the entry
             Entry entry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientDeleteRequestTest.java
Mon Dec 17 00:19:02 2012
@@ -192,8 +192,6 @@ public class ClientDeleteRequestTest ext
         Method deleteChildrenMethod = connection.getClass().getDeclaredMethod( "deleteRecursive",
Dn.class, Map.class );
         deleteChildrenMethod.setAccessible( true );
 
-        final AtomicInteger count = new AtomicInteger();
-
         try
         {
             connection.deleteTree( "cn=parent,ou=system" );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
Mon Dec 17 00:19:02 2012
@@ -1367,16 +1367,6 @@ public class ReplicationConsumerImpl imp
 
         cursor.close();
     }
-
-
-
-    /**
-     * Stop the refresh operation
-     */
-    private void stopRefreshing()
-    {
-        disconnect();
-    }
     
     
     private synchronized Object getLockFor( String uuid )

Modified: directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
(original)
+++ directory/apacheds/trunk/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpITest.java
Mon Dec 17 00:19:02 2012
@@ -55,7 +55,7 @@ public class NtpITest
     public void setUp() throws Exception
     {
         ntpConfig = new NtpServer();
-        port = AvailablePortFinder.getNextAvailable( 10123 );
+        port = AvailablePortFinder.getNextAvailable();
         TcpTransport tcpTransport = new TcpTransport( port );
         UdpTransport udpTransport = new UdpTransport( port );
         ntpConfig.setTransports( tcpTransport, udpTransport );

Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
(original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
Mon Dec 17 00:19:02 2012
@@ -176,54 +176,71 @@ public class LdifFileLoader
         {
             in = getLdifStream();
 
-            for ( LdifEntry ldifEntry : new LdifReader( in ) )
+            try
             {
-                Dn dn = ldifEntry.getDn();
-
-                if ( ldifEntry.isEntry() )
+                for ( LdifEntry ldifEntry : new LdifReader( in ) )
                 {
-                    Entry entry = ldifEntry.getEntry();
-                    boolean filterAccepted = applyFilters( dn, entry );
-
-                    if ( !filterAccepted )
+                    Dn dn = ldifEntry.getDn();
+    
+                    if ( ldifEntry.isEntry() )
                     {
-                        continue;
-                    }
-
-                    try
-                    {
-                        coreSession.lookup( dn );
-                        log.info( "Found {}, will not create.", dn );
+                        Entry entry = ldifEntry.getEntry();
+                        boolean filterAccepted = applyFilters( dn, entry );
+    
+                        if ( !filterAccepted )
+                        {
+                            continue;
+                        }
+    
+                        try
+                        {
+                            coreSession.lookup( dn );
+                            log.info( "Found {}, will not create.", dn );
+                        }
+                        catch ( Exception e )
+                        {
+                            try
+                            {
+                                coreSession.add(
+                                    new DefaultEntry(
+                                        coreSession.getDirectoryService().getSchemaManager(),
entry ) );
+                                count++;
+                                log.info( "Created {}.", dn );
+                            }
+                            catch ( LdapException e1 )
+                            {
+                                log.info( "Could not create entry " + entry, e1 );
+                            }
+                        }
                     }
-                    catch ( Exception e )
+                    else
                     {
+                        //modify
+                        List<Modification> items = ldifEntry.getModifications();
+    
                         try
                         {
-                            coreSession.add(
-                                new DefaultEntry(
-                                    coreSession.getDirectoryService().getSchemaManager(),
entry ) );
-                            count++;
-                            log.info( "Created {}.", dn );
+                            coreSession.modify( dn, items );
+                            log.info( "Modified: " + dn + " with modificationItems: " + items
);
                         }
-                        catch ( LdapException e1 )
+                        catch ( LdapException e )
                         {
-                            log.info( "Could not create entry " + entry, e1 );
+                            log.info( "Could not modify: " + dn + " with modificationItems:
" + items, e );
                         }
                     }
                 }
-                else
+            }
+            finally
+            {
+                if ( in != null )
                 {
-                    //modify
-                    List<Modification> items = ldifEntry.getModifications();
-
                     try
                     {
-                        coreSession.modify( dn, items );
-                        log.info( "Modified: " + dn + " with modificationItems: " + items
);
+                        in.close();
                     }
-                    catch ( LdapException e )
+                    catch ( Exception e )
                     {
-                        log.info( "Could not modify: " + dn + " with modificationItems: "
+ items, e );
+                        log.error( I18n.err( I18n.ERR_175 ), e );
                     }
                 }
             }
@@ -236,20 +253,6 @@ public class LdifFileLoader
         {
             log.error( I18n.err( I18n.ERR_174 ), ioe );
         }
-        finally
-        {
-            if ( in != null )
-            {
-                try
-                {
-                    in.close();
-                }
-                catch ( Exception e )
-                {
-                    log.error( I18n.err( I18n.ERR_175 ), e );
-                }
-            }
-        }
 
         return count;
     }

Modified: directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java?rev=1422722&r1=1422721&r2=1422722&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
(original)
+++ directory/apacheds/trunk/server-annotations/src/main/java/org/apache/directory/server/factory/ServerAnnotationProcessor.java
Mon Dec 17 00:19:02 2012
@@ -106,11 +106,11 @@ public class ServerAnnotationProcessor
         else
         {
             // Create default LDAP and LDAPS transports
-            int port = AvailablePortFinder.getNextAvailable( 1024 );
+            int port = AvailablePortFinder.getNextAvailable();
             Transport ldap = new TcpTransport( port );
             ldapServer.addTransports( ldap );
 
-            port = AvailablePortFinder.getNextAvailable( port );
+            port = AvailablePortFinder.getNextAvailable();
             Transport ldaps = new TcpTransport( port );
             ldaps.setEnableSSL( true );
             ldapServer.addTransports( ldaps );
@@ -382,7 +382,7 @@ public class ServerAnnotationProcessor
         if ( transportBuilders == null )
         {
             // create only UDP transport if none specified
-            UdpTransport defaultTransport = new UdpTransport( AvailablePortFinder.getNextAvailable(
startPort ) );
+            UdpTransport defaultTransport = new UdpTransport( AvailablePortFinder.getNextAvailable()
);
             kdcServer.addTransports( defaultTransport );
         }
         else if ( transportBuilders.length > 0 )
@@ -397,7 +397,7 @@ public class ServerAnnotationProcessor
 
                 if ( port == -1 )
                 {
-                    port = AvailablePortFinder.getNextAvailable( startPort );
+                    port = AvailablePortFinder.getNextAvailable();
                     startPort = port + 1;
                 }
 



Mime
View raw message