directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r655480 [2/11] - in /directory: apacheds/trunk/apacheds-jdbm/src/examples/ apacheds/trunk/apacheds-jdbm/src/main/java/jdbm/btree/ apacheds/trunk/bootstrap-extract/src/main/java/org/apache/directory/server/schema/bootstrap/partition/ apached...
Date Mon, 12 May 2008 11:49:46 GMT
Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Mon May 12 04:49:35 2008
@@ -20,7 +20,6 @@
 
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Set;
@@ -80,7 +79,7 @@
             EntryAttribute attr = entry.get( attributeType );
             
             // Deal with a special case : an entry without any ObjectClass
-            if ( attributeType.getOid() == SchemaConstants.OBJECT_CLASS_AT_OID )
+            if ( attributeType.getOid().equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
             {
                 if ( attr.size() == 0 )
                 {
@@ -91,9 +90,8 @@
             
             Attribute attribute = new AttributeImpl( attributeType.getName() );
             
-            for ( Iterator<Value<?>> iter = attr.iterator(); iter.hasNext();)
+            for ( Value<?> value: attr )
             {
-                Value<?> value = iter.next();
                 attribute.add( value.get() );
             }
             
@@ -114,7 +112,6 @@
      * @throws InvalidAttributeIdentifierException If we had an incorrect attribute
      */
     public static ServerAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
-            throws InvalidAttributeIdentifierException
     {
         if ( attribute == null )
         {
@@ -370,7 +367,7 @@
      *         arguments
      * @throws NamingException if there are problems accessing attribute values
      */
-    public static ServerAttribute getUnion( ServerAttribute attr0, ServerAttribute attr1 ) throws NamingException
+    public static ServerAttribute getUnion( ServerAttribute attr0, ServerAttribute attr1 )
     {
         if ( attr0 == null && attr1 == null )
         {
@@ -391,12 +388,9 @@
 
         ServerAttribute attr = (ServerAttribute)attr0.clone();
 
-        if ( attr0 != null )
+        for ( Value<?> value:attr1 )
         {
-            for ( Value<?> value:attr1 )
-            {
-                attr.add( value );
-            }
+            attr.add( value );
         }
 
         return attr;
@@ -414,7 +408,7 @@
     }
 
 
-    public static Modification toModification( ModificationItemImpl modificationImpl, AttributeType attributeType ) throws InvalidAttributeIdentifierException
+    public static Modification toModification( ModificationItemImpl modificationImpl, AttributeType attributeType ) 
     {
         Modification modification = new ServerModification( 
             modificationImpl.getModificationOp(),
@@ -445,8 +439,8 @@
     }
     
     
-    public static List<Modification> toServerModification( List<ModificationItemImpl> modificationImpls, AttributeTypeRegistry atRegistry )
-        throws NamingException
+    public static List<Modification> toServerModification( List<ModificationItemImpl> modificationImpls, 
+        AttributeTypeRegistry atRegistry ) throws NamingException
     {
         if ( modificationImpls != null )
         {
@@ -470,48 +464,48 @@
     public static List<Modification> toServerModification( ModificationItem[] modifications, 
         AttributeTypeRegistry atRegistry ) throws NamingException
     {
-	    if ( modifications != null )
-	    {
-	        List<Modification> modificationsList = new ArrayList<Modification>();
-	
-	        for ( ModificationItem modification: modifications )
-	        {
-	            String attributeId = modification.getAttribute().getID();
+        if ( modifications != null )
+        {
+            List<Modification> modificationsList = new ArrayList<Modification>();
+    
+            for ( ModificationItem modification: modifications )
+            {
+                String attributeId = modification.getAttribute().getID();
                 String id = stripOptions( attributeId );
-	            Set<String> options = getOptions( attributeId );
+                Set<String> options = getOptions( attributeId );
 
-	            // -------------------------------------------------------------------
-	            // DIRSERVER-646 Fix: Replacing an unknown attribute with no values 
-	            // (deletion) causes an error
-	            // -------------------------------------------------------------------
-	            
+                // -------------------------------------------------------------------
+                // DIRSERVER-646 Fix: Replacing an unknown attribute with no values 
+                // (deletion) causes an error
+                // -------------------------------------------------------------------
+                
                 // TODO - after removing JNDI we need to make the server handle 
-	            // this in the codec
+                // this in the codec
                 
-	            if ( ! atRegistry.hasAttributeType( id ) 
-	                 && modification.getAttribute().size() == 0 
-	                 && modification.getModificationOp() == DirContext.REPLACE_ATTRIBUTE )
-	            {
-	                continue;
-	            }
-
-	            // -------------------------------------------------------------------
-	            // END DIRSERVER-646 Fix
-	            // -------------------------------------------------------------------
-	            
-	            
-	            // TODO : handle options
-	            AttributeType attributeType = atRegistry.lookup( id );
-	            modificationsList.add( toModification( (ModificationItemImpl)modification, attributeType ) );
-	        }
-	    
-	        return modificationsList;
-	    }
-	    else
-	    {
-	        return null;
-	    }
-	}
+                if ( ! atRegistry.hasAttributeType( id ) 
+                     && modification.getAttribute().size() == 0 
+                     && modification.getModificationOp() == DirContext.REPLACE_ATTRIBUTE )
+                {
+                    continue;
+                }
+
+                // -------------------------------------------------------------------
+                // END DIRSERVER-646 Fix
+                // -------------------------------------------------------------------
+                
+                
+                // TODO : handle options
+                AttributeType attributeType = atRegistry.lookup( id );
+                modificationsList.add( toModification( (ModificationItemImpl)modification, attributeType ) );
+            }
+        
+            return modificationsList;
+        }
+        else
+        {
+            return null;
+        }
+    }
 
 
     /**
@@ -564,80 +558,80 @@
      */
     public static NamingEnumeration<SearchResult> toSearchResultEnum( final NamingEnumeration<ServerSearchResult> result )
     {
-    	if ( result instanceof EmptyEnumeration<?> )
-    	{
-    		return new EmptyEnumeration<SearchResult>();
-    	}
-    	
-    	return new NamingEnumeration<SearchResult> ()
-    	{
-    	    public void close() throws NamingException
-    	    {
-    	        result.close();
-    	    }
-
-
-    	    /**
-    	     * @see javax.naming.NamingEnumeration#hasMore()
-    	     */
-    	    public boolean hasMore() throws NamingException
-    	    {
-    	        return result.hasMore();
-    	    }
-
-
-    	    /**
-    	     * @see javax.naming.NamingEnumeration#next()
-    	     */
-    	    public SearchResult next() throws NamingException
-    	    {
-    	        ServerSearchResult rec = result.next();
-    	        
-    	        SearchResult searchResult = new SearchResult( 
-    	        		rec.getDn().getUpName(), 
-    	        		rec.getObject(), 
-    	        		toAttributesImpl( rec.getServerEntry() ), 
-    	        		rec.isRelative() );
-    	        
-    	        return searchResult;
-    	    }
-    	    
-    	    
-    	    /**
-    	     * @see java.util.Enumeration#hasMoreElements()
-    	     */
-    	    public boolean hasMoreElements()
-    	    {
-    	        return result.hasMoreElements();
-    	    }
-
-
-    	    /**
-    	     * @see java.util.Enumeration#nextElement()
-    	     */
-    	    public SearchResult nextElement()
-    	    {
-    	    	try
-    	    	{
-	    	    	ServerSearchResult rec = result.next();
-	
-	    	        SearchResult searchResult = new SearchResult( 
-	    	        		rec.getDn().getUpName(), 
-	    	        		rec.getObject(), 
-	    	        		toAttributesImpl( rec.getServerEntry() ), 
-	    	        		rec.isRelative() );
-	    	        
-	    	        return searchResult;
-    	    	}
-    	    	catch ( NamingException ne )
-    	    	{
-    	            NoSuchElementException nsee = 
-    	                new NoSuchElementException( "Encountered NamingException on underlying enumeration." );
-    	            nsee.initCause( ne );
-    	            throw nsee;
-    	    	}
-    	    }
-    	};
+        if ( result instanceof EmptyEnumeration<?> )
+        {
+            return new EmptyEnumeration<SearchResult>();
+        }
+        
+        return new NamingEnumeration<SearchResult> ()
+        {
+            public void close() throws NamingException
+            {
+                result.close();
+            }
+
+
+            /**
+             * @see javax.naming.NamingEnumeration#hasMore()
+             */
+            public boolean hasMore() throws NamingException
+            {
+                return result.hasMore();
+            }
+
+
+            /**
+             * @see javax.naming.NamingEnumeration#next()
+             */
+            public SearchResult next() throws NamingException
+            {
+                ServerSearchResult rec = result.next();
+                
+                SearchResult searchResult = new SearchResult( 
+                        rec.getDn().getUpName(), 
+                        rec.getObject(), 
+                        toAttributesImpl( rec.getServerEntry() ), 
+                        rec.isRelative() );
+                
+                return searchResult;
+            }
+            
+            
+            /**
+             * @see java.util.Enumeration#hasMoreElements()
+             */
+            public boolean hasMoreElements()
+            {
+                return result.hasMoreElements();
+            }
+
+
+            /**
+             * @see java.util.Enumeration#nextElement()
+             */
+            public SearchResult nextElement()
+            {
+                try
+                {
+                    ServerSearchResult rec = result.next();
+    
+                    SearchResult searchResult = new SearchResult( 
+                            rec.getDn().getUpName(), 
+                            rec.getObject(), 
+                            toAttributesImpl( rec.getServerEntry() ), 
+                            rec.isRelative() );
+                    
+                    return searchResult;
+                }
+                catch ( NamingException ne )
+                {
+                    NoSuchElementException nsee = 
+                        new NoSuchElementException( "Encountered NamingException on underlying enumeration." );
+                    nsee.initCause( ne );
+                    throw nsee;
+                }
+            }
+        };
     }
     
     

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java Mon May 12 04:49:35 2008
@@ -34,8 +34,6 @@
  */
 public class ServerModification implements Modification
 {
-    public static final long serialVersionUID = 1L;
-    
     /** The modification operation */
     private ModificationOperation operation;
     

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerSearchResult.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerSearchResult.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerSearchResult.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerSearchResult.java Mon May 12 04:49:35 2008
@@ -20,7 +20,6 @@
 package org.apache.directory.server.core.entry;
 
 
-import javax.naming.InvalidNameException;
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -31,11 +30,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ServerSearchResult // extends SearchResult
+public class ServerSearchResult
 {
-    /** Unique serial UID */
-    public static final long serialVersionUID = 1L;
-
     /** Distinguished name for this result */
     private LdapDN dn;
     
@@ -49,7 +45,7 @@
     private Object object;
     
 
-    public ServerSearchResult( LdapDN dn, Object obj, ServerEntry serverEntry ) throws InvalidNameException
+    public ServerSearchResult( LdapDN dn, Object obj, ServerEntry serverEntry )
     {
         this.dn = dn;
         this.serverEntry = serverEntry;
@@ -57,7 +53,7 @@
     }
 
 
-    public ServerSearchResult( LdapDN dn, Object obj, ServerEntry serverEntry, boolean isRelative ) throws InvalidNameException
+    public ServerSearchResult( LdapDN dn, Object obj, ServerEntry serverEntry, boolean isRelative )
     {
         this.dn = dn;
         this.serverEntry = serverEntry;
@@ -66,7 +62,7 @@
     }
 
 
-    public ServerSearchResult( LdapDN dn, String className, Object obj, ServerEntry serverEntry ) throws InvalidNameException
+    public ServerSearchResult( LdapDN dn, String className, Object obj, ServerEntry serverEntry )
     {
         this.dn = dn;
         this.serverEntry = serverEntry;
@@ -74,7 +70,7 @@
     }
 
 
-    public ServerSearchResult( LdapDN dn, String className, Object obj, ServerEntry serverEntry, boolean isRelative ) throws InvalidNameException
+    public ServerSearchResult( LdapDN dn, String className, Object obj, ServerEntry serverEntry, boolean isRelative ) 
     {
         this.dn = dn;
         this.serverEntry = serverEntry;
@@ -96,46 +92,46 @@
      */
     public ServerEntry getServerEntry()
     {
-    	return serverEntry;
+        return serverEntry;
     }
 
 
-	public boolean isRelative() 
-	{
-		return isRelative;
-	}
+    public boolean isRelative() 
+    {
+        return isRelative;
+    }
 
 
-	public void setRelative( boolean isRelative ) 
-	{
-		this.isRelative = isRelative;
-	}
+    public void setRelative( boolean isRelative ) 
+    {
+        this.isRelative = isRelative;
+    }
 
 
-	public void setServerEntry( ServerEntry serverEntry ) 
-	{
-		this.serverEntry = serverEntry;
-	}
+    public void setServerEntry( ServerEntry serverEntry ) 
+    {
+        this.serverEntry = serverEntry;
+    }
 
 
-	public Object getObject() 
-	{
-		return object;
-	}
+    public Object getObject() 
+    {
+        return object;
+    }
 
 
-	public void setObject( Object object ) 
-	{
-		this.object = object;
-	}
-	
-	
-	/**
-	 * @see Object#toString()
-	 */
-	public String toString()
-	{
-		String name = (dn == null ? "null" : ( dn == LdapDN.EMPTY_LDAPDN ? "\"\"" : dn.getUpName() ) );
-		return "ServerSearchResult : " + name + "\n" + serverEntry;
-	}
+    public void setObject( Object object ) 
+    {
+        this.object = object;
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        String name = (dn == null ? "null" : ( dn == LdapDN.EMPTY_LDAPDN ? "\"\"" : dn.getUpName() ) );
+        return "ServerSearchResult : " + name + "\n" + serverEntry;
+    }
 }

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerStringValue.java Mon May 12 04:49:35 2008
@@ -19,6 +19,14 @@
 package org.apache.directory.server.core.entry;
 
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Comparator;
+
+import javax.naming.NamingException;
+
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
@@ -28,14 +36,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.Comparator;
-
 
 /**
  * A server side schema aware wrapper around a String attribute value.
@@ -49,7 +49,7 @@
 public class ServerStringValue extends ClientStringValue
 {
     /** Used for serialization */
-    public static final long serialVersionUID = 2L;
+    private static final long serialVersionUID = 2L;
     
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( ServerStringValue.class );

Modified: directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java (original)
+++ directory/apacheds/trunk/core-entry/src/main/java/org/apache/directory/server/core/entry/TestServerEntryUtils.java Mon May 12 04:49:35 2008
@@ -49,7 +49,7 @@
      */
     static class AT extends AbstractAttributeType
     {
-        public static final long serialVersionUID = 0L;
+        private static final long serialVersionUID = 0L;
         AttributeType superior;
         Syntax syntax;
         MatchingRule equality;
@@ -126,7 +126,7 @@
      */
     static class MR extends AbstractMatchingRule
     {
-        public static final long serialVersionUID = 0L;
+        private static final long serialVersionUID = 0L;
         Syntax syntax;
         Comparator comparator;
         Normalizer normalizer;
@@ -177,7 +177,7 @@
      */
     static class S extends AbstractSyntax
     {
-        public static final long serialVersionUID = 0L;
+        private static final long serialVersionUID = 0L;
         SyntaxChecker checker;
 
         public S( String oid, boolean humanReadible )
@@ -266,7 +266,7 @@
         
         mr.normalizer = new Normalizer()
         {
-            public static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 1L;
 
             public Object normalize( Object value ) throws NamingException
             {
@@ -325,24 +325,6 @@
         };
         
         mr.normalizer = new DeepTrimToLowerNormalizer();
-        /*{
-            public static final long serialVersionUID = 1L;
-            
-            public Object normalize( Object value ) throws NamingException
-            {
-                if ( value == null )
-                {  
-                    return null;
-                }
-                
-                if ( value instanceof String )
-                {
-                    return ( ( String ) value ).toLowerCase();
-                }
-
-                throw new IllegalStateException( "expected string to normalize" );
-            }
-        };*/
         
         at.setEquality( mr );
         at.setSyntax( s );
@@ -390,7 +372,7 @@
         
         mr.normalizer = new Normalizer()
         {
-            public static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 1L;
             
             public Object normalize( Object value ) throws NamingException
             {

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Mon May 12 04:49:35 2008
@@ -18,14 +18,6 @@
  */
 package org.apache.directory.server.core.entry;
 
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -56,9 +48,19 @@
 import org.apache.directory.shared.ldap.entry.client.DefaultClientAttribute;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+
 /**
  * Tests for the DefaultServerAttribute class
  * 
@@ -224,7 +226,7 @@
         assertNull( ((ServerStringValue)value).get() );
     }
     
-    @Test public void testGetAttribute() throws NamingException
+    @Test public void testGetAttribute()
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
@@ -247,7 +249,7 @@
     /**
      * Test the contains() method
      */
-    @Test public void testContains() throws NamingException
+    @Test public void testContains()
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         
@@ -1001,7 +1003,7 @@
      * Test method size()
      */
     @Test
-    public void testSize() throws NamingException
+    public void testSize()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atCN );
 
@@ -1165,7 +1167,7 @@
      * Test method put( Value... )
      */
     @Test
-    public void testPutValueArray() throws InvalidAttributeValueException, NamingException
+    public void testPutValueArray()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atCN );
         
@@ -1298,7 +1300,7 @@
      * Test method remove( Value... )
      */
     @Test
-    public void testRemoveValueArray() throws InvalidAttributeValueException, NamingException
+    public void testRemoveValueArray()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atCN );
 
@@ -1368,7 +1370,7 @@
      * Test method remove( byte... )
      */
     @Test
-    public void testRemoveByteArray() throws InvalidAttributeValueException, NamingException
+    public void testRemoveByteArray()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atPwd );
 
@@ -1398,7 +1400,7 @@
      * Test method remove( String... )
      */
     @Test
-    public void testRemoveStringArray() throws InvalidAttributeValueException, NamingException
+    public void testRemoveStringArray()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atCN );
 
@@ -1501,7 +1503,7 @@
      * Test method setUpId( String, AttributeType )
      */
     @Test
-    public void testSetUpIdStringAttributeType() throws NamingException
+    public void testSetUpIdStringAttributeType()
     {
         ServerAttribute attr = new DefaultServerAttribute( atSN );
         
@@ -1557,7 +1559,7 @@
      * Test method setUpId( String ) inherited from ClientAttribute
      */
     @Test
-    public void testSetUpIdString() throws NamingException
+    public void testSetUpIdString()
     {
         ServerAttribute attr = new DefaultServerAttribute( atCN );
         
@@ -1634,7 +1636,7 @@
      * Test method getAttributeType()
      */
     @Test
-    public void testGetAttributeType() throws NamingException
+    public void testGetAttributeType()
     {
         ServerAttribute attr = new DefaultServerAttribute( atSN );
         
@@ -1694,7 +1696,7 @@
      * Test constructor DefaultServerAttribute( AttributeType, Value... )
      */
     @Test
-    public void testDefaultServerAttributeAttributeTypeValueArray() throws NamingException
+    public void testDefaultServerAttributeAttributeTypeValueArray()
     {
         ServerAttribute attr1 = new DefaultServerAttribute( atCN, STR_VALUE1, STR_VALUE2, NULL_STRING_VALUE );
         

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java Mon May 12 04:49:35 2008
@@ -55,16 +55,18 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.assertNotNull;
+
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.junit.BeforeClass;
+import org.junit.Test;
+
 
 /**
  * Test the DefaultServerEntry class.
@@ -136,7 +138,7 @@
      * Test for method DefaultServerEntry()
      */
     @Test
-    public void testDefaultServerEntry() throws NamingException
+    public void testDefaultServerEntry()
     {
         Entry entry = new DefaultServerEntry();
         assertNotNull( entry );
@@ -149,7 +151,7 @@
      * Test for method DefaultServerEntry( registries )
      */
     @Test
-    public void testDefaultServerEntryRegistries() throws NamingException
+    public void testDefaultServerEntryRegistries()
     {
         Entry entry = new DefaultServerEntry( registries );
         assertNotNull( entry );
@@ -162,7 +164,7 @@
      * Test for method DefaultServerEntry( registries, LdapDN )
      */
     @Test
-    public void testDefaultServerEntryRegistriesDN() throws NamingException
+    public void testDefaultServerEntryRegistriesDN()
     {
         Entry entry = new DefaultServerEntry( registries, EXAMPLE_DN );
         assertNotNull( entry );
@@ -175,7 +177,7 @@
      * Test for method DefaultServerEntry( registries, LdapDN, AttributeType... )
      */
     @Test
-    public void testDefaultServerEntryRegistriesDNAttributeTypeArray() throws NamingException
+    public void testDefaultServerEntryRegistriesDNAttributeTypeArray()
     {
         ServerEntry entry = new DefaultServerEntry( registries, EXAMPLE_DN, atOC, atPwd, atCN );
         assertNotNull( entry );
@@ -191,7 +193,7 @@
      * Test for method DefaultServerEntry( registries, LdapDN, AttributeType, upId )
      */
     @Test
-    public void testDefaultServerEntryRegistriesDNAttributeTypeUpId() throws NamingException
+    public void testDefaultServerEntryRegistriesDNAttributeTypeUpId()
     {
         ServerEntry entry = new DefaultServerEntry( registries, EXAMPLE_DN, atOC, "  OBJECTCLASS  " );
         assertNotNull( entry );
@@ -207,7 +209,7 @@
      * Test for method DefaultServerEntry( registries, LdapDN, AttributeType, upId )
      */
     @Test
-    public void testDefaultServerEntryRegistriesDNUpIdArray() throws NamingException
+    public void testDefaultServerEntryRegistriesDNUpIdArray()
     {
         ServerEntry entry = new DefaultServerEntry( registries, EXAMPLE_DN, "  OBJECTCLASS  ", " Cn " );
         assertNotNull( entry );
@@ -641,8 +643,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test a simple addition
         entry.add( atCN, "test1" );
         assertNotNull( entry.get( atCN ) );
@@ -749,7 +749,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
         AttributeType atPassword = registries.getAttributeTypeRegistry().lookup( "userPassword" );
         
         byte[] b1 = StringTools.getBytesUtf8( "test1" );
@@ -855,8 +854,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test a simple addition
         entry.add( "CN", "test1" );
         assertNotNull( entry.get( atCN ) );
@@ -966,7 +963,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         ServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
         AttributeType atPassword = registries.getAttributeTypeRegistry().lookup( "userPassword" );
         
         byte[] b1 = StringTools.getBytesUtf8( "test1" );
@@ -1078,8 +1074,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test a simple addition
         entry.add( "cn", atCN, "test1" );
         assertNotNull( entry.get( atCN ) );
@@ -1186,7 +1180,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         ServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
         AttributeType atPassword = registries.getAttributeTypeRegistry().lookup( "userPassword" );
         
         byte[] b1 = StringTools.getBytesUtf8( "test1" );
@@ -2561,9 +2554,8 @@
             assertTrue( true );
         }
         
-        // Ajout de serverAttributes
-        AttributeType atL = registries.getAttributeTypeRegistry().lookup( "localityName" );
-        AttributeType atC = registries.getAttributeTypeRegistry().lookup( "countryName" );
+        // Adding some serverAttributes
+        //AttributeType atCo = registries.getAttributeTypeRegistry().lookup( "countryName" );
         AttributeType atGN = registries.getAttributeTypeRegistry().lookup( "givenname" );
         AttributeType atStreet = registries.getAttributeTypeRegistry().lookup( "2.5.4.9" );
 
@@ -2631,8 +2623,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-
         // Test an empty AT
         entry.put( atCN, (String)null );
         assertEquals( 1, entry.size() );
@@ -2690,8 +2680,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atPwd = registries.getAttributeTypeRegistry().lookup( "userPassword" );
-
         // Test an empty AT
         entry.put( atPwd, (byte[])null );
         assertEquals( 1, entry.size() );
@@ -2755,7 +2743,6 @@
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
         // Adding a null value to an attribute
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
         entry.put( atCN, (Value<?>)null );
         
         assertEquals( 1, entry.size() );
@@ -2817,8 +2804,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Adding a null value should be possible
         entry.put( "cn", (String)null );
         
@@ -2944,8 +2929,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test that we get an error when the ID or AT are null
         try
         {
@@ -3092,8 +3075,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test that we get an error when the ID or AT are null
         try
         {
@@ -3172,8 +3153,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
-        
         // Test that we get an error when the ID or AT are null
         try
         {
@@ -3507,7 +3486,6 @@
         LdapDN dn = new LdapDN( "cn=test" );
         DefaultServerEntry entry = new DefaultServerEntry( registries, dn );
         
-        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
         AttributeType atPassword = registries.getAttributeTypeRegistry().lookup( "userPassword" );
         
         byte[] b1 = StringTools.getBytesUtf8( "test1" );
@@ -3574,7 +3552,6 @@
         assertNull( result );
         
         // Now, check what we get when adding one existing AT
-        AttributeType atSN = registries.getAttributeTypeRegistry().lookup( "sn" );
         result = entry.set( atSN );
         
         assertNull( result );
@@ -3584,8 +3561,6 @@
         assertEquals( "sn", ((ServerAttribute)sa).getAttributeType().getName() );
         
         // Add two AT now
-        AttributeType atL = registries.getAttributeTypeRegistry().lookup( "localityName" );
-        AttributeType atC = registries.getAttributeTypeRegistry().lookup( "countryName" );
         AttributeType atGN = registries.getAttributeTypeRegistry().lookup( "givenname" );
         AttributeType atStreet = registries.getAttributeTypeRegistry().lookup( "2.5.4.9" );
         result = entry.set( atL, atC, atGN, atStreet );
@@ -3670,8 +3645,6 @@
         assertEquals( "sn", sa.getId() );
         
         // Add different upIds now
-        AttributeType atL = registries.getAttributeTypeRegistry().lookup( "localityName" );
-        AttributeType atC = registries.getAttributeTypeRegistry().lookup( "countryName" );
         AttributeType atGN = registries.getAttributeTypeRegistry().lookup( "givenname" );
         AttributeType atStreet = registries.getAttributeTypeRegistry().lookup( "2.5.4.9" );
         

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java Mon May 12 04:49:35 2008
@@ -20,16 +20,6 @@
 package org.apache.directory.server.core.entry;
 
 
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
-import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.naming.NamingException;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -37,13 +27,24 @@
 import java.io.ObjectOutputStream;
 import java.util.Arrays;
 
+import javax.naming.NamingException;
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
+import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
+import org.apache.directory.shared.ldap.util.StringTools;
+
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.junit.Before;
+import org.junit.Test;
+
 
 /**
  * Tests that the ServerBinaryValue class works properly as expected.
@@ -80,7 +81,7 @@
         mr.comparator = new ByteArrayComparator();
         mr.normalizer = new Normalizer()
         {
-            public static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 1L;
             
             public Object normalize( Object value ) throws NamingException
             {
@@ -126,11 +127,11 @@
         }
         
         // create a AT without any syntax
-        AttributeType at = new TestServerEntryUtils.AT( "1.1.3.1" );
+        AttributeType attribute = new TestServerEntryUtils.AT( "1.1.3.1" );
         
         try
         {
-            new ServerBinaryValue( at );
+            new ServerBinaryValue( attribute );
             fail();
         }
         catch ( IllegalArgumentException ae )
@@ -145,9 +146,9 @@
      */
     @Test public void testServerBinaryValueNullValue()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, null );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, null );
         
         assertNull( value.getReference() );
         assertTrue( value.isNull() );
@@ -159,9 +160,9 @@
      */
     @Test public void testServerBinaryValueEmptyValue()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, StringTools.EMPTY_BYTES );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, StringTools.EMPTY_BYTES );
         
         assertEquals( StringTools.EMPTY_BYTES, value.getReference() );
         assertFalse( value.isNull() );
@@ -173,9 +174,9 @@
      */
     @Test public void testServerBinaryValueNoValue()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         byte[] val = new byte[]{0x01};
-        ServerBinaryValue value = new ServerBinaryValue( at );
+        ServerBinaryValue value = new ServerBinaryValue( attribute );
         
         value.set( val );
         assertTrue( Arrays.equals( val, value.getReference() ) );
@@ -189,9 +190,9 @@
      */
     @Test public void testServerBinaryValue()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         byte[] val = new byte[]{0x01};
-        ServerBinaryValue value = new ServerBinaryValue( at, val );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, val );
         
         assertTrue( Arrays.equals( val, value.getReference() ) );
         assertFalse( value.isNull() );
@@ -208,7 +209,7 @@
         AttributeType at1 = TestServerEntryUtils.getBytesAttributeType();
         ServerBinaryValue sbv = new ServerBinaryValue( at1, null );
         
-        ServerBinaryValue sbv1 = (ServerBinaryValue)sbv.clone();
+        ServerBinaryValue sbv1 = sbv.clone();
         
         assertEquals( sbv, sbv1 );
         
@@ -218,7 +219,7 @@
         assertTrue( Arrays.equals( StringTools.EMPTY_BYTES, sbv.get() ) );
         
         sbv.set(  BYTES2 );
-        sbv1 = (ServerBinaryValue)sbv.clone();
+        sbv1 = sbv.clone();
         
         assertEquals( sbv, sbv1 );
         
@@ -262,17 +263,17 @@
     /**
      * Test the getNormalizedValue method
      */
-    @Test public void testGetNormalizedValue() throws NamingException
+    @Test public void testGetNormalizedValue()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, null );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, null );
         assertNull( value.getNormalizedValue() );
 
-        value = new ServerBinaryValue( at, StringTools.EMPTY_BYTES );
+        value = new ServerBinaryValue( attribute, StringTools.EMPTY_BYTES );
         assertTrue( Arrays.equals(  StringTools.EMPTY_BYTES, value.getNormalizedValue() ) );
 
-        value = new ServerBinaryValue( at, BYTES2 );
+        value = new ServerBinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormalizedValue() ) );
     }
     
@@ -280,17 +281,17 @@
     /**
      * Test the getNormalizedValue method
      */
-    @Test public void testGetNormalizedValueCopy() throws NamingException
+    @Test public void testGetNormalizedValueCopy()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, null );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, null );
         assertNull( value.getNormalizedValueCopy() );
 
-        value = new ServerBinaryValue( at, StringTools.EMPTY_BYTES );
+        value = new ServerBinaryValue( attribute, StringTools.EMPTY_BYTES );
         assertTrue( Arrays.equals(  StringTools.EMPTY_BYTES, value.getNormalizedValueCopy() ) );
 
-        value = new ServerBinaryValue( at, BYTES2 );
+        value = new ServerBinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormalizedValueCopy() ) );
     }
     
@@ -298,17 +299,17 @@
     /**
      * Test the getNormalizedValue method
      */
-    @Test public void testGetNormalizedValueReference() throws NamingException
+    @Test public void testGetNormalizedValueReference()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, null );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, null );
         assertNull( value.getNormalizedValueReference() );
 
-        value = new ServerBinaryValue( at, StringTools.EMPTY_BYTES );
+        value = new ServerBinaryValue( attribute, StringTools.EMPTY_BYTES );
         assertTrue( Arrays.equals(  StringTools.EMPTY_BYTES, value.getNormalizedValueReference() ) );
 
-        value = new ServerBinaryValue( at, BYTES2 );
+        value = new ServerBinaryValue( attribute, BYTES2 );
         assertTrue( Arrays.equals( BYTES1, value.getNormalizedValueReference() ) );
     }
     
@@ -317,12 +318,12 @@
      * Test the getAttributeType method
      */
     @Test
-    public void testgetAttributeType() throws NamingException
+    public void testgetAttributeType()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
-        ServerBinaryValue sbv = new ServerBinaryValue( at );
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
+        ServerBinaryValue sbv = new ServerBinaryValue( attribute );
         
-        assertEquals( at, sbv.getAttributeType() );
+        assertEquals( attribute, sbv.getAttributeType() );
     }    
 
     
@@ -331,20 +332,20 @@
      * 
      * The SyntaxChecker does not accept values longer than 5 chars.
      */
-    @Test public void testIsValid() throws NamingException
+    @Test public void testIsValid()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        ServerBinaryValue value = new ServerBinaryValue( at, null );
+        ServerBinaryValue value = new ServerBinaryValue( attribute, null );
         assertTrue( value.isValid() );
         
-        value = new ServerBinaryValue( at, StringTools.EMPTY_BYTES );
+        value = new ServerBinaryValue( attribute, StringTools.EMPTY_BYTES );
         assertTrue( value.isValid() );
 
-        value = new ServerBinaryValue( at, new byte[]{0x01, 0x02} );
+        value = new ServerBinaryValue( attribute, new byte[]{0x01, 0x02} );
         assertTrue( value.isValid() );
 
-        value = new ServerBinaryValue( at, new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06} );
+        value = new ServerBinaryValue( attribute, new byte[]{0x01, 0x02, 0x03, 0x04, 0x05, 0x06} );
         assertFalse( value.isValid() );
     }
     
@@ -353,12 +354,12 @@
      * Tests to make sure the hashCode method is working properly.
      * @throws Exception on errors
      */
-    @Test public void testHashCode() throws Exception
+    @Test public void testHashCode()
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
-        ServerBinaryValue v0 = new ServerBinaryValue( at, new byte[]{0x01, 0x02} );
-        ServerBinaryValue v1 = new ServerBinaryValue( at, new byte[]{(byte)0x81, (byte)0x82} );
-        ServerBinaryValue v2 = new ServerBinaryValue( at, new byte[]{0x01, 0x02} );
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
+        ServerBinaryValue v0 = new ServerBinaryValue( attribute, new byte[]{0x01, 0x02} );
+        ServerBinaryValue v1 = new ServerBinaryValue( attribute, new byte[]{(byte)0x81, (byte)0x82} );
+        ServerBinaryValue v2 = new ServerBinaryValue( attribute, new byte[]{0x01, 0x02} );
         assertEquals( v0.hashCode(), v1.hashCode() );
         assertEquals( v1.hashCode(), v2.hashCode() );
         assertEquals( v0.hashCode(), v2.hashCode() );
@@ -369,7 +370,7 @@
         assertTrue( v1.isValid() );
         assertTrue( v2.isValid() );
 
-        ServerBinaryValue v3 = new ServerBinaryValue( at, new byte[]{0x01, 0x03} );
+        ServerBinaryValue v3 = new ServerBinaryValue( attribute, new byte[]{0x01, 0x03} );
         assertFalse( v3.equals( v0 ) );
         assertFalse( v3.equals( v1 ) );
         assertFalse( v3.equals( v2 ) );
@@ -383,8 +384,8 @@
     @Test
     public void testSame() throws NamingException
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
-        ServerBinaryValue sbv = new ServerBinaryValue( at );
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
+        ServerBinaryValue sbv = new ServerBinaryValue( attribute );
 
         sbv.normalize();
         assertTrue( sbv.isSame() );
@@ -409,14 +410,14 @@
     @Test
     public void testInstanceOf() throws NamingException
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
-        ServerBinaryValue sbv = new ServerBinaryValue( at );
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
+        ServerBinaryValue sbv = new ServerBinaryValue( attribute );
         
-        assertTrue( sbv.instanceOf( at ) );
+        assertTrue( sbv.instanceOf( attribute ) );
         
-        at = TestServerEntryUtils.getIA5StringAttributeType();
+        attribute = TestServerEntryUtils.getIA5StringAttributeType();
         
-        assertFalse( sbv.instanceOf( at ) );
+        assertFalse( sbv.instanceOf( attribute ) );
     }    
     
 
@@ -426,8 +427,8 @@
     @Test
     public void testNormalize() throws NamingException
     {
-        AttributeType at = TestServerEntryUtils.getBytesAttributeType();
-        ServerBinaryValue sbv = new ServerBinaryValue( at );
+        AttributeType attribute = TestServerEntryUtils.getBytesAttributeType();
+        ServerBinaryValue sbv = new ServerBinaryValue( attribute );
 
         sbv.normalize();
         assertEquals( null, sbv.getNormalizedValue() );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerEntrySerializerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerEntrySerializerTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerEntrySerializerTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerEntrySerializerTest.java Mon May 12 04:49:35 2008
@@ -43,9 +43,11 @@
 import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.util.StringTools;
+
+import static org.junit.Assert.assertEquals;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+
 
 /**
  * Test the ServerEntry serialization/deserialization class
@@ -96,14 +98,15 @@
 
         oidOids.put( "dc", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
         oidOids.put( "domaincomponent", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
-        oidOids.put( "0.9.2342.19200300.100.1.25", new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
+        oidOids.put( "0.9.2342.19200300.100.1.25", 
+            new OidNormalizer( "0.9.2342.19200300.100.1.25", new DeepTrimToLowerNormalizer() ) );
         oidOids.put( "ou", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
         oidOids.put( "organizationalUnitName", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
         oidOids.put( "2.5.4.11", new OidNormalizer( "2.5.4.11", new DeepTrimToLowerNormalizer() ) );
     }
 
     
-    @Test public void testSerializeEmtpyServerEntry() throws IOException, NamingException, ClassNotFoundException
+    @Test public void testSerializeEmtpyServerEntry() throws IOException
     {
         LdapDN dn = LdapDN.EMPTY_LDAPDN;
         ServerEntry entry = new DefaultServerEntry( registries, dn );
@@ -117,7 +120,7 @@
         assertEquals( entry, result );
     }
 
-    @Test public void testSerializeDNServerEntry() throws IOException, NamingException, ClassNotFoundException
+    @Test public void testSerializeDNServerEntry() throws IOException, NamingException
     {
         LdapDN dn = new LdapDN( "cn=text, dc=example, dc=com" );
         dn.normalize( oids );
@@ -134,7 +137,7 @@
     }
 
 
-    @Test public void testSerializeServerEntryOC() throws IOException, NamingException, ClassNotFoundException
+    @Test public void testSerializeServerEntryOC() throws IOException, NamingException
     {
         LdapDN dn = new LdapDN( "cn=text, dc=example, dc=com" );
         dn.normalize( oids );
@@ -152,7 +155,7 @@
     }
 
 
-    @Test public void testSerializeServerEntry() throws IOException, NamingException, ClassNotFoundException
+    @Test public void testSerializeServerEntry() throws IOException, NamingException
     {
         LdapDN dn = new LdapDN( "cn=text, dc=example, dc=com" );
         dn.normalize( oids );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerModificationTest.java Mon May 12 04:49:35 2008
@@ -19,14 +19,14 @@
  */
 package org.apache.directory.server.core.entry;
 
-import javax.naming.NamingException;
-
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.junit.Test;
-import static org.junit.Assert.assertTrue;
+
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
 
 
 /**
@@ -37,7 +37,7 @@
  */
 public class ServerModificationTest
 {
-    @Test public void testCreateServerModification() throws NamingException
+    @Test public void testCreateServerModification()
     {
         AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
         ServerAttribute attribute = new DefaultServerAttribute( at );

Modified: directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java (original)
+++ directory/apacheds/trunk/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerStringValueTest.java Mon May 12 04:49:35 2008
@@ -20,18 +20,6 @@
 package org.apache.directory.server.core.entry;
 
 
-import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
-import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
-import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
-import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.naming.NamingException;
-import javax.naming.directory.InvalidAttributeValueException;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -43,15 +31,28 @@
 import java.util.HashSet;
 import java.util.List;
 
-import jdbm.helper.StringComparator;
+import javax.naming.NamingException;
+import javax.naming.directory.InvalidAttributeValueException;
+
+import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
+import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import org.junit.Before;
+import org.junit.Test;
+
+import jdbm.helper.StringComparator;
+
 
 /**
  * Tests that the ServerStringValue class works properly as expected.
@@ -98,9 +99,9 @@
     @Test 
     public void testServerStringValueNullValue()
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( at, null );
+        ServerStringValue value = new ServerStringValue( attribute, null );
         
         assertNull( value.get() );
         assertTrue( value.isNull() );
@@ -110,11 +111,11 @@
     /**
      * Test the getNormalizedValue method
      */
-    @Test public void testGetNormalizedValue() throws NamingException
+    @Test public void testGetNormalizedValue()
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( at, null );
+        ServerStringValue value = new ServerStringValue( attribute, null );
         
         assertFalse( value.isNormalized() );
         assertNull( value.getNormalizedValue() );
@@ -137,11 +138,11 @@
      * 
      * The SyntaxChecker does not accept values longer than 5 chars.
      */
-    @Test public void testIsValid() throws NamingException
+    @Test public void testIsValid()
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
         
-        ServerStringValue value = new ServerStringValue( at, null );
+        ServerStringValue value = new ServerStringValue( attribute, null );
         assertTrue( value.isValid() );
 
         value.set( "" );
@@ -161,8 +162,8 @@
     @Test
     public void testNormalize() throws NamingException
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( at );
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        ServerStringValue ssv = new ServerStringValue( attribute );
 
         ssv.normalize();
         assertEquals( null, ssv.getNormalizedValue() );
@@ -183,14 +184,14 @@
     @Test
     public void testInstanceOf() throws NamingException
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( at );
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        ServerStringValue ssv = new ServerStringValue( attribute );
         
-        assertTrue( ssv.instanceOf( at ) );
+        assertTrue( ssv.instanceOf( attribute ) );
         
-        at = TestServerEntryUtils.getBytesAttributeType();
+        attribute = TestServerEntryUtils.getBytesAttributeType();
         
-        assertFalse( ssv.instanceOf( at ) );
+        assertFalse( ssv.instanceOf( attribute ) );
     }    
     
 
@@ -198,12 +199,12 @@
      * Test the getAttributeType method
      */
     @Test
-    public void testgetAttributeType() throws NamingException
+    public void testgetAttributeType()
     {
-        AttributeType at = TestServerEntryUtils.getIA5StringAttributeType();
-        ServerStringValue ssv = new ServerStringValue( at );
+        AttributeType attribute = TestServerEntryUtils.getIA5StringAttributeType();
+        ServerStringValue ssv = new ServerStringValue( attribute );
         
-        assertEquals( at, ssv.getAttributeType() );
+        assertEquals( attribute, ssv.getAttributeType() );
     }    
 
     
@@ -260,11 +261,11 @@
         }
         
         // create a AT without any syntax
-        AttributeType at = new TestServerEntryUtils.AT( "1.1.3.1" );
+        AttributeType attribute = new TestServerEntryUtils.AT( "1.1.3.1" );
         
         try
         {
-            new ServerStringValue( at );
+            new ServerStringValue( attribute );
             fail();
         }
         catch ( IllegalArgumentException iae )
@@ -278,7 +279,7 @@
      * Tests to make sure the hashCode method is working properly.
      * @throws Exception on errors
      */
-    @Test public void testHashCode() throws Exception
+    @Test public void testHashCode()
     {
         AttributeType at1 = TestServerEntryUtils.getCaseIgnoringAttributeNoNumbersType();
         ServerStringValue v0 = new ServerStringValue( at1, "Alex" );
@@ -337,7 +338,7 @@
         AttributeType at1 = TestServerEntryUtils.getCaseIgnoringAttributeNoNumbersType();
         ServerStringValue ssv = new ServerStringValue( at1, "Test" );
         
-        ServerStringValue ssv1 = (ServerStringValue)ssv.clone();
+        ServerStringValue ssv1 = ssv.clone();
         
         assertEquals( ssv, ssv1 );
         
@@ -347,7 +348,7 @@
         assertEquals( "", ssv.get() );
         
         ssv.set(  "  This is    a   TEST  " );
-        ssv1 = (ServerStringValue)ssv.clone();
+        ssv1 = ssv.clone();
         
         assertEquals( ssv, ssv1 );
         
@@ -364,7 +365,7 @@
      *
      * @throws Exception on errors
      */
-    @Test public void testConstrainedString() throws Exception
+    @Test public void testConstrainedString()
     {
         s.setSyntaxChecker( new SyntaxChecker() {
             public String getSyntaxOid() { return "1.1.1.1"; }
@@ -378,7 +379,7 @@
                 return false;
             }
             public void assertSyntax( Object value ) throws NamingException
-            { if ( ! isValidSyntax( value ) ) throw new InvalidAttributeValueException(); }
+            { if ( ! isValidSyntax( value ) ) {throw new InvalidAttributeValueException(); }}
         });
 
         mr.syntax = s;
@@ -405,18 +406,18 @@
                 int i1 = getValue( o1 );
                 int i2 = getValue( o2 );
 
-                if ( i1 == i2 ) return 0;
-                if ( i1 > i2 ) return 1;
-                if ( i1 < i2 ) return -1;
+                if ( i1 == i2 ) { return 0; }
+                if ( i1 > i2 ) { return 1; }
+                if ( i1 < i2 ) { return -1; }
 
                 throw new IllegalStateException( "should not get here at all" );
             }
 
-            int getValue( String val )
+            public int getValue( String val )
             {
-                if ( val.equals( "LOW" ) ) return 0;
-                if ( val.equals( "MEDIUM" ) ) return 1;
-                if ( val.equals( "HIGH" ) ) return 2;
+                if ( val.equals( "LOW" ) ) { return 0; }
+                if ( val.equals( "MEDIUM" ) ) { return 1; }
+                if ( val.equals( "HIGH" ) ) { return 2; }
                 throw new IllegalArgumentException( "Not a valid value" );
             }
         };
@@ -509,7 +510,7 @@
      * is still OK.
      * @throws Exception on errors
      */
-    @Test public void testAcceptAllNoNormalization() throws Exception
+    @Test public void testAcceptAllNoNormalization()
     {
         // check that normalization and syntax checks work as expected
         ServerStringValue value = new ServerStringValue( at, "hello" );
@@ -582,9 +583,9 @@
                 {
                     return mr.getComparator().compare( n1, n2 );
                 }
-                catch ( Exception e )
+                catch ( NamingException ne )
                 {
-                    throw new IllegalStateException( "Normalization and comparison should succeed!", e );
+                    throw new IllegalStateException( "Normalization and comparison should succeed!", ne );
                 }
             }
         };

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchIT.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchIT.java Mon May 12 04:49:35 2008
@@ -443,7 +443,7 @@
                 SearchResult result = ( SearchResult ) list.next();
                 
                 // leep 201 ms before fetching the next element ...
