directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1681130 - in /directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model: constants/ filter/ ldif/ message/ name/ password/ schema/ schema/registries/ schema/syntaxCheckers/ url/
Date Fri, 22 May 2015 14:44:02 GMT
Author: elecharny
Date: Fri May 22 14:44:01 2015
New Revision: 1681130

URL: http://svn.apache.org/r1681130
Log:
Fixed many of the Sonar critical issues 

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/MessageTypeEnum.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/EncryptionMethod.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributesFactory.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/overview.html
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultAttributeTypeRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultComparatorRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultNormalizerRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultObjectClassRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSyntaxCheckerRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/JpegSyntaxChecker.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/constants/SchemaConstants.java
Fri May 22 14:44:01 2015
@@ -733,7 +733,7 @@ public final class SchemaConstants
 
     // Emails
     public static final String EMAIL_AT = "email";
-    public static final String emailAddress_AT = "emailAddress";
+    public static final String EMAIL_ADDRESS_AT = "emailAddress";
     public static final String PKCS9EMAIL_AT = "pkcs9email";
     public static final String EMAIL_AT_OID = "1.2.840.113549.1.9.1";
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/AbstractExprNode.java
Fri May 22 14:44:01 2015
@@ -103,14 +103,16 @@ public abstract class AbstractExprNode i
         }
 
         // Check all the annotation
