directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1235374 [3/27] - in /directory/shared/trunk: ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/ ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/ ldap/model/src/main/java/org/apache/directory/shar...
Date Tue, 24 Jan 2012 17:44:32 GMT
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/Csn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/Csn.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/Csn.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/Csn.java
Tue Jan 24 17:44:03 2012
@@ -68,9 +68,9 @@ public class Csn implements Comparable<C
 
     /** The operation number in a modification operation */
     private final int operationNumber;
-    
+
     /** The changeCount to distinguish operations done in the same second */
-    private final int changeCount;  
+    private final int changeCount;
 
     /** Stores the String representation of the CSN */
     private String csnStr;
@@ -80,18 +80,20 @@ public class Csn implements Comparable<C
 
     /** The Timestamp syntax. The last 'z' is _not_ the Time Zone */
     private static final SimpleDateFormat SDF = new SimpleDateFormat( "yyyyMMddHHmmss" );
-    
+
     // Initialize the dateFormat with the UTC TZ
     static
     {
         SDF.setTimeZone( DateUtils.UTC_TIME_ZONE );
     }
-    
+
     /** Padding used to format number with a fixed size */
-    private static final String[] PADDING_6 = new String[] { "00000", "0000", "000", "00",
"0", "" };
+    private static final String[] PADDING_6 = new String[]
+        { "00000", "0000", "000", "00", "0", "" };
 
     /** Padding used to format number with a fixed size */