-            	Thread.sleep( 201 );
+                Thread.sleep( 201 );
                 map.put( result.getName(), result.getAttributes() );
             }
             

Modified: directory/apacheds/trunk/core-plugin/src/main/antlr/openldap.g
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-plugin/src/main/antlr/openldap.g?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-plugin/src/main/antlr/openldap.g (original)
+++ directory/apacheds/trunk/core-plugin/src/main/antlr/openldap.g Mon May 12 04:49:35 2008
@@ -306,31 +306,31 @@
         }
         else
         {
-	        String desc = elems[1];
-	        String[] quoted = desc.split( "\"" );
-	
-	        if ( quoted.length == 1 )
-	        {
-	            objectClass.setDescription( desc );
-	        }
-	        else
-	        {
-	            StringBuffer buf = new StringBuffer();
-	            for ( int ii = 0; ii < quoted.length; ii++ )
-	            {
-	                if ( ii < quoted.length - 1 )
-	                {
-	                    buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
-	                }
-	                else
-	                {
-	                    buf.append( quoted[ii] );
-	                }
-	            }
-	
-	            objectClass.setDescription( buf.toString() );
-	        }
-	    }
+            String desc = elems[1];
+            String[] quoted = desc.split( "\"" );
+    
+            if ( quoted.length == 1 )
+            {
+                objectClass.setDescription( desc );
+            }
+            else
+            {
+                StringBuffer buf = new StringBuffer();
+                for ( int ii = 0; ii < quoted.length; ii++ )
+                {
+                    if ( ii < quoted.length - 1 )
+                    {
+                        buf.append( quoted[ii] ).append( "\\" ).append( "\"" );
+                    }
+                    else
+                    {
+                        buf.append( quoted[ii] );
+                    }
+                }
+    
+                objectClass.setDescription( buf.toString() );
+            }
+        }
     }
     ;
 

