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 2016/11/28 05:43:45 UTC

svn commit: r1771683 - in /directory/shared/branches/shared-value/ldap: model/src/main/java/org/apache/directory/api/ldap/model/csn/ schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/ schema/data/src/main/java/org/apache/director...

Author: elecharny
Date: Mon Nov 28 05:43:44 2016
New Revision: 1771683

URL: http://svn.apache.org/viewvc?rev=1771683&view=rev
Log:
o Fixed Sonarlint warnings
o Fixed some checkstyle errors

Modified:
    directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/csn/Csn.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/UniqueResourceException.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/DefaultSchemaLdifExtractor.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/ResourceMap.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/AttributeClassLoader.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java
    directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java

Modified: directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/csn/Csn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/csn/Csn.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/csn/Csn.java (original)
+++ directory/shared/branches/shared-value/ldap/model/src/main/java/org/apache/directory/api/ldap/model/csn/Csn.java Mon Nov 28 05:43:44 2016
@@ -80,16 +80,10 @@ public class Csn implements Comparable<C
     private byte[] bytes;
 
     /** The Timestamp syntax. The last 'z' is _not_ the Time Zone */
-    private static final SimpleDateFormat SDF = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.ROOT );
+    private final SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMddHHmmss", Locale.ROOT );
 
     private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" );
 
-    // Initialize the dateFormat with the UTC TZ
-    static
-    {
-        SDF.setTimeZone( UTC_TIME_ZONE );
-    }
-
     /** Padding used to format number with a fixed size */
     private static final String[] PADDING_6 = new String[]
         { "00000", "0000", "000", "00", "0", "" };
@@ -114,6 +108,7 @@ public class Csn implements Comparable<C
         this.replicaId = replicaId;
         this.operationNumber = operationNumber;
         this.changeCount = changeCount;
+        sdf.setTimeZone( UTC_TIME_ZONE );
     }
 
 
@@ -124,10 +119,11 @@ public class Csn implements Comparable<C
      * &lt;timestamp&gt; # &lt;changeCount&gt; # &lt;replica ID&gt; # &lt;operation number&gt;
      *
      * @param value The String containing the CSN
-     * @throws InvalidCSNException if the value doesn't contain a valid CSN
      */