-    private static final String[] PADDING_3 = new String[] { "00", "0", "" };
+    private static final String[] PADDING_3 = new String[]
+        { "00", "0", "" };
 
 
     /**
@@ -123,13 +125,13 @@ public class Csn implements Comparable<C
      */
     public Csn( String value ) throws InvalidCSNException
     {
-        if ( Strings.isEmpty(value) )
+        if ( Strings.isEmpty( value ) )
         {
             String message = I18n.err( I18n.ERR_04114 );
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         if ( value.length() != 40 )
         {
             String message = I18n.err( I18n.ERR_04115 );
@@ -139,28 +141,28 @@ public class Csn implements Comparable<C
 
         // Get the Timestamp
         int sepTS = value.indexOf( '#' );
-        
+
         if ( sepTS < 0 )
         {
             String message = I18n.err( I18n.ERR_04116 );
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         String timestampStr = value.substring( 0, sepTS ).trim();
-        
+
         if ( timestampStr.length() != 22 )
         {
             String message = I18n.err( I18n.ERR_04117 );
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         // Let's transform the Timestamp by removing the mulliseconds and microseconds
         String realTimestamp = timestampStr.substring( 0, 14 );
-        
+
         long tempTimestamp = 0L;
-        
+
         synchronized ( SDF )
         {
             try
@@ -174,9 +176,9 @@ public class Csn implements Comparable<C
                 throw new InvalidCSNException( message );
             }
         }
-        
+
         int millis = 0;
-        
+
         // And add the milliseconds and microseconds now
         try
         {
@@ -188,13 +190,13 @@ public class Csn implements Comparable<C
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
-        tempTimestamp += (millis/1000);
+
+        tempTimestamp += ( millis / 1000 );
         timestamp = tempTimestamp;
 
         // Get the changeCount. It should be an hex number prefixed with '0x'
         int sepCC = value.indexOf( '#', sepTS + 1 );
-        
+
         if ( sepCC < 0 )
         {
             String message = I18n.err( I18n.ERR_04110, value );
@@ -203,10 +205,10 @@ public class Csn implements Comparable<C
         }
 
         String changeCountStr = value.substring( sepTS + 1, sepCC ).trim();
-        
+
         try
         {
-            changeCount = Integer.parseInt( changeCountStr, 16 ); 
+            changeCount = Integer.parseInt( changeCountStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
@@ -214,10 +216,10 @@ public class Csn implements Comparable<C
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         // Get the replicaID
         int sepRI = value.indexOf( '#', sepCC + 1 );
-        
+
         if ( sepRI < 0 )
         {
             String message = I18n.err( I18n.ERR_04122, value );
@@ -225,18 +227,18 @@ public class Csn implements Comparable<C
             throw new InvalidCSNException( message );
         }
 
-        String replicaIdStr = value.substring( sepCC + 1, sepRI).trim();
-        
-        if ( Strings.isEmpty(replicaIdStr) )
+        String replicaIdStr = value.substring( sepCC + 1, sepRI ).trim();
+
+        if ( Strings.isEmpty( replicaIdStr ) )
         {
             String message = I18n.err( I18n.ERR_04123 );
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         try
         {
-            replicaId = Integer.parseInt( replicaIdStr, 16 ); 
+            replicaId = Integer.parseInt( replicaIdStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
@@ -244,7 +246,7 @@ public class Csn implements Comparable<C
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         // Get the modification number
         if ( sepCC == value.length() )
         {
@@ -252,22 +254,22 @@ public class Csn implements Comparable<C
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         String operationNumberStr = value.substring( sepRI + 1 ).trim();
-        
+
         try
         {
-            operationNumber = Integer.parseInt( operationNumberStr, 16 ); 
+            operationNumber = Integer.parseInt( operationNumberStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
-            String message =  I18n.err( I18n.ERR_04126, operationNumberStr );
+            String message = I18n.err( I18n.ERR_04126, operationNumberStr );
             LOG.error( message );
             throw new InvalidCSNException( message );
         }
-        
+
         csnStr = value;
-        bytes = Strings.getBytesUtf8(csnStr);
+        bytes = Strings.getBytesUtf8( csnStr );
     }
 
 
@@ -279,34 +281,34 @@ public class Csn implements Comparable<C
      */
     public static boolean isValid( String value )
     {
-        if ( Strings.isEmpty(value) )
+        if ( Strings.isEmpty( value ) )
         {
             return false;
         }
-        
+
         if ( value.length() != 40 )
         {
             return false;
         }
-    
+
         // Get the Timestamp
         int sepTS = value.indexOf( '#' );
-        
+
         if ( sepTS < 0 )
         {
             return false;
         }
-        
+
         String timestampStr = value.substring( 0, sepTS ).trim();
-        
+
         if ( timestampStr.length() != 22 )
         {
             return false;
         }
-        
+
         // Let's transform the Timestamp by removing the mulliseconds and microseconds
         String realTimestamp = timestampStr.substring( 0, 14 );
-        
+
         synchronized ( SDF )
         {
             try
@@ -318,18 +320,18 @@ public class Csn implements Comparable<C
                 return false;
             }
         }
-        
+
         // And add the milliseconds and microseconds now
         String millisStr = timestampStr.substring( 15, 21 );
 
-        if ( Strings.isEmpty(millisStr) )
+        if ( Strings.isEmpty( millisStr ) )
         {
             return false;
         }
-        
+
         for ( int i = 0; i < 6; i++ )
         {
-            if ( !Chars.isDigit(millisStr, i) )
+            if ( !Chars.isDigit( millisStr, i ) )
             {
                 return false;
             }
@@ -343,67 +345,67 @@ public class Csn implements Comparable<C
         {
             return false;
         }
-    
+
         // Get the changeCount. It should be an hex number prefixed with '0x'
         int sepCC = value.indexOf( '#', sepTS + 1 );
-        
+
         if ( sepCC < 0 )
         {
             return false;
         }
-    
+
         String changeCountStr = value.substring( sepTS + 1, sepCC ).trim();
-        
-        if ( Strings.isEmpty(changeCountStr) )
+
+        if ( Strings.isEmpty( changeCountStr ) )
         {
             return false;
         }
-        
+
         if ( changeCountStr.length() != 6 )
         {
             return false;
         }
-        
+
         try
         {
             for ( int i = 0; i < 6; i++ )
             {
-                if ( !Chars.isHex(changeCountStr, i) )
+                if ( !Chars.isHex( changeCountStr, i ) )
                 {
                     return false;
                 }
             }
-            
-            Integer.parseInt( changeCountStr, 16 ); 
+
+            Integer.parseInt( changeCountStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
             return false;
         }
-        
+
         // Get the replicaIDfalse
         int sepRI = value.indexOf( '#', sepCC + 1 );
-        
+
         if ( sepRI < 0 )
         {
             return false;
         }
-    
+
         String replicaIdStr = value.substring( sepCC + 1, sepRI ).trim();
-        
-        if ( Strings.isEmpty(replicaIdStr) )
+
+        if ( Strings.isEmpty( replicaIdStr ) )
         {
             return false;
         }
-        
+
         if ( replicaIdStr.length() != 3 )
         {
             return false;
         }
-        
+
         for ( int i = 0; i < 3; i++ )
         {
-            if ( !Chars.isHex(replicaIdStr, i) )
+            if ( !Chars.isHex( replicaIdStr, i ) )
             {
                 return false;
             }
@@ -411,21 +413,21 @@ public class Csn implements Comparable<C
 
         try
         {
-            Integer.parseInt( replicaIdStr, 16 ); 
+            Integer.parseInt( replicaIdStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
             return false;
         }
-        
+
         // Get the modification number
         if ( sepCC == value.length() )
         {
             return false;
         }
-        
+
         String operationNumberStr = value.substring( sepRI + 1 ).trim();
-        
+
         if ( operationNumberStr.length() != 6 )
         {
             return false;
@@ -433,7 +435,7 @@ public class Csn implements Comparable<C
 
         for ( int i = 0; i < 6; i++ )
         {
-            if ( !Chars.isHex(operationNumberStr, i) )
+            if ( !Chars.isHex( operationNumberStr, i ) )
             {
                 return false;
             }
@@ -441,13 +443,13 @@ public class Csn implements Comparable<C
 
         try
         {
-            Integer.parseInt( operationNumberStr, 16 ); 
+            Integer.parseInt( operationNumberStr, 16 );
         }
         catch ( NumberFormatException nfe )
         {
             return false;
         }
-        
+
         return true;
     }
 
@@ -459,13 +461,13 @@ public class Csn implements Comparable<C
      */
     Csn( byte[] value )
     {
-        csnStr = Strings.utf8ToString(value);
+        csnStr = Strings.utf8ToString( value );
         Csn csn = new Csn( csnStr );
         timestamp = csn.timestamp;
         changeCount = csn.changeCount;
         replicaId = csn.replicaId;
         operationNumber = csn.operationNumber;
-        bytes = Strings.getBytesUtf8(csnStr);
+        bytes = Strings.getBytesUtf8( csnStr );
     }
 
 
@@ -481,7 +483,7 @@ public class Csn implements Comparable<C
     {
         if ( bytes == null )
         {
-            bytes = Strings.getBytesUtf8(csnStr);
+            bytes = Strings.getBytesUtf8( csnStr );
         }
 
         byte[] copy = new byte[bytes.length];
@@ -534,35 +536,35 @@ public class Csn implements Comparable<C
         if ( csnStr == null )
         {
             StringBuilder buf = new StringBuilder( 40 );
-            
-            synchronized( SDF )
+
+            synchronized ( SDF )
             {
                 buf.append( SDF.format( new Date( timestamp ) ) );
             }
-            
+
             // Add the milliseconds part
-            long millis = (timestamp % 1000 ) * 1000;
+            long millis = ( timestamp % 1000 ) * 1000;
             String millisStr = Long.toString( millis );
-            
-            buf.append( '.' ).append( PADDING_6[ millisStr.length() - 1 ] ).append( millisStr
).append( "Z#" );
-            
+
+            buf.append( '.' ).append( PADDING_6[millisStr.length() - 1] ).append( millisStr
).append( "Z#" );
+
             String countStr = Integer.toHexString( changeCount );
-            
+
             buf.append( PADDING_6[countStr.length() - 1] ).append( countStr );
             buf.append( '#' );
 
             String replicaIdStr = Integer.toHexString( replicaId );
-            
-            buf.append( PADDING_3[replicaIdStr.length() - 1]).append( replicaIdStr );
+
+            buf.append( PADDING_3[replicaIdStr.length() - 1] ).append( replicaIdStr );
             buf.append( '#' );
-            
+
             String operationNumberStr = Integer.toHexString( operationNumber );
-            
+
             buf.append( PADDING_6[operationNumberStr.length() - 1] ).append( operationNumberStr
);
-            
+
             csnStr = buf.toString();
         }
-        
+
         return csnStr;
     }
 
@@ -575,12 +577,12 @@ public class Csn implements Comparable<C
     public int hashCode()
     {
         int h = 37;
-        
-        h = h*17 + (int)(timestamp ^ (timestamp >>> 32));
-        h = h*17 + changeCount;
-        h = h*17 + replicaId;
-        h = h*17 + operationNumber;
-        
+
+        h = h * 17 + ( int ) ( timestamp ^ ( timestamp >>> 32 ) );
+        h = h * 17 + changeCount;
+        h = h * 17 + replicaId;
+        h = h * 17 + operationNumber;
+
         return h;
     }
 
@@ -626,7 +628,7 @@ public class Csn implements Comparable<C
         {
             return 1;
         }
-        
+
         // Compares the timestamp first
         if ( this.timestamp < csn.timestamp )
         {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/CsnFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/CsnFactory.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/CsnFactory.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/CsnFactory.java
Tue Jan 24 17:44:03 2012
@@ -29,16 +29,16 @@ public class CsnFactory
 {
     /** The last timestamp */
     private static volatile long lastTimestamp;
-    
+
     /** The integer used to disambiguate CSN generated at the same time */
     private int changeCount;
-    
+
     /** The replicaId to use for every CSN created by this factory */
     private int replicaId;
 
     /** A special instance ID for a purge CSN */
     private static final int PURGE_INSTANCEID = 0x0FFF;
-    
+
     /** A lock used during the instance creation */
     private Object lock = new Object();
 
@@ -58,11 +58,11 @@ public class CsnFactory
     public Csn newInstance()
     {
         int changeCount = 0;
-        
+
         synchronized ( lock )
         {
             long newTimestamp = System.currentTimeMillis();
-            
+
             // We will be able to generate 2 147 483 647 CSNs each 10 ms max
             if ( lastTimestamp == newTimestamp )
             {
@@ -73,7 +73,7 @@ public class CsnFactory
                 lastTimestamp = newTimestamp;
                 this.changeCount = 0;
             }
-            
+
             changeCount = this.changeCount;
         }
 
@@ -93,8 +93,8 @@ public class CsnFactory
     {
         return new Csn( timestamp, changeCount, replicaId, 0 );
     }
-    
-    
+
+
     /**
      * Generates a CSN used to purge data. Its replicaID is not associated
      * to a server. 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/InvalidCSNException.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/InvalidCSNException.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/InvalidCSNException.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/InvalidCSNException.java
Tue Jan 24 17:44:03 2012
@@ -46,6 +46,7 @@ public class InvalidCSNException extends
         super();
     }
 
+
     /**
      * Creates a new instance with the specified <tt>message</tt> and
      * <tt>cause</tt>.
@@ -55,6 +56,7 @@ public class InvalidCSNException extends
         super( message, cause );
     }
 
+
     /**
      * Creates a new instance with the specified <tt>message</tt>.
      */
@@ -63,6 +65,7 @@ public class InvalidCSNException extends
         super( message );
     }
 
+
     /**
      * Creates a new instance with the specified <tt>cause</tt>.
      */

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/CursorIterator.java
Tue Jan 24 17:44:03 2012
@@ -49,7 +49,7 @@ public class CursorIterator<E> implement
     public CursorIterator( Cursor<E> cursor )
     {
         this.cursor = cursor;
-        
+
         try
         {
             this.available = cursor.next();

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/DefaultClosureMonitor.java
Tue Jan 24 17:44:03 2012
@@ -47,7 +47,7 @@ public class DefaultClosureMonitor imple
     {
         // state check needed to "try" not to overwrite exception (lack of
         // synchronization may still allow overwriting but who cares that much
-        if ( ! closed )
+        if ( !closed )
         {
             // not going to sync because who cares if it takes a little longer
             // to stop but we need to set cause before toggling closed state
@@ -65,7 +65,7 @@ public class DefaultClosureMonitor imple
     {
         // state check needed to "try" not to overwrite exception (lack of
         // synchronization may still allow overwriting but who cares that much
-        if ( ! closed )
+        if ( !closed )
         {
             // not going to sync because who cares if it takes a little longer
             // to stop but we need to set cause before toggling closed state
@@ -83,7 +83,7 @@ public class DefaultClosureMonitor imple
     {
         // state check needed to "try" not to overwrite exception (lack of
         // synchronization may still allow overwriting but who cares that much
-        if ( ! closed )
+        if ( !closed )
         {
             // not going to sync because who cares if it takes a little longer
             // to stop but we need to set cause before toggling closed state

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EntryCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EntryCursor.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EntryCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/EntryCursor.java
Tue Jan 24 17:44:03 2012
@@ -38,8 +38,8 @@ public interface EntryCursor extends Cur
      * @return the SearchResultDone message, null if the search operation fails for any reason

      */
     public SearchResultDone getSearchResultDone();
-    
-    
+
+
     /**
      * @return the underlying message ID
      */

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SearchCursor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SearchCursor.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SearchCursor.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/cursor/SearchCursor.java
Tue Jan 24 17:44:03 2012
@@ -40,7 +40,8 @@ public interface SearchCursor extends Cu
      * @return true if the cursor has processed all the elements we were searching
      */
     boolean isDone();
-    
+
+
     /**
      * gives the SearchResultDone message received at the end of search results
      * 
@@ -48,37 +49,39 @@ public interface SearchCursor extends Cu
      */
     SearchResultDone getSearchResultDone();
 
-    
+
     /**
      * @return true if the next element in the cursor is a referral 
      */
     boolean isReferral();
-    
-    
+
+
     /**
      * @return The next referral element, if it's a referral 
      * @throws LdapException If the 
      */
     Referral getReferral() throws LdapException;
-    
-    
+
+
     /**
      * @return true if the next element in the cursor is an entry 
      */
     boolean isEntry();
-    
+
+
     /**
      * @return The next entry element, if it's an entry 
      * @throws LdapException If the 
      */
     Entry getEntry() throws LdapException;
-    
+
 
     /**
      * @return true if the next element in the cursor is an intermediate response 
      */
     boolean isIntermediate();
-    
+
+
     /**
      * @return The next intermediate response element, if it's an intermediate response 
      * @throws LdapException If the 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AbstractValue.java
Tue Jan 24 17:44:03 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.model.entry;
 
+
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -48,13 +49,14 @@ public abstract class AbstractValue<T> i
 
     /** the wrapped binary value */
     protected T wrappedValue;
-    
+
     /** the canonical representation of the wrapped value */
     protected T normalizedValue;
 
     /** The computed hashcode. We don't want to compute it each time the hashcode() method
is called */
     protected volatile int h;
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -63,7 +65,7 @@ public abstract class AbstractValue<T> i
     {
         try
         {
-            return (Value<T>)super.clone();
+            return ( Value<T> ) super.clone();
         }
         catch ( CloneNotSupportedException cnse )
         {
@@ -71,8 +73,8 @@ public abstract class AbstractValue<T> i
             return null;
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -89,7 +91,7 @@ public abstract class AbstractValue<T> i
      */
     public String getString()
     {
-        throw new UnsupportedOperationException( "Cannot call this method on a binary value");
+        throw new UnsupportedOperationException( "Cannot call this method on a binary value"
);
     }
 
 
@@ -100,7 +102,7 @@ public abstract class AbstractValue<T> i
      */
     public byte[] getBytes()
     {
-        throw new UnsupportedOperationException( "Cannot call this method on a String value");
+        throw new UnsupportedOperationException( "Cannot call this method on a String value"
);
     }
 
 
@@ -112,7 +114,7 @@ public abstract class AbstractValue<T> i
         return attributeType;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -124,24 +126,24 @@ public abstract class AbstractValue<T> i
             normalizedValue = wrappedValue;
             return;
         }
-        
+
         this.attributeType = attributeType;
-        
+
         // We first have to normalize the value before we can check its syntax
         // Get the Aequality matchingRule, if we have one
         MatchingRule equality = attributeType.getEquality();
-        
+
         if ( equality != null )
         {
             // If we have an Equality MR, we *must* have a normalizer
             Normalizer normalizer = equality.getNormalizer();
-            
+
             if ( normalizer != null )
             {
                 if ( wrappedValue != null )
                 {
                     boolean isHR = attributeType.getSyntax().isHumanReadable();
-                    
+
                     if ( isHR != isHumanReadable() )
                     {
                         String message = "The '" + attributeType.getName() + "' AttributeType
and values must " +
@@ -149,16 +151,17 @@ public abstract class AbstractValue<T> i
                         LOG.error( message );
                         throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
message );
                     }
-                        
+
                     try
                     {
                         if ( isHumanReadable() )
-                        {     
-                            normalizedValue = (T)normalizer.normalize( (String)wrappedValue
);
+                        {
+                            normalizedValue = ( T ) normalizer.normalize( ( String ) wrappedValue
);
                         }
                         else
                         {
-                            normalizedValue = (T)normalizer.normalize( new BinaryValue( (byte[])wrappedValue
) ).getNormReference();
+                            normalizedValue = ( T ) normalizer.normalize( new BinaryValue(
( byte[] ) wrappedValue ) )
+                                .getNormReference();
                         }
                     }
                     catch ( LdapException ne )
@@ -182,16 +185,16 @@ public abstract class AbstractValue<T> i
             // to be a reference on the user provided value
             normalizedValue = wrappedValue;
         }
-        
+
         // and checks that the value syntax is valid
         try
         {
             LdapSyntax syntax = attributeType.getSyntax();
-            
+
             if ( syntax != null )
             {
                 // Check the syntax
-                if ( ! isValid( syntax.getSyntaxChecker() ) )
+                if ( !isValid( syntax.getSyntaxChecker() ) )
                 {
                     String message = I18n.err( I18n.ERR_04473_NOT_VALID_VALUE, wrappedValue,
attributeType );
                     LOG.info( message );
@@ -205,9 +208,9 @@ public abstract class AbstractValue<T> i
             LOG.info( message );
             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
message, le );
         }
-        
+
         // Rehash the Value now
-        h=0;
+        h = 0;
         hashCode();
     }
 
@@ -225,25 +228,25 @@ public abstract class AbstractValue<T> i
         if ( attributeType != null )
         {
             MatchingRule mr = attributeType.getEquality();
-    
+
             if ( mr != null )
             {
-                return (LdapComparator<T>)mr.getLdapComparator();
+                return ( LdapComparator<T> ) mr.getLdapComparator();
             }
         }
 
         return null;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
     public boolean isInstanceOf( AttributeType attributeType )
     {
-        return ( attributeType != null ) && 
-               ( this.attributeType.equals( attributeType ) || 
-                 this.attributeType.isDescendantOf( attributeType ) ); 
+        return ( attributeType != null ) &&
+            ( this.attributeType.equals( attributeType ) ||
+            this.attributeType.isDescendantOf( attributeType ) );
     }
 
 
@@ -265,16 +268,16 @@ public abstract class AbstractValue<T> i
         return normalizedValue;
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
     public final boolean isNull()
     {
-        return wrappedValue == null; 
+        return wrappedValue == null;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -286,7 +289,7 @@ public abstract class AbstractValue<T> i
             LOG.error( message );
             throw new LdapInvalidAttributeValueException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX,
message );
         }
-        
+
         return syntaxChecker.isValidSyntax( normalizedValue );
     }
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Attribute.java
Tue Jan 24 17:44:03 2012
@@ -142,14 +142,14 @@ public interface Attribute extends Itera
      * @throws LdapInvalidAttributeValueException if some of the added values are not valid
      */
     int add( Value<?>... val ) throws LdapInvalidAttributeValueException;
-    
-    
+
+
     /**
      * Remove all the values from this attribute.
      */
     void clear();
-    
-    
+
+
     /**
      * @return A clone of the current object
      */
@@ -206,7 +206,7 @@ public interface Attribute extends Itera
      */
     AttributeType getAttributeType();
 
-    
+
     /**
      * <p>
      * Set the attribute type associated with this EntryAttribute.
@@ -223,7 +223,7 @@ public interface Attribute extends Itera
      */
     void apply( AttributeType attributeType ) throws LdapInvalidAttributeValueException;
 
-    
+
     /**
      * <p>
      * Check if the current attribute type has the same type (or is a descendant of)
@@ -235,7 +235,7 @@ public interface Attribute extends Itera
      */
     boolean isInstanceOf( AttributeType attributeType ) throws LdapInvalidAttributeValueException;
 
-    
+
     /**
      * <p>
      * Get the first value of this attribute. If there is none, 
@@ -263,8 +263,8 @@ public interface Attribute extends Itera
      * @throws LdapInvalidAttributeValueException If the value is a String
      */
     byte[] getBytes() throws LdapInvalidAttributeValueException;
-    
-    
+
+
     /**
      * Get's the attribute identifier for this entry. This is the value
      * that will be used as the identifier for the attribute within the
@@ -274,7 +274,7 @@ public interface Attribute extends Itera
      */
     String getId();
 
-    
+
     /**
      * Get's the user provided identifier for this entry.  This is the value
      * that will be used as the identifier for the attribute within the
@@ -287,8 +287,8 @@ public interface Attribute extends Itera
      * @return the user provided identifier for this attribute
      */
     String getUpId();
-    
-    
+
+
     /**
      * <p>
      * Tells if the attribute is human readable. 
@@ -300,7 +300,7 @@ public interface Attribute extends Itera
      */
     boolean isHumanReadable();
 
-    
+
     /**
      * <p>
      * Get the String value, if and only if the value is known to be a String,
@@ -315,7 +315,7 @@ public interface Attribute extends Itera
      */
     String getString() throws LdapInvalidAttributeValueException;
 
-    
+
     /**
      * <p>
      * Removes all the  values that are equal to the given values.
@@ -332,8 +332,8 @@ public interface Attribute extends Itera
      * @return true if all the values are removed, otherwise false
      */
     boolean remove( String... vals );
-    
-    
+
+
     /**
      * <p>
      * Removes all the  values that are equal to the given values.
@@ -369,7 +369,7 @@ public interface Attribute extends Itera
      */
     boolean remove( Value<?>... vals );
 
-    
+
     /**
      * Set the user provided ID. It will also set the ID, normalizing
      * the upId (removing spaces before and after, and lower casing it)
@@ -403,7 +403,7 @@ public interface Attribute extends Itera
      */
     void setUpId( String upId, AttributeType attributeType );
 
-    
+
     /**
       * Retrieves the number of values in this attribute.
       *
@@ -411,8 +411,8 @@ public interface Attribute extends Itera
       * wrapping a null value if there is one
       */
     int size();
-    
-    
+
+
     /**
      * Checks to see if this attribute is valid along with the values it contains.
      *

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/AttributeUtils.java
Tue Jan 24 17:44:03 2012
@@ -172,7 +172,7 @@ public final class AttributeUtils
             pos.start++;
 
             // We have an option
-            if ( !Chars.isAlphaDigitMinus(str, pos.start) )
+            if ( !Chars.isAlphaDigitMinus( str, pos.start ) )
             {
                 // We must have at least one keychar
                 throw new ParseException( I18n.err( I18n.ERR_04343 ), pos.start );
@@ -180,7 +180,7 @@ public final class AttributeUtils
 
             pos.start++;
 
-            while ( Chars.isAlphaDigitMinus(str, pos.start) )
+            while ( Chars.isAlphaDigitMinus( str, pos.start ) )
             {
                 pos.start++;
             }
@@ -198,7 +198,7 @@ public final class AttributeUtils
      */
     private static boolean parseNumber( String filter, Position pos )
     {
-        char c = Strings.charAt(filter, pos.start);
+        char c = Strings.charAt( filter, pos.start );
 
         switch ( c )
         {
@@ -224,7 +224,7 @@ public final class AttributeUtils
                 return false;
         }
 
-        while ( Chars.isDigit(filter, pos.start) )
+        while ( Chars.isDigit( filter, pos.start ) )
         {
             pos.start++;
         }
@@ -301,7 +301,7 @@ public final class AttributeUtils
     public static String parseAttribute( String str, Position pos, boolean withOption ) throws
ParseException
     {
         // We must have an OID or an DESCR first
-        char c = Strings.charAt(str, pos.start);
+        char c = Strings.charAt( str, pos.start );
 
         if ( c == '\0' )
         {
@@ -310,12 +310,12 @@ public final class AttributeUtils
 
         int start = pos.start;
 
-        if ( Chars.isAlpha(c) )
+        if ( Chars.isAlpha( c ) )
         {
             // A DESCR
             pos.start++;
 
-            while ( Chars.isAlphaDigitMinus(str, pos.start) )
+            while ( Chars.isAlphaDigitMinus( str, pos.start ) )
             {
                 pos.start++;
             }
@@ -328,7 +328,7 @@ public final class AttributeUtils
 
             return str.substring( start, pos.start );
         }
-        else if ( Chars.isDigit(c) )
+        else if ( Chars.isDigit( c ) )
         {
             // An OID
             pos.start++;
@@ -461,7 +461,8 @@ public final class AttributeUtils
             {
                 Entry entry = new DefaultEntry( dn );
 
-                for ( NamingEnumeration<? extends javax.naming.directory.Attribute>
attrs = attributes.getAll(); attrs.hasMoreElements(); )
+                for ( NamingEnumeration<? extends javax.naming.directory.Attribute>
attrs = attributes.getAll(); attrs
+                    .hasMoreElements(); )
                 {
                     javax.naming.directory.Attribute attr = attrs.nextElement();
 
@@ -548,7 +549,8 @@ public final class AttributeUtils
      * @param jndiAttribute the JNDI Attribute instance to convert
      * @return An instance of a LDAP API Attribute object
      */
-    public static Attribute toApiAttribute( javax.naming.directory.Attribute jndiAttribute
) throws LdapInvalidAttributeValueException
+    public static Attribute toApiAttribute( javax.naming.directory.Attribute jndiAttribute
)
+        throws LdapInvalidAttributeValueException
     {
         if ( jndiAttribute == null )
         {
@@ -563,7 +565,6 @@ public final class AttributeUtils
             {
                 Object value = values.nextElement();
 
-                
                 if ( value instanceof String )
                 {
                     attribute.add( ( String ) value );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/BinaryValue.java
Tue Jan 24 17:44:03 2012
@@ -47,12 +47,13 @@ public class BinaryValue extends Abstrac
     /** Used for serialization */
     public static final long serialVersionUID = 2L;
 
+
     /**
      * Creates a BinaryValue without an initial wrapped value.
      *
      * @param attributeType the schema type associated with this BinaryValue
      */
-    /* No protection */ BinaryValue( AttributeType attributeType )
+    /* No protection */BinaryValue( AttributeType attributeType )
     {
         if ( attributeType != null )
         {
@@ -61,12 +62,12 @@ public class BinaryValue extends Abstrac
             {
                 throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) );
             }
-    
+
             if ( attributeType.getSyntax().isHumanReadable() )
             {
                 LOG.warn( "Treating a value of a human readible attribute {} as binary: ",
attributeType.getName() );
             }
-    
+
             this.attributeType = attributeType;
         }
     }
@@ -396,7 +397,7 @@ public class BinaryValue extends Abstrac
      */
     public static BinaryValue deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
     {
-        BinaryValue value = new BinaryValue( (AttributeType)null );
+        BinaryValue value = new BinaryValue( ( AttributeType ) null );
         value.readExternal( in );
 
         return value;
@@ -412,15 +413,16 @@ public class BinaryValue extends Abstrac
      * @throws IOException If the stream can't be read
      * @throws ClassNotFoundException If we can't instanciate a BinaryValue
      */
-    public static BinaryValue deserialize( AttributeType attributeType, ObjectInput in )
throws IOException, ClassNotFoundException
+    public static BinaryValue deserialize( AttributeType attributeType, ObjectInput in )
throws IOException,
+        ClassNotFoundException
     {
         BinaryValue value = new BinaryValue( attributeType );
         value.readExternal( in );
 
         return value;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -428,7 +430,7 @@ public class BinaryValue extends Abstrac
     {
         // Read the BINARY flag
         boolean isHR = in.readBoolean();
-        
+
         if ( isHR )
         {
             throw new IOException( "The serialized value is not a Binary value" );
@@ -463,7 +465,7 @@ public class BinaryValue extends Abstrac
             if ( wrappedLength >= 0 )
             {
                 normalizedValue = new byte[wrappedLength];
-                
+
                 System.arraycopy( wrappedValue, 0, normalizedValue, 0, wrappedLength );
             }
         }
@@ -480,7 +482,7 @@ public class BinaryValue extends Abstrac
     {
         // Write the BINARY flag
         out.writeBoolean( BINARY );
-        
+
         // Write the wrapped value, if it's not null
         if ( wrappedValue != null )
         {
@@ -520,14 +522,14 @@ public class BinaryValue extends Abstrac
         {
             out.writeBoolean( false );
         }
-        
+
         // The hashCode
         out.writeInt( h );
-        
+
         out.flush();
     }
 
-    
+
     /**
      * Dumps binary in hex with label.
      *
@@ -546,11 +548,11 @@ public class BinaryValue extends Abstrac
 
             System.arraycopy( wrappedValue, 0, copy, 0, 16 );
 
-            return "'" + Strings.dumpBytes(copy) + "...'";
+            return "'" + Strings.dumpBytes( copy ) + "...'";
         }
         else
         {
-            return "'" + Strings.dumpBytes(wrappedValue) + "'";
+            return "'" + Strings.dumpBytes( wrappedValue ) + "'";
         }
     }
 }
\ No newline at end of file



Mime
View raw message