Modified: directory/apacheds/trunk/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java (original)
+++ directory/apacheds/trunk/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java Mon May 12 04:49:35 2008
@@ -59,8 +59,8 @@
     public static final Logger LOG = LoggerFactory.getLogger( AbstractTestCase.class );
 
     public static final String LDIF = 
-    	"dn: uid=akarasulu,ou=users,ou=system\n" + 
-    	"cn: Alex Karasulu\n" +
+        "dn: uid=akarasulu,ou=users,ou=system\n" + 
+        "cn: Alex Karasulu\n" +
         "sn: Karasulu\n" + 
         "givenname: Alex\n" + 
         "objectclass: top\n" + 
@@ -179,7 +179,7 @@
         // -------------------------------------------------------------------
 
         LdifReader reader = new LdifReader();
-    	List<LdifEntry> entries = reader.parseLdif( LDIF );
+        List<LdifEntry> entries = reader.parseLdif( LDIF );
         LdifEntry entry = entries.get(0);
         testEntries.add( entry );
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java Mon May 12 04:49:35 2008
@@ -20,12 +20,12 @@
 package org.apache.directory.server.core.authn;
 
 
+import javax.naming.NamingException;
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.NamingException;
-
 
 /**
  * Base class for all Authenticators.

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Mon May 12 04:49:35 2008
@@ -20,6 +20,10 @@
 package org.apache.directory.server.core.authn;
 
 
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -60,10 +64,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
 
 /**
  * An {@link Interceptor} that authenticates users.
@@ -384,7 +384,8 @@
     }
 
 
-    public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) throws NamingException
+    public NamingEnumeration<ServerSearchResult> search( NextInterceptor next, SearchOperationContext opContext ) 
+        throws NamingException
     {
         if ( IS_DEBUG )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java Mon May 12 04:49:35 2008
@@ -20,13 +20,14 @@
 package org.apache.directory.server.core.authn;
 
 
+import javax.naming.Context;
+import javax.naming.NamingException;
+
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
 
 
 /**
@@ -51,21 +52,21 @@
      * Returns the type of this authenticator (e.g. <tt>'simple'</tt>,
      * <tt>'none'</tt>,...).
      */