-    public Csn( String value ) throws InvalidCSNException
+    public Csn( String value )
     {
+        sdf.setTimeZone( UTC_TIME_ZONE );
+        
         if ( Strings.isEmpty( value ) )
         {
             String message = I18n.err( I18n.ERR_04114 );
@@ -166,11 +162,11 @@ public class Csn implements Comparable<C
 
         long tempTimestamp = 0L;
 
-        synchronized ( SDF )
+        synchronized ( sdf )
         {
             try
             {
-                tempTimestamp = SDF.parse( realTimestamp ).getTime();
+                tempTimestamp = sdf.parse( realTimestamp ).getTime();
             }
             catch ( ParseException pe )
             {
@@ -368,6 +364,7 @@ public class Csn implements Comparable<C
                 break;
                 
             case '1' :
+            case '2' : // Special case for february...
                 if ( !Chars.isDigit( chars[7] ) )
                 {
                     return false;
@@ -375,15 +372,6 @@ public class Csn implements Comparable<C
                 
                 break;
                 
-            case '2' :
-                if ( !Chars.isDigit( chars[7] ) )
-                {
-                    return false;
-                }
-                
-                // Special case for february...
-                break;
-                
             case '3' :
                 // Deal with 30 days months
                 if ( ( chars[7] != '0' ) && ( chars[7] != '1' ) )
@@ -596,9 +584,9 @@ public class Csn implements Comparable<C
         {
             StringBuilder buf = new StringBuilder( 40 );
 
-            synchronized ( SDF )
+            synchronized ( sdf )
             {
-                buf.append( SDF.format( new Date( timestamp ) ) );
+                buf.append( sdf.format( new Date( timestamp ) ) );
             }
 
             // Add the milliseconds part

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/UniqueResourceException.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/UniqueResourceException.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/UniqueResourceException.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/UniqueResourceException.java Mon Nov 28 05:43:44 2016
@@ -91,7 +91,7 @@ public class UniqueResourceException ext
 
     private static List<URL> toList( URL first, Enumeration<URL> urlEnum )
     {
-        ArrayList<URL> urls = new ArrayList<URL>();
+        ArrayList<URL> urls = new ArrayList<>();
         urls.add( first );
         while ( urlEnum.hasMoreElements() )
         {
@@ -104,9 +104,11 @@ public class UniqueResourceException ext
     /**
      * {@inheritDoc}
      */
+    @Override
     public String getMessage()
     {
-        StringBuffer buf = new StringBuffer( "Problem locating " ).append( resourceDescription ).append( "\n" );
+        StringBuilder buf = new StringBuilder( "Problem locating " ).append( resourceDescription ).append( "\n" );
+        
         if ( urls == null )
         {
             buf.append( "No resources named '" ).append( resourceName ).append( "' located on classpath" );
@@ -115,11 +117,13 @@ public class UniqueResourceException ext
         {
             buf.append( "Multiple copies of resource named '" ).append( resourceName ).append(
                 "' located on classpath at urls" );
+            
             for ( URL url : urls )
             {
                 buf.append( "\n    " ).append( url );
             }
         }
+        
         return buf.toString();
     }
 

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/DefaultSchemaLdifExtractor.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/DefaultSchemaLdifExtractor.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/DefaultSchemaLdifExtractor.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/DefaultSchemaLdifExtractor.java Mon Nov 28 05:43:44 2016
@@ -30,17 +30,17 @@ import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.net.URL;
 import java.nio.charset.Charset;
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Stack;
 import java.util.UUID;
 import java.util.regex.Pattern;
 
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.ldif.LdapLdifException;
 import org.apache.directory.api.ldap.model.ldif.LdifEntry;
 import org.apache.directory.api.ldap.model.ldif.LdifReader;
 import org.apache.directory.api.ldap.schema.extractor.SchemaLdifExtractor;
@@ -121,6 +121,7 @@ public class DefaultSchemaLdifExtractor
      *
      * @return true if schema folder has already been extracted.
      */
+    @Override
     public boolean isExtracted()
     {
         return extracted;
@@ -133,6 +134,7 @@ public class DefaultSchemaLdifExtractor
      * @param overwrite over write extracted structure if true, false otherwise
      * @throws IOException if schema already extracted and on IO errors
      */
+    @Override
     public void extractOrCopy( boolean overwrite ) throws IOException
     {
         if ( !outputDirectory.exists() && !outputDirectory.mkdirs() )
@@ -180,6 +182,7 @@ public class DefaultSchemaLdifExtractor
      *
      * @throws IOException if schema already extracted and on IO errors
      */
+    @Override
     public void extractOrCopy() throws IOException
     {
         extractOrCopy( false );
@@ -240,20 +243,23 @@ public class DefaultSchemaLdifExtractor
             }
 
             // Add the version at the first line, to avoid a warning
-            String ldifString = "version: 1\n" + ldifEntry.toString();
+            String ldifString;
+            
+            if ( ldifEntry != null )
+            {
+                ldifString = "version: 1\n" + ldifEntry.toString();
+            }
+            else
+            {
+                ldifString = "version: 1\n";
+            }
 
             out.write( ldifString );
             out.flush();
         }
-        catch ( LdapLdifException ne )
-        {
-            String msg = I18n.err( I18n.ERR_08004, source, ne.getLocalizedMessage() );
-            LOG.error( msg );
-            throw new InvalidObjectException( msg );
-        }
-        catch ( LdapException ne )
+        catch ( LdapException le )
         {
-            String msg = I18n.err( I18n.ERR_08004, source, ne.getLocalizedMessage() );
+            String msg = I18n.err( I18n.ERR_08004, source, le.getLocalizedMessage() );
             LOG.error( msg );
             throw new InvalidObjectException( msg );
         }
@@ -267,7 +273,7 @@ public class DefaultSchemaLdifExtractor
      * @param fileComponentStack stack containing pushed file components
      * @return the assembled destination file
      */
-    private File assembleDestinationFile( Stack<String> fileComponentStack )
+    private File assembleDestinationFile( Deque<String> fileComponentStack )
     {
         File destinationFile = outputDirectory.getAbsoluteFile();
 
@@ -289,12 +295,12 @@ public class DefaultSchemaLdifExtractor
     private File getDestinationFile( File resource )
     {
         File parent = resource.getParentFile();
-        Stack<String> fileComponentStack = new Stack<String>();
+        Deque<String> fileComponentStack = new ArrayDeque<>();
         fileComponentStack.push( resource.getName() );
 
         while ( parent != null )
         {
-            if ( parent.getName().equals( "schema" ) )
+            if ( "schema".equals( parent.getName() ) )
             {
                 // All LDIF files besides the schema.ldif are under the 
                 // schema/schema base path. So we need to add one more 
@@ -331,8 +337,7 @@ public class DefaultSchemaLdifExtractor
     public static InputStream getUniqueResourceAsStream( String resourceName, String resourceDescription )
         throws IOException
     {
-        resourceName = BASE_PATH + resourceName;
-        URL result = getUniqueResource( resourceName, resourceDescription );
+        URL result = getUniqueResource( BASE_PATH + resourceName, resourceDescription );
         return result.openStream();
     }
 

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/ResourceMap.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/ResourceMap.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/ResourceMap.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/extractor/impl/ResourceMap.java Mon Nov 28 05:43:44 2016
@@ -31,7 +31,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
 import org.slf4j.Logger;
@@ -79,7 +78,7 @@ public final class ResourceMap
      */
     public static Map<String, Boolean> getResources( Pattern pattern )
     {
-        HashMap<String, Boolean> retval = new HashMap<String, Boolean>();
+        HashMap<String, Boolean> retval = new HashMap<>();
 
         String schemaResourceLoc = System.getProperty( SCHEMA_RESOURCE_LOCATION, "" );
 
@@ -140,10 +139,6 @@ public final class ResourceMap
         {
             zf = new ZipFile( file );
         }
-        catch ( ZipException e )
-        {
-            throw new Error( e );
-        }
         catch ( IOException e )
         {
             throw new Error( e );

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/AttributeClassLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/AttributeClassLoader.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/AttributeClassLoader.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/AttributeClassLoader.java Mon Nov 28 05:43:44 2016
@@ -70,9 +70,10 @@ public class AttributeClassLoader extend
     /**
      * {@inheritDoc}
      */
+    @Override
     public Class<?> findClass( String name ) throws ClassNotFoundException
     {
-        byte[] classBytes = null;
+        byte[] classBytes;
 
         Value value = attribute.get();
 

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/JarLdifSchemaLoader.java Mon Nov 28 05:43:44 2016
@@ -168,9 +168,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> comparatorList = new ArrayList<Entry>();
+        List<Entry> comparatorList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -204,9 +205,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> syntaxCheckerList = new ArrayList<Entry>();
+        List<Entry> syntaxCheckerList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -240,9 +242,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> normalizerList = new ArrayList<Entry>();
+        List<Entry> normalizerList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -276,9 +279,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> matchingRuleList = new ArrayList<Entry>();
+        List<Entry> matchingRuleList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -312,9 +316,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> syntaxList = new ArrayList<Entry>();
+        List<Entry> syntaxList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -348,9 +353,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> attributeTypeList = new ArrayList<Entry>();
+        List<Entry> attributeTypeList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -386,9 +392,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> matchingRuleUseList = new ArrayList<Entry>();
+        List<Entry> matchingRuleUseList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -422,9 +429,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> nameFormList = new ArrayList<Entry>();
+        List<Entry> nameFormList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -458,9 +466,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditContentRulesList = new ArrayList<Entry>();
+        List<Entry> ditContentRulesList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -494,9 +503,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditStructureRuleList = new ArrayList<Entry>();
+        List<Entry> ditStructureRuleList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -530,9 +540,10 @@ public class JarLdifSchemaLoader extends
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> objectClassList = new ArrayList<Entry>();
+        List<Entry> objectClassList = new ArrayList<>();
 
         if ( schemas == null )
         {

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/LdifSchemaLoader.java Mon Nov 28 05:43:44 2016
@@ -68,6 +68,7 @@ public class LdifSchemaLoader extends Ab
     /** a filter for listing all the LDIF files within a directory */
     private final FilenameFilter ldifFilter = new FilenameFilter()
     {
+        @Override
         public boolean accept( File file, String name )
         {
             return name.endsWith( LDIF_EXT );
@@ -136,11 +137,10 @@ public class LdifSchemaLoader extends Ab
             {
                 File file = new File( schemaDirectory, ldifFile );
 
-                try
+                try ( LdifReader reader = new LdifReader( file ) )
                 {
-                    LdifReader reader = new LdifReader( file );
+                    
                     LdifEntry entry = reader.next();
-                    reader.close();
                     Schema schema = getSchema( entry.getEntry() );
 
                     if ( schema == null )
@@ -182,9 +182,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadComparators( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> comparatorList = new ArrayList<Entry>();
+        List<Entry> comparatorList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -222,9 +223,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadSyntaxCheckers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> syntaxCheckerList = new ArrayList<Entry>();
+        List<Entry> syntaxCheckerList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -262,9 +264,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadNormalizers( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> normalizerList = new ArrayList<Entry>();
+        List<Entry> normalizerList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -302,9 +305,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadMatchingRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> matchingRuleList = new ArrayList<Entry>();
+        List<Entry> matchingRuleList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -342,9 +346,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadSyntaxes( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> syntaxList = new ArrayList<Entry>();
+        List<Entry> syntaxList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -382,9 +387,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadAttributeTypes( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> attributeTypeList = new ArrayList<Entry>();
+        List<Entry> attributeTypeList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -424,9 +430,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadMatchingRuleUses( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> matchingRuleUseList = new ArrayList<Entry>();
+        List<Entry> matchingRuleUseList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -465,9 +472,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadNameForms( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> nameFormList = new ArrayList<Entry>();
+        List<Entry> nameFormList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -505,9 +513,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadDitContentRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditContentRuleList = new ArrayList<Entry>();
+        List<Entry> ditContentRuleList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -546,9 +555,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadDitStructureRules( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> ditStructureRuleList = new ArrayList<Entry>();
+        List<Entry> ditStructureRuleList = new ArrayList<>();
 
         if ( schemas == null )
         {
@@ -587,9 +597,10 @@ public class LdifSchemaLoader extends Ab
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Entry> loadObjectClasses( Schema... schemas ) throws LdapException, IOException
     {
-        List<Entry> objectClassList = new ArrayList<Entry>();
+        List<Entry> objectClassList = new ArrayList<>();
 
         if ( schemas == null )
         {

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SchemaEntityFactory.java Mon Nov 28 05:43:44 2016
@@ -81,7 +81,7 @@ public class SchemaEntityFactory impleme
     private static final Logger LOG = LoggerFactory.getLogger( SchemaEntityFactory.class );
 
     /** The empty string list. */
-    private static final List<String> EMPTY_LIST = new ArrayList<String>();
+    private static final List<String> EMPTY_LIST = new ArrayList<>();
 
     /** The empty string array. */
     private static final String[] EMPTY_ARRAY = new String[]
@@ -98,6 +98,7 @@ public class SchemaEntityFactory impleme
     {
         this.classLoader = AccessController.doPrivileged( new PrivilegedAction<AttributeClassLoader>()
         {
+            @Override
             public AttributeClassLoader run() 
             {
                 return new AttributeClassLoader();
@@ -216,6 +217,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public Schema getSchema( Entry entry ) throws LdapException
     {
         String name;
@@ -246,12 +248,12 @@ public class SchemaEntityFactory impleme
         {
             String value = entry.get( MetaSchemaConstants.M_DISABLED_AT ).getString();
             value = Strings.upperCase( value );
-            isDisabled = value.equals( "TRUE" );
+            isDisabled = "TRUE".equalsIgnoreCase( value );
         }
 
         if ( entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT ) != null )
         {
-            Set<String> depsSet = new HashSet<String>();
+            Set<String> depsSet = new HashSet<>();
             Attribute depsAttr = entry.get( MetaSchemaConstants.M_DEPENDENCIES_AT );
 
             for ( Value value : depsAttr )
@@ -273,8 +275,8 @@ public class SchemaEntityFactory impleme
         Attribute byteCode ) throws LdapException
     {
         // Try to class load the syntaxChecker
-        Class<?> clazz = null;
-        SyntaxChecker syntaxChecker = null;
+        Class<?> clazz;
+        SyntaxChecker syntaxChecker;
         String byteCodeStr = StringConstants.EMPTY;
 
         if ( byteCode == null )
@@ -339,6 +341,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapException
     {
@@ -393,6 +396,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager,
         SyntaxCheckerDescription syntaxCheckerDescription, Registries targetRegistries, String schemaName )
         throws LdapException
@@ -436,8 +440,8 @@ public class SchemaEntityFactory impleme
         Attribute byteCode ) throws LdapException
     {
         // Try to class load the comparator
-        LdapComparator<?> comparator = null;
-        Class<?> clazz = null;
+        LdapComparator<?> comparator;
+        Class<?> clazz;
         String byteCodeStr = StringConstants.EMPTY;
 
         if ( byteCode == null )
@@ -548,6 +552,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public LdapComparator<?> getLdapComparator( SchemaManager schemaManager,
         LdapComparatorDescription comparatorDescription, Registries targetRegistries, String schemaName )
         throws LdapException
@@ -587,6 +592,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapException
     {
@@ -645,8 +651,8 @@ public class SchemaEntityFactory impleme
         Attribute byteCode ) throws LdapException
     {
         // Try to class load the normalizer
-        Class<?> clazz = null;
-        Normalizer normalizer = null;
+        Class<?> clazz;
+        Normalizer normalizer;
         String byteCodeStr = StringConstants.EMPTY;
 
         if ( byteCode == null )
@@ -711,6 +717,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription,
         Registries targetRegistries, String schemaName ) throws LdapException
     {
@@ -749,6 +756,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapException
     {
@@ -805,6 +813,7 @@ public class SchemaEntityFactory impleme
      * @throws LdapInvalidAttributeValueException If the Syntax does not exist
      * @throws LdapUnwillingToPerformException If the schema is not loaded
      */
+    @Override
     public LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapInvalidAttributeValueException, LdapUnwillingToPerformException
     {
@@ -847,6 +856,7 @@ public class SchemaEntityFactory impleme
      * @throws LdapInvalidAttributeValueException If the MatchingRule does not exist
      * @throws LdapUnwillingToPerformException If the schema is not loaded
      */
+    @Override
     public MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapUnwillingToPerformException, LdapInvalidAttributeValueException
     {
@@ -904,7 +914,7 @@ public class SchemaEntityFactory impleme
             return EMPTY_LIST;
         }
 
-        List<String> strings = new ArrayList<String>( attr.size() );
+        List<String> strings = new ArrayList<>( attr.size() );
 
         for ( Value value : attr )
         {
@@ -918,6 +928,7 @@ public class SchemaEntityFactory impleme
     /**
      * {@inheritDoc}
      */
+    @Override
     public ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapException
     {
@@ -993,6 +1004,7 @@ public class SchemaEntityFactory impleme
      * @throws LdapInvalidAttributeValueException If the AttributeType does not exist
      * @throws LdapUnwillingToPerformException If the schema is not loaded
      */
+    @Override
     public AttributeType getAttributeType( SchemaManager schemaManager, Entry entry, Registries targetRegistries,
         String schemaName ) throws LdapInvalidAttributeValueException, LdapUnwillingToPerformException
     {
@@ -1082,7 +1094,7 @@ public class SchemaEntityFactory impleme
         if ( mCollective != null )
         {
             String val = mCollective.getString();
-            attributeType.setCollective( val.equalsIgnoreCase( "TRUE" ) );
+            attributeType.setCollective( "TRUE".equalsIgnoreCase( val ) );
         }
 
         // isSingleValued
@@ -1091,7 +1103,7 @@ public class SchemaEntityFactory impleme
         if ( mSingleValued != null )
         {
             String val = mSingleValued.getString();
-            attributeType.setSingleValued( val.equalsIgnoreCase( "TRUE" ) );
+            attributeType.setSingleValued( "TRUE".equalsIgnoreCase( val ) );
         }
 
         // isReadOnly
@@ -1100,7 +1112,7 @@ public class SchemaEntityFactory impleme
         if ( mNoUserModification != null )
         {
             String val = mNoUserModification.getString();
-            attributeType.setUserModifiable( !val.equalsIgnoreCase( "TRUE" ) );
+            attributeType.setUserModifiable( !"TRUE".equalsIgnoreCase( val ) );
         }
 
         // Usage
@@ -1172,9 +1184,8 @@ public class SchemaEntityFactory impleme
         }
 
         byte[] bytecode = Base64.decode( byteCodeString.toCharArray() );
-        Attribute attr = new DefaultAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );
-
-        return attr;
+        
+        return new DefaultAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode );
     }
 
 
@@ -1210,7 +1221,7 @@ public class SchemaEntityFactory impleme
         if ( mObsolete != null )
         {
             String val = mObsolete.getString();
-            schemaObject.setObsolete( val.equalsIgnoreCase( "TRUE" ) );
+            schemaObject.setObsolete( "TRUE".equalsIgnoreCase( val ) );
         }
 
         // The description field
@@ -1226,7 +1237,7 @@ public class SchemaEntityFactory impleme
 
         if ( names != null )
         {
-            List<String> values = new ArrayList<String>();
+            List<String> values = new ArrayList<>();
 
             for ( Value name : names )
             {
@@ -1244,7 +1255,7 @@ public class SchemaEntityFactory impleme
         if ( mDisabled != null )
         {
             String val = mDisabled.getString();
-            schemaObject.setEnabled( !val.equalsIgnoreCase( "TRUE" ) );
+            schemaObject.setEnabled( !"TRUE".equalsIgnoreCase( val ) );
         }
         else
         {

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/loader/SingleLdifSchemaLoader.java Mon Nov 28 05:43:44 2016
@@ -89,11 +89,7 @@ public class SingleLdifSchemaLoader exte
 
             initializeSchemas( in );
         }
-        catch ( LdapException e )
-        {
-            throw new RuntimeException( e );
-        }
-        catch ( IOException e )
+        catch ( LdapException | IOException e )
         {
             throw new RuntimeException( e );
         }
@@ -118,11 +114,7 @@ public class SingleLdifSchemaLoader exte
 
             initializeSchemas( in );
         }
-        catch ( LdapException e )
-        {
-            throw new RuntimeException( e );
-        }
-        catch ( IOException e )
+        catch ( LdapException | IOException e )
         {
             throw new RuntimeException( e );
         }
@@ -147,11 +139,7 @@ public class SingleLdifSchemaLoader exte
 
             initializeSchemas( in );
         }
-        catch ( LdapException e )
-        {
-            throw new RuntimeException( e );
-        }
-        catch ( IOException e )
+        catch ( LdapException | IOException e )
         {
             throw new RuntimeException( e );
         }
@@ -163,33 +151,32 @@ public class SingleLdifSchemaLoader exte
      */
     private void initializeSchemas( InputStream in ) throws LdapException, IOException
     {
-        LdifReader ldifReader = new LdifReader( in );
-
-        Schema currentSchema = null;
-
-        while ( ldifReader.hasNext() )
+        try ( LdifReader ldifReader = new LdifReader( in ) )
         {
-            LdifEntry ldifEntry = ldifReader.next();
-            String dn = ldifEntry.getDn().getName();
-            
-            if ( SCHEMA_START_PATTERN.matcher( dn ).matches() )
-            {
-                Schema schema = getSchema( ldifEntry.getEntry() );
-                schemaMap.put( schema.getSchemaName(), schema );
-                currentSchema = schema;
-            }
-            else
+            Schema currentSchema = null;
+    
+            while ( ldifReader.hasNext() )
             {
-                if ( currentSchema == null )
+                LdifEntry ldifEntry = ldifReader.next();
+                String dn = ldifEntry.getDn().getName();
+                
+                if ( SCHEMA_START_PATTERN.matcher( dn ).matches() )
                 {
-                    throw new LdapException( "the first entry in the LDIF file is not a schema definition" );
+                    Schema schema = getSchema( ldifEntry.getEntry() );
+                    schemaMap.put( schema.getSchemaName(), schema );
+                    currentSchema = schema;
+                }
+                else
+                {
+                    if ( currentSchema == null )
+                    {
+                        throw new LdapException( "the first entry in the LDIF file is not a schema definition" );
+                    }
+                    
+                    loadSchemaObject( currentSchema.getSchemaName(), ldifEntry );
                 }
-                
-                loadSchemaObject( currentSchema.getSchemaName(), ldifEntry );
             }
         }
-
-        ldifReader.close();
     }
 
 

Modified: directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java?rev=1771683&r1=1771682&r2=1771683&view=diff
==============================================================================
--- directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/branches/shared-value/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schema/manager/impl/DefaultSchemaManager.java Mon Nov 28 05:43:44 2016
@@ -112,7 +112,7 @@ public class DefaultSchemaManager implem
     private final EntityFactory factory;
 
     /** A Map containing all the schema being dependent from a schema */
-    private Map<String, Set<String>> schemaDependencies = new HashMap<String, Set<String>>();
+    private Map<String, Set<String>> schemaDependencies = new HashMap<>();
     
     /**
      * A map of all available schema names to schema objects. This map is
@@ -131,7 +131,7 @@ public class DefaultSchemaManager implem
     {
         // Default to the the root (one schemaManager for all the entries
         namingContext = Dn.ROOT_DSE;
-        errors = new ArrayList<Throwable>();
+        errors = new ArrayList<>();
         registries = new Registries();
         factory = new SchemaEntityFactory();
         isRelaxed = STRICT;
@@ -175,8 +175,7 @@ public class DefaultSchemaManager implem
             schemaMap.put( schema.getSchemaName(), schema );
         }
         
-        //this.schemaLoader = new JarLdifSchemaLoader();
-        errors = new ArrayList<Throwable>();
+        errors = new ArrayList<>();
         registries = new Registries();
         factory = new SchemaEntityFactory();
         isRelaxed = STRICT;
@@ -198,8 +197,7 @@ public class DefaultSchemaManager implem
             schemaMap.put( schema.getSchemaName(), schema );
         }
         
-        //this.schemaLoader = new JarLdifSchemaLoader();
-        errors = new ArrayList<Throwable>();
+        errors = new ArrayList<>();
         registries = new Registries();
         factory = new SchemaEntityFactory();
         isRelaxed = STRICT;
@@ -222,8 +220,7 @@ public class DefaultSchemaManager implem
             schemaMap.put( schema.getSchemaName(), schema );
         }
         
-        //this.schemaLoader = new JarLdifSchemaLoader();
-        errors = new ArrayList<Throwable>();
+        errors = new ArrayList<>();
         registries = new Registries();
         factory = new SchemaEntityFactory();
         isRelaxed = relaxed;
@@ -242,7 +239,7 @@ public class DefaultSchemaManager implem
         try
         {
             // Relax the controls at first
-            errors = new ArrayList<Throwable>();
+            errors = new ArrayList<>();
 
             // Clone the Registries
             Registries clonedRegistries = registries.clone();
@@ -326,7 +323,7 @@ public class DefaultSchemaManager implem
         Map<String, Set<SchemaObjectWrapper>> schemaObjects = registries.getObjectBySchemaName();
         Set<SchemaObjectWrapper> content = schemaObjects.get( Strings.toLowerCaseAscii( schema.getSchemaName() ) );
 
-        List<SchemaObject> toBeDeleted = new ArrayList<SchemaObject>();
+        List<SchemaObject> toBeDeleted = new ArrayList<>();
 
         if ( content != null )
         {
@@ -350,6 +347,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean disable( Schema... schemas ) throws LdapException
     {
         boolean disabled = false;
@@ -407,6 +405,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean disable( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
@@ -418,9 +417,9 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean disabledRelaxed( Schema... schemas )
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -428,9 +427,9 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean disabledRelaxed( String... schemas )
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -438,9 +437,10 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Schema> getDisabled()
     {
-        List<Schema> disabled = new ArrayList<Schema>();
+        List<Schema> disabled = new ArrayList<>();
 
         for ( Schema schema : registries.getLoadedSchemas().values() )
         {
@@ -457,6 +457,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean enable( Schema... schemas ) throws LdapException
     {
         boolean enabled = false;
@@ -471,7 +472,7 @@ public class DefaultSchemaManager implem
         Registries clonedRegistries = cloneRegistries();
         clonedRegistries.setRelaxed();
 
-        Set<Schema> disabledSchemas = new HashSet<Schema>();
+        Set<Schema> disabledSchemas = new HashSet<>();
 
         for ( Schema schema : schemas )
         {
@@ -539,6 +540,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean enable( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
@@ -549,9 +551,9 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean enableRelaxed( Schema... schemas )
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -559,9 +561,9 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean enableRelaxed( String... schemas )
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -569,9 +571,10 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Schema> getEnabled()
     {
-        List<Schema> enabled = new ArrayList<Schema>();
+        List<Schema> enabled = new ArrayList<>();
 
         for ( Schema schema : registries.getLoadedSchemas().values() )
         {
@@ -588,9 +591,10 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Schema> getAllSchemas()
     {
-        List<Schema> schemas = new ArrayList<Schema>();
+        List<Schema> schemas = new ArrayList<>();
 
         for ( Schema schema : schemaMap.values() )
         {
@@ -607,6 +611,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public List<Throwable> getErrors()
     {
         return errors;
@@ -616,6 +621,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public Registries getRegistries()
     {
         return registries;
@@ -627,7 +633,6 @@ public class DefaultSchemaManager implem
      */
     public boolean isDisabledAccepted()
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -635,6 +640,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean load( Schema... schemas ) throws LdapException
     {
         if ( schemas.length == 0 )
@@ -693,7 +699,7 @@ public class DefaultSchemaManager implem
 
                             if ( deps == null )
                             {
-                                deps = new HashSet<String>();
+                                deps = new HashSet<>();
                                 deps.add( schema.getSchemaName() );
                             }
 
@@ -724,6 +730,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean load( String... schemaNames ) throws LdapException
     {
         if ( schemaNames.length == 0 )
@@ -1077,6 +1084,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadAllEnabled() throws LdapException
     {
         Schema[] schemas = new Schema[schemaMap.size()];
@@ -1100,6 +1108,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadAllEnabledRelaxed() throws LdapException
     {
         Schema[] enabledSchemas = new Schema[schemaMap.size()];
@@ -1120,6 +1129,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadDisabled( Schema... schemas ) throws LdapException
     {
         // Work on a cloned and relaxed registries
@@ -1139,7 +1149,7 @@ public class DefaultSchemaManager implem
         clonedRegistries.clear();
 
         // Apply the change to the correct registries if no errors
-        if ( errors.size() == 0 )
+        if ( errors.isEmpty() )
         {
             // No error, we can enable the schema in the real registries
             for ( Schema schema : schemas )
@@ -1164,6 +1174,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadDisabled( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
@@ -1175,9 +1186,9 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadRelaxed( Schema... schemas ) throws LdapException
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -1185,6 +1196,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadRelaxed( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
@@ -1195,6 +1207,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadWithDeps( Schema... schemas ) throws LdapException
     {
         boolean loaded = false;
@@ -1251,6 +1264,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadWithDeps( String... schemas ) throws LdapException
     {
         return loadWithDeps( toArray( schemas ) );
@@ -1327,6 +1341,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadWithDepsRelaxed( Schema... schemas ) throws LdapException
     {
         registries.setRelaxed();
@@ -1350,6 +1365,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean loadWithDepsRelaxed( String... schemas ) throws LdapException
     {
         return loadWithDepsRelaxed( toArray( schemas ) );
@@ -1425,16 +1441,17 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setRegistries( Registries registries )
     {
-        // TODO Auto-generated method stub
-
+        this.registries = registries;
     }
 
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean unload( Schema... schemas ) throws LdapException
     {
         boolean unloaded = false;
@@ -1505,6 +1522,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean unload( String... schemaNames ) throws LdapException
     {
         Schema[] schemas = toArray( schemaNames );
@@ -1516,6 +1534,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean verify( Schema... schemas ) throws LdapException
     {
         // Work on a cloned registries
@@ -1539,7 +1558,7 @@ public class DefaultSchemaManager implem
                 // Now, check the registries
                 List<Throwable> errorList = clonedRegistries.checkRefInteg();
 
-                if ( errorList.size() != 0 )
+                if ( !errorList.isEmpty() )
                 {
                     // We got an error : exit
                     clonedRegistries.clear();
@@ -1564,6 +1583,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean verify( String... schemas ) throws LdapException
     {
         return verify( toArray( schemas ) );
@@ -1573,6 +1593,7 @@ public class DefaultSchemaManager implem
     /**
      * @return the namingContext
      */
+    @Override
     public Dn getNamingContext()
     {
         return namingContext;
@@ -1584,6 +1605,7 @@ public class DefaultSchemaManager implem
      *
      * @throws LdapException If the initialization fails
      */
+    @Override
     public void initialize() throws LdapException
     {
     }
@@ -1595,6 +1617,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public AttributeTypeRegistry getAttributeTypeRegistry()
     {
         return new ImmutableAttributeTypeRegistry( registries.getAttributeTypeRegistry() );
@@ -1604,6 +1627,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public ComparatorRegistry getComparatorRegistry()
     {
         return new ImmutableComparatorRegistry( registries.getComparatorRegistry() );
@@ -1613,6 +1637,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public DitContentRuleRegistry getDITContentRuleRegistry()
     {
         return new ImmutableDitContentRuleRegistry( registries.getDitContentRuleRegistry() );
@@ -1622,6 +1647,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public DitStructureRuleRegistry getDITStructureRuleRegistry()
     {
         return new ImmutableDitStructureRuleRegistry( registries.getDitStructureRuleRegistry() );
@@ -1631,6 +1657,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public MatchingRuleRegistry getMatchingRuleRegistry()
     {
         return new ImmutableMatchingRuleRegistry( registries.getMatchingRuleRegistry() );
@@ -1640,6 +1667,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public MatchingRuleUseRegistry getMatchingRuleUseRegistry()
     {
         return new ImmutableMatchingRuleUseRegistry( registries.getMatchingRuleUseRegistry() );
@@ -1649,6 +1677,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public NameFormRegistry getNameFormRegistry()
     {
         return new ImmutableNameFormRegistry( registries.getNameFormRegistry() );
@@ -1658,6 +1687,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public NormalizerRegistry getNormalizerRegistry()
     {
         return new ImmutableNormalizerRegistry( registries.getNormalizerRegistry() );
@@ -1667,6 +1697,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public ObjectClassRegistry getObjectClassRegistry()
     {
         return new ImmutableObjectClassRegistry( registries.getObjectClassRegistry() );
@@ -1676,6 +1707,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public LdapSyntaxRegistry getLdapSyntaxRegistry()
     {
         return new ImmutableLdapSyntaxRegistry( registries.getLdapSyntaxRegistry() );
@@ -1685,6 +1717,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SyntaxCheckerRegistry getSyntaxCheckerRegistry()
     {
         return new ImmutableSyntaxCheckerRegistry( registries.getSyntaxCheckerRegistry() );
@@ -1693,8 +1726,8 @@ public class DefaultSchemaManager implem
 
     /**
      * Get rid of AT's options (everything after the ';'
-     * @param oid
-     * @return
+     * @param oid The AT's OID
+     * @return The AT without its options
      */
     private String stripOptions( String oid )
     {
@@ -1714,6 +1747,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public AttributeType lookupAttributeTypeRegistry( String oid ) throws LdapException
     {
         String oidTrimmed = Strings.toLowerCaseAscii( oid ).trim();
@@ -1725,6 +1759,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public AttributeType getAttributeType( String oid )
     {
         try
@@ -1743,6 +1778,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public LdapComparator<?> lookupComparatorRegistry( String oid ) throws LdapException
     {
         return registries.getComparatorRegistry().lookup( oid );
@@ -1752,6 +1788,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public MatchingRule lookupMatchingRuleRegistry( String oid ) throws LdapException
     {
         return registries.getMatchingRuleRegistry().lookup( Strings.toLowerCaseAscii( oid ).trim() );
@@ -1761,6 +1798,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public Normalizer lookupNormalizerRegistry( String oid ) throws LdapException
     {
         return registries.getNormalizerRegistry().lookup( oid );
@@ -1770,6 +1808,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public ObjectClass lookupObjectClassRegistry( String oid ) throws LdapException
     {
         return registries.getObjectClassRegistry().lookup( Strings.toLowerCaseAscii( oid ).trim() );
@@ -1779,6 +1818,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public LdapSyntax lookupLdapSyntaxRegistry( String oid ) throws LdapException
     {
         return registries.getLdapSyntaxRegistry().lookup( Strings.toLowerCaseAscii( oid ).trim() );
@@ -1788,6 +1828,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SyntaxChecker lookupSyntaxCheckerRegistry( String oid ) throws LdapException
     {
         return registries.getSyntaxCheckerRegistry().lookup( oid );
@@ -1896,6 +1937,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean add( SchemaObject schemaObject ) throws LdapException
     {
         // First, clear the errors
@@ -2021,6 +2063,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean delete( SchemaObject schemaObject ) throws LdapException
     {
         // First, clear the errors
@@ -2131,6 +2174,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public Map<String, OidNormalizer> getNormalizerMapping()
     {
         return registries.getAttributeTypeRegistry().getNormalizerMapping();
@@ -2141,6 +2185,7 @@ public class DefaultSchemaManager implem
      * {@inheritDoc}
      */
     @SuppressWarnings("rawtypes")
+    @Override
     public OidRegistry getGlobalOidRegistry()
     {
         return registries.getGlobalOidRegistry();
@@ -2150,6 +2195,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public Schema getLoadedSchema( String schemaName )
     {
         return schemaMap.get( schemaName );
@@ -2159,6 +2205,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isSchemaLoaded( String schemaName )
     {
         try
@@ -2177,6 +2224,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterAttributeType( String attributeTypeOid ) throws LdapException
     {
         return registries.getAttributeTypeRegistry().unregister( attributeTypeOid );
@@ -2186,6 +2234,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterComparator( String comparatorOid ) throws LdapException
     {
         return registries.getComparatorRegistry().unregister( comparatorOid );
@@ -2195,6 +2244,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterDitControlRule( String ditControlRuleOid ) throws LdapException
     {
         return registries.getDitContentRuleRegistry().unregister( ditControlRuleOid );
@@ -2204,6 +2254,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterDitStructureRule( String ditStructureRuleOid ) throws LdapException
     {
         return registries.getDitStructureRuleRegistry().unregister( ditStructureRuleOid );
@@ -2213,6 +2264,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterLdapSyntax( String ldapSyntaxOid ) throws LdapException
     {
         return registries.getLdapSyntaxRegistry().unregister( ldapSyntaxOid );
@@ -2222,6 +2274,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterMatchingRule( String matchingRuleOid ) throws LdapException
     {
         return registries.getMatchingRuleRegistry().unregister( matchingRuleOid );
@@ -2231,6 +2284,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterMatchingRuleUse( String matchingRuleUseOid ) throws LdapException
     {
         return registries.getMatchingRuleUseRegistry().unregister( matchingRuleUseOid );
@@ -2240,6 +2294,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterNameForm( String nameFormOid ) throws LdapException
     {
         return registries.getNameFormRegistry().unregister( nameFormOid );
@@ -2249,6 +2304,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterNormalizer( String normalizerOid ) throws LdapException
     {
         return registries.getNormalizerRegistry().unregister( normalizerOid );
@@ -2258,6 +2314,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterObjectClass( String objectClassOid ) throws LdapException
     {
         return registries.getObjectClassRegistry().unregister( objectClassOid );
@@ -2267,6 +2324,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public SchemaObject unregisterSyntaxChecker( String syntaxCheckerOid ) throws LdapException
     {
         return registries.getSyntaxCheckerRegistry().unregister( syntaxCheckerOid );
@@ -2279,6 +2337,7 @@ public class DefaultSchemaManager implem
      *
      * @return True if SchemaObjects can be added even if they break the consistency
      */
+    @Override
     public boolean isRelaxed()
     {
         return isRelaxed;
@@ -2290,6 +2349,7 @@ public class DefaultSchemaManager implem
      *
      * @return True if SchemaObjects cannot be added if they break the consistency
      */
+    @Override
     public boolean isStrict()
     {
         return !isRelaxed;
@@ -2299,6 +2359,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public Set<String> listDependentSchemaNames( String schemaName )
     {
         return schemaDependencies.get( schemaName );
@@ -2309,6 +2370,7 @@ public class DefaultSchemaManager implem
      * Change the SchemaManager to a relaxed mode, where invalid SchemaObjects
      * can be registered.
      */
+    @Override
     public void setRelaxed()
     {
         isRelaxed = RELAXED;
@@ -2319,6 +2381,7 @@ public class DefaultSchemaManager implem
      * Change the SchemaManager to a strict mode, where invalid SchemaObjects
      * cannot be registered.
      */
+    @Override
     public void setStrict()
     {
         isRelaxed = STRICT;
@@ -2328,6 +2391,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isDisabled( String schemaName )
     {
         Schema schema = registries.getLoadedSchema( schemaName );
@@ -2339,6 +2403,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isDisabled( Schema schema )
     {
         return ( schema != null ) && schema.isDisabled();
@@ -2348,6 +2413,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isEnabled( String schemaName )
     {
         Schema schema = registries.getLoadedSchema( schemaName );
@@ -2359,6 +2425,7 @@ public class DefaultSchemaManager implem
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean isEnabled( Schema schema )
     {
         return ( schema != null ) && schema.isEnabled();