-        for ( String key : annotations.keySet() )
+        for ( Map.Entry<String, Object> entry : annotations.entrySet() )
         {
+            String key = entry.getKey();
+        
             if ( !that.annotations.containsKey( key ) )
             {
                 return false;
             }
 
-            Object thisAnnotation = annotations.get( key );
+            Object thisAnnotation = entry.getValue();
             Object thatAnnotation = that.annotations.get( key );
 
             if ( thisAnnotation == null )
@@ -227,9 +229,10 @@ public abstract class AbstractExprNode i
 
         if ( annotations != null )
         {
-            for ( String key : annotations.keySet() )
+            for ( Map.Entry<String, Object> entry : annotations.entrySet() )
             {
-                Object value = annotations.get( key );
+                String key = entry.getKey();
+                Object value = entry.getValue();
 
                 h = h * 17 + key.hashCode();
                 h = h * 17 + ( value == null ? 0 : value.hashCode() );
@@ -318,12 +321,10 @@ public abstract class AbstractExprNode i
 
             if ( annotations != null )
             {
-                for ( String key : annotations.keySet() )
+                for ( Map.Entry<String, Object> entry : annotations.entrySet() )
                 {
-                    Object value = annotations.get( key );
-
                     // Note : the value aren't cloned ! 
-                    ( ( AbstractExprNode ) clone ).annotations.put( key, value );
+                    ( ( AbstractExprNode ) clone ).annotations.put( entry.getKey(), entry.getValue()
);
                 }
             }
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifEntry.java
Fri May 22 14:44:01 2015
@@ -884,12 +884,12 @@ public class LdifEntry implements Clonea
 
         if ( modifications != null )
         {
-            for ( String key : modifications.keySet() )
+            for ( Map.Entry<String, Modification> entry : modifications.entrySet()
)
             {
-                Modification modif = modifications.get( key );
+                Modification modif = entry.getValue();
                 Modification modifClone = new DefaultModification( modif.getOperation(),
                     modif.getAttribute().clone() );
-                clone.modifications.put( key, modifClone );
+                clone.modifications.put( entry.getKey(), modifClone );
             }
 
         }
@@ -1215,14 +1215,16 @@ public class LdifEntry implements Clonea
                 return false;
             }
 
-            for ( String controlOid : controls.keySet() )
+            for ( Map.Entry<String, LdifControl> entry : controls.entrySet() )
             {
+                String controlOid = entry.getKey();
+
                 if ( !otherControls.containsKey( controlOid ) )
                 {
                     return false;
                 }
 
-                Control thisControl = controls.get( controlOid );
+                Control thisControl = entry.getValue();
                 Control otherControl = otherControls.get( controlOid );
 
                 if ( thisControl == null )

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
Fri May 22 14:44:01 2015
@@ -2001,7 +2001,15 @@ public class LdifReader implements Itera
 
             public LdifEntry next()
             {
-                return nextInternal();
+                try
+                {
+                    return nextInternal();
+                }
+                catch ( NoSuchElementException nse )
+                {
+                    LOG.error( nse.getMessage() );
+                    return null;
+                }
             }
 
 
@@ -2051,19 +2059,16 @@ public class LdifReader implements Itera
         prefetched = parseEntry();
 
         // When done, get the entries one by one.
-        try
+        for ( LdifEntry entry : this )
         {
-            for ( LdifEntry entry : this )
+            if ( entry != null )
             {
-                if ( entry != null )
-                {
-                    entries.add( entry );
-                }
+                entries.add( entry );
+            }
+            else
+            {
+                throw new LdapLdifException( I18n.err( I18n.ERR_12072, error.getLocalizedMessage()
) );
             }
-        }
-        catch ( NoSuchElementException nsee )
-        {
-            throw new LdapLdifException( I18n.err( I18n.ERR_12072, error.getLocalizedMessage()
), nsee );
         }
 
         return entries;

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/MessageTypeEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/MessageTypeEnum.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/MessageTypeEnum.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/message/MessageTypeEnum.java
Fri May 22 14:44:01 2015
@@ -27,35 +27,25 @@ package org.apache.directory.api.ldap.mo
  */
 public enum MessageTypeEnum
 {
-    ABANDON_REQUEST(0),
-    ADD_REQUEST(1),
-    ADD_RESPONSE(2),
-    BIND_REQUEST(3),
-    BIND_RESPONSE(4),
-    COMPARE_REQUEST(5),
-    COMPARE_RESPONSE(6),
-    DEL_REQUEST(7),
-    DEL_RESPONSE(8),
-    EXTENDED_REQUEST(9),
-    EXTENDED_RESPONSE(10),
-    MODIFYDN_REQUEST(11),
-    MODIFYDN_RESPONSE(12),
-    MODIFY_REQUEST(13),
-    MODIFY_RESPONSE(14),
-    SEARCH_REQUEST(15),
-    SEARCH_RESULT_DONE(16),
-    SEARCH_RESULT_ENTRY(17),
-    SEARCH_RESULT_REFERENCE(18),
-    UNBIND_REQUEST(19),
-    INTERMEDIATE_RESPONSE(20);
-
-    /** The internal value */
-    @SuppressWarnings("unused")
-    private int value;
-
-
-    private MessageTypeEnum( int value )
-    {
-        this.value = value;
-    }
+    ABANDON_REQUEST,
+    ADD_REQUEST,
+    ADD_RESPONSE,
+    BIND_REQUEST,
+    BIND_RESPONSE,
+    COMPARE_REQUEST,
+    COMPARE_RESPONSE,
+    DEL_REQUEST,
+    DEL_RESPONSE,
+    EXTENDED_REQUEST,
+    EXTENDED_RESPONSE,
+    MODIFYDN_REQUEST,
+    MODIFYDN_RESPONSE,
+    MODIFY_REQUEST,
+    MODIFY_RESPONSE,
+    SEARCH_REQUEST,
+    SEARCH_RESULT_DONE,
+    SEARCH_RESULT_ENTRY,
+    SEARCH_RESULT_REFERENCE,
+    UNBIND_REQUEST,
+    INTERMEDIATE_RESPONSE;
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
Fri May 22 14:44:01 2015
@@ -808,7 +808,7 @@ public class Rdn implements Cloneable, E
      */
     public Iterator<Ava> iterator()
     {
-        if ( nbAvas == 1 || nbAvas == 0 )
+        if ( ( nbAvas == 1 ) || ( nbAvas == 0 ) )
         {
             return new Iterator<Ava>()
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/EncryptionMethod.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/EncryptionMethod.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/EncryptionMethod.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/EncryptionMethod.java
Fri May 22 14:44:01 2015
@@ -88,5 +88,4 @@ public class EncryptionMethod
         return "EncryptionMethod [algorithm=" + algorithm.getName().toUpperCase() + ", salt="
             + Strings.dumpBytes( salt ) + "]";
     }
-
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
Fri May 22 14:44:01 2015
@@ -503,11 +503,13 @@ public abstract class AbstractSchemaObje
 
         if ( hasExtension( name ) )
         {
-            for ( String key : extensions.keySet() )
+            for ( Map.Entry<String, List<String>> entry : extensions.entrySet()
)
             {
+                String key = entry.getKey();
+                
                 if ( name.equalsIgnoreCase( key ) )
                 {
-                    return extensions.get( key );
+                    return entry.getValue();
                 }
             }
         }
@@ -751,14 +753,16 @@ public abstract class AbstractSchemaObje
             }
             else
             {
-                for ( String key : extensions.keySet() )
+                for ( Map.Entry<String, List<String>> entry : extensions.entrySet()
)
                 {
+                    String key = entry.getKey();
+                    
                     if ( !that.extensions.containsKey( key ) )
                     {
                         return false;
                     }
 
-                    List<String> thisValues = extensions.get( key );
+                    List<String> thisValues = entry.getValue();
                     List<String> thatValues = that.extensions.get( key );
 
                     if ( thisValues != null )
@@ -898,9 +902,9 @@ public abstract class AbstractSchemaObje
     public void clear()
     {
         // Clear the extensions
-        for ( String extension : extensions.keySet() )
+        for ( Map.Entry<String, List<String>> entry : extensions.entrySet() )
         {
-            List<String> extensionList = extensions.get( extension );
+            List<String> extensionList = entry.getValue();
 
             extensionList.clear();
         }
@@ -961,11 +965,12 @@ public abstract class AbstractSchemaObje
         }
 
         // The extensions, if any
-        for ( String key : extensions.keySet() )
+        for ( Map.Entry<String, List<String>> entry : extensions.entrySet() )
         {
+            String key = entry.getKey();
             h += h * 17 + key.hashCode();
 
-            List<String> values = extensions.get( key );
+            List<String> values = entry.getValue();
 
             if ( values != null )
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributesFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributesFactory.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributesFactory.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributesFactory.java
Fri May 22 14:44:01 2015
@@ -401,7 +401,7 @@ public class AttributesFactory
     }
 
 
-    private final void injectCommon( SchemaObject object, Entry entry, SchemaManager schemaManager
)
+    private void injectCommon( SchemaObject object, Entry entry, SchemaManager schemaManager
)
         throws LdapException
     {
         injectNames( object.getNames(), entry, schemaManager );
@@ -432,7 +432,7 @@ public class AttributesFactory
     }
 
 
-    private final void injectNames( List<String> names, Entry entry, SchemaManager
schemaManager ) throws LdapException
+    private void injectNames( List<String> names, Entry entry, SchemaManager schemaManager
) throws LdapException
     {
         if ( ( names == null ) || ( names.size() == 0 ) )
         {
@@ -459,7 +459,7 @@ public class AttributesFactory
     }
 
 
-    private final String getBoolean( boolean value )
+    private String getBoolean( boolean value )
     {
         if ( value )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/overview.html
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/overview.html?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/overview.html
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/overview.html
Fri May 22 14:44:01 2015
@@ -20,13 +20,13 @@
 
 <HTML>
 <HEAD>
-	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
-	<TITLE></TITLE>
-	<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.0  (Win32)">
-	<META NAME="AUTHOR" CONTENT="Alex Karasulu">
-	<META NAME="CREATED" CONTENT="20031214;9293611">
-	<META NAME="CHANGEDBY" CONTENT="Alex Karasulu">
-	<META NAME="CHANGED" CONTENT="20031214;9310627">
+  <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"/>
+  <TITLE></TITLE>
+  <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.0  (Win32)"/>
+  <META NAME="AUTHOR" CONTENT="Alex Karasulu"/>
+  <META NAME="CREATED" CONTENT="20031214;9293611"/>
+  <META NAME="CHANGEDBY" CONTENT="Alex Karasulu"/>
+  <META NAME="CHANGED" CONTENT="20031214;9310627"/>
 </HEAD>
 <BODY LANG="en-US" DIR="LTR">
 <P>

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultAttributeTypeRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultAttributeTypeRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultAttributeTypeRegistry.java
Fri May 22 14:44:01 2015
@@ -321,9 +321,9 @@ public class DefaultAttributeTypeRegistr
         oidNormalizerMap.clear();
 
         // and clear the descendant
-        for ( String oid : oidToDescendantSet.keySet() )
+        for ( Map.Entry<String, Set<AttributeType>> entry : oidToDescendantSet.entrySet()
)
         {
-            Set<AttributeType> descendants = oidToDescendantSet.get( oid );
+            Set<AttributeType> descendants = entry.getValue();
 
             if ( descendants != null )
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultComparatorRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultComparatorRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultComparatorRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultComparatorRegistry.java
Fri May 22 14:44:01 2015
@@ -20,6 +20,8 @@
 package org.apache.directory.api.ldap.model.schema.registries;
 
 
+import java.util.Map;
+
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.LdapComparator;
 import org.apache.directory.api.ldap.model.schema.SchemaObject;
@@ -104,7 +106,7 @@ public class DefaultComparatorRegistry e
         sb.append( schemaObjectType ).append( ": " );
         boolean isFirst = true;
 
-        for ( String name : byName.keySet() )
+        for ( Map.Entry<String, LdapComparator<?>> entry : byName.entrySet()
)
         {
             if ( isFirst )
             {
@@ -115,7 +117,7 @@ public class DefaultComparatorRegistry e
                 sb.append( ", " );
             }
 
-            LdapComparator<?> comparator = byName.get( name );
+            LdapComparator<?> comparator =entry.getValue();
 
             String fqcn = comparator.getFqcn();
             int lastDotPos = fqcn.lastIndexOf( '.' );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultNormalizerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultNormalizerRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultNormalizerRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultNormalizerRegistry.java
Fri May 22 14:44:01 2015
@@ -20,6 +20,8 @@
 package org.apache.directory.api.ldap.model.schema.registries;
 
 
+import java.util.Map;
+
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.Normalizer;
 import org.apache.directory.api.ldap.model.schema.SchemaObject;
@@ -104,7 +106,7 @@ public class DefaultNormalizerRegistry e
         sb.append( schemaObjectType ).append( ": " );
         boolean isFirst = true;
 
-        for ( String name : byName.keySet() )
+        for ( Map.Entry<String, Normalizer> entry : byName.entrySet() )
         {
             if ( isFirst )
             {
@@ -115,7 +117,7 @@ public class DefaultNormalizerRegistry e
                 sb.append( ", " );
             }
 
-            Normalizer normalizer = byName.get( name );
+            Normalizer normalizer = entry.getValue();
 
             String fqcn = normalizer.getFqcn();
             int lastDotPos = fqcn.lastIndexOf( '.' );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultObjectClassRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultObjectClassRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultObjectClassRegistry.java
Fri May 22 14:44:01 2015
@@ -235,9 +235,9 @@ public class DefaultObjectClassRegistry
         super.clear();
 
         // and clear the descendant
-        for ( String oid : oidToDescendants.keySet() )
+        for ( Map.Entry<String, Set<ObjectClass>> entry : oidToDescendants.entrySet()
)
         {
-            Set<ObjectClass> descendants = oidToDescendants.get( oid );
+            Set<ObjectClass> descendants = entry.getValue();
 
             if ( descendants != null )
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSchemaObjectRegistry.java
Fri May 22 14:44:01 2015
@@ -363,10 +363,11 @@ public abstract class DefaultSchemaObjec
     public SchemaObjectRegistry<T> copy( SchemaObjectRegistry<T> original )
     {
         // Fill the byName and OidRegistry maps, the type has already be copied
-        for ( String key : ( ( DefaultSchemaObjectRegistry<T> ) original ).byName.keySet()
)
+        for ( Map.Entry<String, T> entry : ( ( DefaultSchemaObjectRegistry<T>
) original ).byName.entrySet() )
         {
+            String key = entry.getKey();
             // Clone each SchemaObject
-            T value = ( ( DefaultSchemaObjectRegistry<T> ) original ).byName.get( key
);
+            T value = entry.getValue();
 
             if ( value instanceof LoadableSchemaObject )
             {
@@ -455,7 +456,7 @@ public abstract class DefaultSchemaObjec
         sb.append( schemaObjectType ).append( ": " );
         boolean isFirst = true;
 
-        for ( String name : byName.keySet() )
+        for ( Map.Entry<String, T> entry : byName.entrySet() )
         {
             if ( isFirst )
             {
@@ -466,7 +467,8 @@ public abstract class DefaultSchemaObjec
                 sb.append( ", " );
             }
 
-            T schemaObject = byName.get( name );
+            String name = entry.getKey();
+            T schemaObject = entry.getValue();
 
             sb.append( '<' ).append( name ).append( ", " ).append( schemaObject.getOid()
).append( '>' );
         }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSyntaxCheckerRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSyntaxCheckerRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSyntaxCheckerRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/DefaultSyntaxCheckerRegistry.java
Fri May 22 14:44:01 2015
@@ -20,6 +20,8 @@
 package org.apache.directory.api.ldap.model.schema.registries;
 
 
+import java.util.Map;
+
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.SchemaObject;
 import org.apache.directory.api.ldap.model.schema.SchemaObjectType;
@@ -104,7 +106,7 @@ public class DefaultSyntaxCheckerRegistr
         sb.append( schemaObjectType ).append( ": " );
         boolean isFirst = true;
 
-        for ( String name : byName.keySet() )
+        for ( Map.Entry<String, SyntaxChecker> entry : byName.entrySet() )
         {
             if ( isFirst )
             {
@@ -115,7 +117,7 @@ public class DefaultSyntaxCheckerRegistr
                 sb.append( ", " );
             }
 
-            SyntaxChecker syntaxChecker = byName.get( name );
+            SyntaxChecker syntaxChecker = entry.getValue();
 
             String fqcn = syntaxChecker.getFqcn();
             int lastDotPos = fqcn.lastIndexOf( '.' );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/OidRegistry.java
Fri May 22 14:44:01 2015
@@ -290,7 +290,7 @@ public class OidRegistry<T extends Schem
         {
             boolean isFirst = true;
 
-            for ( String oid : byOid.keySet() )
+            for ( Map.Entry<String, T> entry : byOid.entrySet() )
             {
                 if ( isFirst )
                 {
@@ -303,7 +303,7 @@ public class OidRegistry<T extends Schem
 
                 sb.append( "<" );
 
-                SchemaObject schemaObject = byOid.get( oid );
+                SchemaObject schemaObject = entry.getValue();
 
                 if ( schemaObject != null )
                 {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/Registries.java
Fri May 22 14:44:01 2015
@@ -1893,14 +1893,16 @@ public class Registries implements Schem
 
         try
         {
-            for ( SchemaObjectWrapper wrapper : usedBy.keySet() )
+            for ( Map.Entry<SchemaObjectWrapper, Set<SchemaObjectWrapper>> entry
: usedBy.entrySet() )
             {
+                SchemaObjectWrapper wrapper = entry.getKey();
+
                 sb.append( wrapper.get().getObjectType() ).append( '[' ).append( wrapper.get().getOid()
)
                     .append( "] : {" );
 
                 boolean isFirst = true;
 
-                for ( SchemaObjectWrapper uses : usedBy.get( wrapper ) )
+                for ( SchemaObjectWrapper uses : entry.getValue() )
                 {
                     if ( isFirst )
                     {
@@ -1937,14 +1939,16 @@ public class Registries implements Schem
 
         try
         {
-            for ( SchemaObjectWrapper wrapper : using.keySet() )
+            for ( Map.Entry<SchemaObjectWrapper, Set<SchemaObjectWrapper>> entry
: using.entrySet() )
             {
+                SchemaObjectWrapper wrapper = entry.getKey();
+
                 sb.append( wrapper.get().getObjectType() ).append( '[' ).append( wrapper.get().getOid()
)
                     .append( "] : {" );
 
                 boolean isFirst = true;
 
-                for ( SchemaObjectWrapper uses : using.get( wrapper ) )
+                for ( SchemaObjectWrapper uses : entry.getValue() )
                 {
                     if ( isFirst )
                     {
@@ -2568,10 +2572,10 @@ public class Registries implements Schem
         // Clone the schema list
         clone.loadedSchemas = new HashMap<String, Schema>();
 
-        for ( String schemaName : loadedSchemas.keySet() )
+        for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet()
)
         {
             // We don't clone the schemas
-            clone.loadedSchemas.put( schemaName, loadedSchemas.get( schemaName ) );
+            clone.loadedSchemas.put( entry.getKey(), loadedSchemas.get( entry.getKey() )
);
         }
 
         // Clone the Using and usedBy structures
@@ -2589,11 +2593,11 @@ public class Registries implements Schem
 
         // Last, not least, clone the SchemaObjects Map, and reference all the copied
         // SchemaObjects
-        for ( String schemaName : schemaObjects.keySet() )
+        for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet()
)
         {
             Set<SchemaObjectWrapper> objects = new HashSet<SchemaObjectWrapper>();
 
-            for ( SchemaObjectWrapper schemaObjectWrapper : schemaObjects.get( schemaName
) )
+            for ( SchemaObjectWrapper schemaObjectWrapper : entry.getValue() )
             {
                 SchemaObject original = schemaObjectWrapper.get();
 
@@ -2617,7 +2621,7 @@ public class Registries implements Schem
                 }
             }
 
-            clone.schemaObjects.put( schemaName, objects );
+            clone.schemaObjects.put( entry.getKey(), objects );
         }
 
         return clone;
@@ -2779,31 +2783,25 @@ public class Registries implements Schem
         }
 
         // Clear the schemaObjects map
-        for ( String schemaName : schemaObjects.keySet() )
+        for ( Map.Entry<String, Set<SchemaObjectWrapper>> entry : schemaObjects.entrySet()
)
         {
-            Set<SchemaObjectWrapper> wrapperSet = schemaObjects.get( schemaName );
-
-            wrapperSet.clear();
+            entry.getValue().clear();
         }
 
         schemaObjects.clear();
 
         // Clear the usedBy map
-        for ( SchemaObjectWrapper wrapper : usedBy.keySet() )
+        for ( Map.Entry<SchemaObjectWrapper, Set<SchemaObjectWrapper>> entry
: usedBy.entrySet() )
         {
-            Set<SchemaObjectWrapper> wrapperSet = usedBy.get( wrapper );
-
-            wrapperSet.clear();
+            entry.getValue().clear();
         }
 
         usedBy.clear();
 
         // Clear the using map
-        for ( SchemaObjectWrapper wrapper : using.keySet() )
+        for ( Map.Entry<SchemaObjectWrapper, Set<SchemaObjectWrapper>> entry
: using.entrySet() )
         {
-            Set<SchemaObjectWrapper> wrapperSet = using.get( wrapper );
-
-            wrapperSet.clear();
+            entry.getValue().clear();
         }
 
         using.clear();

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/JpegSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/JpegSyntaxChecker.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/JpegSyntaxChecker.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/JpegSyntaxChecker.java
Fri May 22 14:44:01 2015
@@ -89,31 +89,27 @@ public class JpegSyntaxChecker extends S
             && ( bytes[1] == ( byte ) 0x00D8 )
             && ( bytes[2] == ( byte ) 0x00FF ) )
         {
-            if ( bytes[3] == ( byte ) 0x00E0 )
+            // JFIF format
+            if ( ( bytes[3] == ( byte ) 0x00E0 )
+                && ( bytes[6] == 'J' )
+                && ( bytes[7] == 'F' )
+                && ( bytes[8] == 'I' )
+                && ( bytes[9] == 'F' )
+                && ( bytes[10] == 0x00 ) )
             {
-                // JFIF format
-                if ( ( bytes[6] == 'J' )
-                    && ( bytes[7] == 'F' )
-                    && ( bytes[8] == 'I' )
-                    && ( bytes[9] == 'F' )
-                    && ( bytes[10] == 0x00 ) )
-                {
-                    LOG.debug( "Syntax valid for '{}'", value );
-                    return true;
-                }
+                LOG.debug( "Syntax valid for '{}'", value );
+                return true;
             }
-            else if ( bytes[3] == ( byte ) 0x00E1 )
-            {
-                // Exif format
-                if ( ( bytes[6] == 'E' )
+        // EXIF Format
+            else if ( ( bytes[3] == ( byte ) 0x00E1 ) 
+                    && ( bytes[6] == 'E' )
                     && ( bytes[7] == 'x' )
                     && ( bytes[8] == 'i' )
                     && ( bytes[9] == 'f' )
                     && ( bytes[10] == 0x00 ) )
-                {
-                    LOG.debug( "Syntax valid for '{}'", value );
-                    return true;
-                }
+            {
+                LOG.debug( "Syntax valid for '{}'", value );
+                return true;
             }
         }
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java?rev=1681130&r1=1681129&r2=1681130&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java
Fri May 22 14:44:01 2015
@@ -402,10 +402,7 @@ public class LdapUrl
                     
                     return currentPos;
                 }
-                else
-                {
-                    //fallback to reg-name
-                }
+                //fallback to reg-name
                 
             case 'a' : case 'b' : case 'c' : case 'd' : case 'e' :
             case 'A' : case 'B' : case 'C' : case 'D' : case 'E' :



Mime
View raw message