-    public String getAuthenticatorType();
+    String getAuthenticatorType();
 
 
     /**
      * Called by {@link AuthenticationInterceptor} to indicate that this
      * authenticator is being placed into service.
      */
-    public void init( DirectoryService directoryService ) throws NamingException;
+    void init( DirectoryService directoryService ) throws NamingException;
 
 
     /**
      * Called by {@link AuthenticationInterceptor} to indicate that this
      * authenticator is being removed from service.
      */
-    public void destroy();
+    void destroy();
 
     /**
      * Callback used to respond to password changes by invalidating a password
@@ -75,10 +76,10 @@
      * 
      * @param bindDn the already normalized distinguished name of the bind principal
      */
-    public void invalidateCache( LdapDN bindDn );
+    void invalidateCache( LdapDN bindDn );
 
     /**
      * Performs authentication and returns the principal if succeeded.
      */
-    public LdapPrincipal authenticate( LdapDN bindDn, ServerContext ctx ) throws NamingException;
+    LdapPrincipal authenticate( LdapDN bindDn, ServerContext ctx ) throws NamingException;
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java Mon May 12 04:49:35 2008
@@ -86,7 +86,8 @@
     {
         this.name = name;
         this.authenticationLevel = authenticationLevel;
-        this.userPassword = userPassword;
+        this.userPassword = new byte[ userPassword.length ];
+        System.arraycopy( userPassword, 0, this.userPassword, 0, userPassword.length );
     }
 
 
@@ -152,6 +153,7 @@
 
     public void setUserPassword( byte[] userPassword )
     {
-        this.userPassword = userPassword;
+        this.userPassword = new byte[ userPassword.length ];
+        System.arraycopy( userPassword, 0, this.userPassword, 0, userPassword.length );
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Mon May 12 04:49:35 2008
@@ -34,23 +34,23 @@
 import javax.naming.NamingException;
 
 import org.apache.commons.collections.map.LRUMap;
+import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
+import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerStringValue;
+import org.apache.directory.server.core.event.EventInterceptor;
+import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.invocation.InvocationStack;
 import org.apache.directory.server.core.jndi.ServerContext;
-import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.server.core.normalization.NormalizationInterceptor;
-import org.apache.directory.server.core.referral.ReferralInterceptor;
-import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
-import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
-import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.operational.OperationalAttributeInterceptor;
+import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.referral.ReferralInterceptor;
 import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.subtree.SubentryInterceptor;
-import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
-import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.server.core.entry.ServerStringValue;
-import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.trigger.TriggerInterceptor;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
@@ -177,8 +177,8 @@
         
         private EncryptionMethod( LdapSecurityConstants algorithm, byte[] salt )
         {
-        	this.algorithm = algorithm;
-        	this.salt = salt;
+            this.algorithm = algorithm;
+            this.salt = salt;
         }
     }
     
@@ -321,7 +321,7 @@
                 LOG.debug( "{} Authenticated", principalDn );
             }
             
-        	return principal;
+            return principal;
         }
         
         // Let's see if the stored password was encrypted
@@ -414,7 +414,8 @@
                     // in two parts, after having decoded the password.
                     // The salt will be stored into the EncryptionMethod structure
                     // The salt is at the end of the credentials, and is 8 bytes long
-                    byte[] passwordAndSalt = Base64.decode( new String( credentials, pos, credentials.length - pos, "UTF-8" ).toCharArray() );
+                    byte[] passwordAndSalt = Base64.decode( new String( credentials, pos, credentials.length - pos, "UTF-8" ).
+                        toCharArray() );
                     
                     encryptionMethod.salt = new byte[8];
                     byte[] password = new byte[passwordAndSalt.length - encryptionMethod.salt.length];
@@ -560,7 +561,8 @@
                     salt[1] = ( byte ) ( i2 < 12 ? ( i2 + '.' ) : i2 < 38 ? ( i2 + 'A' - 12 ) : ( i2 + 'a' - 38 ) );
                 }
 
-                String saltWithCrypted = UnixCrypt.crypt( StringTools.utf8ToString( credentials ), StringTools.utf8ToString( salt ) );
+                String saltWithCrypted = UnixCrypt.crypt( StringTools.utf8ToString( credentials ), 
+                    StringTools.utf8ToString( salt ) );
                 String crypted = saltWithCrypted.substring( 2 );
                 
                 return StringTools.getBytesUtf8( crypted );
@@ -585,7 +587,8 @@
 
         try
         {
-            LookupOperationContext lookupContex  = new LookupOperationContext( registries, new String[] { SchemaConstants.USER_PASSWORD_AT } );
+            LookupOperationContext lookupContex  = new LookupOperationContext( registries, 
+                new String[] { SchemaConstants.USER_PASSWORD_AT } );
             lookupContex.setDn( principalDn );
             
             userEntry = proxy.lookup( lookupContex, USERLOOKUP_BYPASS ); 
@@ -645,8 +648,7 @@
         String sPassword = StringTools.utf8ToString( password );
         int rightParen = sPassword.indexOf( '}' );
 
-        if ( ( sPassword != null ) &&
-             ( sPassword.length() > 2 ) &&
+        if ( ( sPassword.length() > 2 ) &&
              ( sPassword.charAt( 0 ) == '{' ) &&
              ( rightParen > -1 ) )
         {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Mon May 12 04:49:35 2008
@@ -20,6 +20,18 @@
 package org.apache.directory.server.core.authz;
 
 
+import javax.naming.directory.SearchControls;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
@@ -71,18 +83,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 
 /**
  * An ACI based authorization service.
@@ -225,8 +225,8 @@
 
         // stuff for dealing with subentries (garbage for now)
         Value<?> subschemaSubentry = 
-        	directoryService.getPartitionNexus().getRootDSE( null ).
-        		get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+            directoryService.getPartitionNexus().getRootDSE( null ).
+                get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
         LdapDN subschemaSubentryDnName = new LdapDN( (String)(subschemaSubentry.get()) );
         subschemaSubentryDnName.normalize( atRegistry.getNormalizerMapping() );
         subschemaSubentryDn = subschemaSubentryDnName.toNormName();
@@ -369,12 +369,12 @@
         parentDn.remove( dn.size() - 1 );
         ServerEntry administrativeEntry =  
             proxy.lookup( 
-        		new LookupOperationContext( 
-        		    registries, 
-        		    parentDn, 
-        		    new String[]
-        		               { SchemaConstants.SUBENTRY_ACI_AT }) , 
-        		PartitionNexusProxy.LOOKUP_BYPASS );
+                new LookupOperationContext( 
+                    registries, 
+                    parentDn, 
+                    new String[]
+                               { SchemaConstants.SUBENTRY_ACI_AT }) , 
+                PartitionNexusProxy.LOOKUP_BYPASS );
         
         EntryAttribute subentryAci = administrativeEntry.get( subentryAciType );
 
@@ -504,8 +504,8 @@
 
     public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws NamingException
     {
-    	LdapDN name = deleteContext.getDn();
-    	
+        LdapDN name = deleteContext.getDn();
+        
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
@@ -768,7 +768,7 @@
         
         if ( !principalDn.isNormalized() )
         {
-        	principalDn.normalize( atRegistry.getNormalizerMapping() );
+            principalDn.normalize( atRegistry.getNormalizerMapping() );
         }
         
         if ( isPrincipalAnAdministrator( principalDn ) || !enabled )
@@ -1043,16 +1043,16 @@
 
     public boolean compare( NextInterceptor next, CompareOperationContext opContext ) throws NamingException
     {
-    	LdapDN name = opContext.getDn();
-    	String oid = opContext.getOid();
-    	Value<?> value = (Value<?>)opContext.getValue();
-    	
+        LdapDN name = opContext.getDn();
+        String oid = opContext.getOid();
+        Value<?> value = (Value<?>)opContext.getValue();
+        
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
         ServerEntry entry = proxy.lookup( 
-        		new LookupOperationContext( registries, name ), 
-        		PartitionNexusProxy.LOOKUP_BYPASS );
+                new LookupOperationContext( registries, name ), 
+                PartitionNexusProxy.LOOKUP_BYPASS );
 
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=655480&r1=655479&r2=655480&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Mon May 12 04:49:35 2008
@@ -20,6 +20,16 @@
 package org.apache.directory.server.core.authz;
 
 
+import javax.naming.directory.SearchControls;
+import javax.naming.ldap.LdapContext;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NoPermissionException;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -53,15 +63,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NoPermissionException;
-import javax.naming.directory.SearchControls;
-import javax.naming.ldap.LdapContext;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 
 /**
  * An {@link Interceptor} that controls access to {@link PartitionNexus}.
@@ -173,8 +174,8 @@
 
     public void delete( NextInterceptor nextInterceptor, DeleteOperationContext opContext ) throws NamingException
     {
-    	LdapDN name = opContext.getDn();
-    	
+        LdapDN name = opContext.getDn();
+        
         if ( !enabled )
         {
             nextInterceptor.delete( opContext );
@@ -549,7 +550,7 @@
         
         if ( !dn.isNormalized() )
         {
-        	dn.normalize( normalizerMapping );
+            dn.normalize( normalizerMapping );
         }
 
         // Admin users gets full access to all entries



Mime
View raw message