You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/06/07 08:28:15 UTC
svn commit: r664290 [8/13] - in /directory/shared/branches/bigbang: ./
asn1/src/main/java/org/apache/directory/shared/asn1/
asn1/src/main/java/org/apache/directory/shared/asn1/ber/
asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/ asn1/s...
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java Fri Jun 6 23:28:06 2008
@@ -19,6 +19,18 @@
*/
package org.apache.directory.shared.ldap.ldif;
+import java.io.UnsupportedEncodingException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -27,25 +39,17 @@
import org.apache.directory.shared.ldap.util.Base64;
import org.apache.directory.shared.ldap.util.StringTools;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
/**
* Some LDIF useful methods
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class LdifUtils
{
- /** The array that will be used to match the first char.*/
+ /** The array that will be used to match the first char.*/
private static boolean[] LDIF_SAFE_STARTING_CHAR_ALPHABET = new boolean[128];
/** The array that will be used to match the other chars.*/
@@ -56,28 +60,28 @@
static
{
- // Initialization of the array that will be used to match the first char.
- for (int i = 0; i < 128; i++)
+ // Initialization of the array that will be used to match the first char.
+ for (int i = 0; i < 128; i++)
{
- LDIF_SAFE_STARTING_CHAR_ALPHABET[i] = true;
- }
-
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[i] = true;
+ }
+
LDIF_SAFE_STARTING_CHAR_ALPHABET[0] = false; // 0 (NUL)
- LDIF_SAFE_STARTING_CHAR_ALPHABET[10] = false; // 10 (LF)
- LDIF_SAFE_STARTING_CHAR_ALPHABET[13] = false; // 13 (CR)
- LDIF_SAFE_STARTING_CHAR_ALPHABET[32] = false; // 32 (SPACE)
- LDIF_SAFE_STARTING_CHAR_ALPHABET[58] = false; // 58 (:)
- LDIF_SAFE_STARTING_CHAR_ALPHABET[60] = false; // 60 (>)
-
- // Initialization of the array that will be used to match the other chars.
- for (int i = 0; i < 128; i++)
- {
- LDIF_SAFE_OTHER_CHARS_ALPHABET[i] = true;
- }
-
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[10] = false; // 10 (LF)
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[13] = false; // 13 (CR)
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[32] = false; // 32 (SPACE)
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[58] = false; // 58 (:)
+ LDIF_SAFE_STARTING_CHAR_ALPHABET[60] = false; // 60 (>)
+
+ // Initialization of the array that will be used to match the other chars.
+ for (int i = 0; i < 128; i++)
+ {
+ LDIF_SAFE_OTHER_CHARS_ALPHABET[i] = true;
+ }
+
LDIF_SAFE_OTHER_CHARS_ALPHABET[0] = false; // 0 (NUL)
- LDIF_SAFE_OTHER_CHARS_ALPHABET[10] = false; // 10 (LF)
- LDIF_SAFE_OTHER_CHARS_ALPHABET[13] = false; // 13 (CR)
+ LDIF_SAFE_OTHER_CHARS_ALPHABET[10] = false; // 10 (LF)
+ LDIF_SAFE_OTHER_CHARS_ALPHABET[13] = false; // 13 (CR)
}
/**
@@ -87,19 +91,19 @@
* The data does not need to be encoded if all the following are true:
*
* The data cannot start with the following char values:
- * 00 (NUL)
- * 10 (LF)
- * 13 (CR)
- * 32 (SPACE)
- * 58 (:)
- * 60 (<)
- * Any character with value greater than 127
+ * 00 (NUL)
+ * 10 (LF)
+ * 13 (CR)
+ * 32 (SPACE)
+ * 58 (:)
+ * 60 (<)
+ * Any character with value greater than 127
*
* The data cannot contain any of the following char values:
- * 00 (NUL)
- * 10 (LF)
- * 13 (CR)
- * Any character with value greater than 127
+ * 00 (NUL)
+ * 10 (LF)
+ * 13 (CR)
+ * Any character with value greater than 127
*
* The data cannot end with a space.
*
@@ -108,27 +112,27 @@
*/
public static boolean isLDIFSafe( String str )
{
- // Checking the first char
- char currentChar = str.charAt(0);
+ // Checking the first char
+ char currentChar = str.charAt(0);
+
+ if ( ( currentChar > 127 ) || !LDIF_SAFE_STARTING_CHAR_ALPHABET[currentChar] )
+ {
+ return false;
+ }
- if ( ( currentChar > 127 ) || !LDIF_SAFE_STARTING_CHAR_ALPHABET[currentChar] )
- {
- return false;
- }
-
- // Checking the other chars
- for (int i = 1; i < str.length(); i++)
- {
- currentChar = str.charAt(i);
-
- if ( ( currentChar > 127 ) || !LDIF_SAFE_OTHER_CHARS_ALPHABET[currentChar] )
- {
- return false;
- }
- }
-
- // The String cannot end with a space
- return ( currentChar != ' ' );
+ // Checking the other chars
+ for (int i = 1; i < str.length(); i++)
+ {
+ currentChar = str.charAt(i);
+
+ if ( ( currentChar > 127 ) || !LDIF_SAFE_OTHER_CHARS_ALPHABET[currentChar] )
+ {
+ return false;
+ }
+ }
+
+ // The String cannot end with a space
+ return ( currentChar != ' ' );
}
/**
@@ -148,6 +152,7 @@
*
* @param ldif The LDIF string containing an attribute value
* @return An Attributes instance
+ * @exception NamingException If the LDIF String cannot be converted to an Attributes
*/
public static Attributes convertAttributesFromLdif( String ldif ) throws NamingException
{
@@ -165,22 +170,22 @@
*/
public static String convertToLdif( Attributes attrs, int length ) throws NamingException
{
- StringBuilder sb = new StringBuilder();
-
- NamingEnumeration<? extends Attribute> ne = attrs.getAll();
-
- while ( ne.hasMore() )
- {
- Object attribute = ne.next();
+ StringBuilder sb = new StringBuilder();
+
+ NamingEnumeration<? extends Attribute> ne = attrs.getAll();
+
+ while ( ne.hasMore() )
+ {
+ Object attribute = ne.next();
- if ( attribute instanceof Attribute )
+ if ( attribute instanceof Attribute )
{
- sb.append( convertToLdif( (Attribute) attribute, length ) );
- }
- }
-
- return sb.toString();
- }
+ sb.append( convertToLdif( (Attribute) attribute, length ) );
+ }
+ }
+
+ return sb.toString();
+ }
/**
* Convert an Entry to LDIF
@@ -196,6 +201,7 @@
/**
* Convert an Entry to LDIF
* @param entry the entry to convert
+ * @param length The maximum line's length
* @return the corresponding LDIF as a String
* @throws NamingException If a naming exception is encountered.
*/
@@ -299,6 +305,9 @@
sb.append( "replace: " );
break;
+ default :
+ break; // Do nothing
+
}
sb.append( modification.getAttribute().getID() );
@@ -309,6 +318,9 @@
}
break;
+ default :
+ break; // Do nothing
+
}
sb.append( '\n' );
@@ -317,20 +329,22 @@
}
/**
- * Base64 encode a String
+ * Base64 encode a String
+ * @param str The string to encode
+ * @return the base 64 encoded string
*/
private static String encodeBase64( String str )
{
- char[] encoded;
+ char[] encoded =null;
try
{
// force encoding using UTF-8 charset, as required in RFC2849 note 7
- encoded = Base64.encode( ( ( String ) str ).getBytes( "UTF-8" ) );
+ encoded = Base64.encode( str.getBytes( "UTF-8" ) );
}
catch ( UnsupportedEncodingException e )
{
- encoded = Base64.encode( ( ( String ) str ).getBytes() );
+ encoded = Base64.encode( str.getBytes() );
}
return new String( encoded );
@@ -356,74 +370,74 @@
* @return the corresponding LDIF code as a String
* @throws NamingException If a naming exception is encountered.
*/
- public static String convertToLdif( Attribute attr, int length ) throws NamingException
- {
- StringBuilder sb = new StringBuilder();
-
- // iterating on the attribute's values
- for ( int i = 0; i < attr.size(); i++ )
+ public static String convertToLdif( Attribute attr, int length ) throws NamingException
+ {
+ StringBuilder sb = new StringBuilder();
+
+ // iterating on the attribute's values
+ for ( int i = 0; i < attr.size(); i++ )
{
- StringBuilder lineBuffer = new StringBuilder();
-
+ StringBuilder lineBuffer = new StringBuilder();
+
lineBuffer.append( attr.getID() );
-
- Object value = attr.get( i );
- // First, deal with null value (which is valid)
- if ( value == null )
- {
+ Object value = attr.get( i );
+
+ // First, deal with null value (which is valid)
+ if ( value == null )
+ {
lineBuffer.append( ':' );
- }
- else if ( value instanceof byte[] )
+ }
+ else if ( value instanceof byte[] )
{
- // It is binary, so we have to encode it using Base64 before adding it
- char[] encoded = Base64.encode( ( byte[] ) value );
-
- lineBuffer.append( ":: " + new String( encoded ) );
+ // It is binary, so we have to encode it using Base64 before adding it
+ char[] encoded = Base64.encode( ( byte[] ) value );
+
+ lineBuffer.append( ":: " + new String( encoded ) );
}
else if ( value instanceof String )
{
- // It's a String but, we have to check if encoding isn't required
- String str = (String) value;
+ // It's a String but, we have to check if encoding isn't required
+ String str = (String) value;
- if ( !LdifUtils.isLDIFSafe( str ) )
- {
+ if ( !LdifUtils.isLDIFSafe( str ) )
+ {
lineBuffer.append( ":: " + encodeBase64( (String)value ) );
- }
- else
- {
- lineBuffer.append( ": " + value );
- }
+ }
+ else
+ {
+ lineBuffer.append( ": " + value );
+ }
}
lineBuffer.append( "\n" );
sb.append( stripLineToNChars( lineBuffer.toString(), length ) );
}
-
- return sb.toString();
- }
-
-
- /**
- * Strips the String every n specified characters
- * @param str the string to strip
- * @param nbChars the number of characters
- * @return the stripped String
- */
- public static String stripLineToNChars( String str, int nbChars)
- {
+
+ return sb.toString();
+ }
+
+
+ /**
+ * Strips the String every n specified characters
+ * @param str the string to strip
+ * @param nbChars the number of characters
+ * @return the stripped String
+ */
+ public static String stripLineToNChars( String str, int nbChars)
+ {
int strLength = str.length();
if ( strLength <= nbChars )
- {
- return str;
- }
+ {
+ return str;
+ }
if ( nbChars < 2 )
{
throw new IllegalArgumentException( "The length of each line must be at least 2 chars long" );
}
-
+
// We will first compute the new size of the LDIF result
// It's at least nbChars chars plus one for \n
int charsPerLine = nbChars - 1;
@@ -460,18 +474,17 @@
System.arraycopy( orig, posSrc, buffer, posDst, remaining == 0 ? charsPerLine : remaining );
return new String( buffer );
- }
-
-
+ }
+
+
/**
* Compute a reverse LDIF of an AddRequest. It's simply a delete request
* of the added entry
*
* @param dn the dn of the added entry
* @return a reverse LDIF
- * @throws NamingException If something went wrong
*/
- public static LdifEntry reverseAdd( LdapDN dn ) throws NamingException
+ public static LdifEntry reverseAdd( LdapDN dn )
{
LdifEntry entry = new LdifEntry();
entry.setChangeType( ChangeType.Delete );
@@ -487,9 +500,8 @@
* @param dn The deleted entry DN
* @param deletedEntry The entry which has been deleted
* @return A reverse LDIF
- * @throws NamingException If something went wrong
*/
- public static LdifEntry reverseDel( LdapDN dn, Attributes deletedEntry ) throws NamingException
+ public static LdifEntry reverseDel( LdapDN dn, Attributes deletedEntry )
{
LdifEntry entry = new LdifEntry();
@@ -519,8 +531,8 @@
public static LdifEntry reverseModifyDn( LdapDN newSuperiorDn, LdapDN modifiedDn ) throws NamingException
{
LdifEntry entry = new LdifEntry();
- LdapDN currentParent;
- LdapDN newDn;
+ LdapDN currentParent = null;
+ LdapDN newDn = null;
if ( newSuperiorDn == null )
{
@@ -551,11 +563,20 @@
}
+ /**
+ * Revert a DN to it's previous version by removing the first RDN and adding the given RDN
+ *
+ * @param t0 The initial Attributes
+ * @param t0_dn The initial DN
+ * @param t1_rdn The new RDN
+ * @return A new LDIF entry with a reverted DN
+ * @throws NamingException If the name reverting failed
+ */
public static LdifEntry reverseRename( Attributes t0, LdapDN t0_dn, Rdn t1_rdn ) throws NamingException
{
LdifEntry entry = new LdifEntry();
- LdapDN parent;
- LdapDN newDn;
+ LdapDN parent = null;
+ LdapDN newDn = null;
if ( t1_rdn == null )
{
@@ -659,7 +680,7 @@
}
- private static boolean reverseDoDeleteOldRdn( Attributes t0_entry, Rdn t1_rdn ) throws NamingException
+ private static boolean reverseDoDeleteOldRdn( Attributes t0_entry, Rdn t1_rdn )
{
// Consider simple example changes (rename or move does not matter)
// -------------------------------------------------------------------
@@ -790,6 +811,10 @@
reverseModification = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, previous );
reverseModifications.add( 0, reverseModification );
break;
+
+ default :
+ break; // Do nothing
+
}
AttributeUtils.applyModification( clonedEntry, modification );
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java Fri Jun 6 23:28:06 2008
@@ -107,6 +107,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractMessage.java Fri Jun 6 23:28:06 2008
@@ -229,6 +229,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractRequest.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractRequest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractRequest.java Fri Jun 6 23:28:06 2008
@@ -65,6 +65,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java Fri Jun 6 23:28:06 2008
@@ -218,6 +218,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributeImpl.java Fri Jun 6 23:28:06 2008
@@ -686,10 +686,11 @@
/**
- * Compute the hashcode for this attribute. It's a combinaison
- * of the ID and all the values' hashcodes.
+ * Compute the hash code for this attribute. It's a combinaison
+ * of the ID and all the values' hash codes.
*
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/AttributesImpl.java Fri Jun 6 23:28:06 2008
@@ -20,9 +20,9 @@
package org.apache.directory.shared.ldap.message;
-import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
@@ -43,10 +43,11 @@
*/
public class AttributesImpl implements Attributes
{
- static transient final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/**
* An iterator which returns Attributes.
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class AttributeIterator<T> implements Iterator<Attribute>
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java Fri Jun 6 23:28:06 2008
@@ -368,6 +368,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java Fri Jun 6 23:28:06 2008
@@ -76,14 +76,14 @@
{
public void decodeOccurred( StatefulDecoder decoder, Object decoded )
{
- if ( decoded instanceof Asn1Object )
- {
- cb.decodeOccurred( decoder, transformer.transform( decoded ) );
- }
- else
- {
- cb.decodeOccurred( decoder, decoded );
- }
+ if ( decoded instanceof Asn1Object )
+ {
+ cb.decodeOccurred( decoder, transformer.transform( decoded ) );
+ }
+ else
+ {
+ cb.decodeOccurred( decoder, decoded );
+ }
}
} );
}
@@ -161,8 +161,8 @@
}
else
{
- // TODO : this is certainly not the way we should handle such an exception !
- throw new ResponseCarryingMessageException( e.getMessage() );
+ // TODO : this is certainly not the way we should handle such an exception !
+ throw new ResponseCarryingMessageException( e.getMessage() );
}
}
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java Fri Jun 6 23:28:06 2008
@@ -113,13 +113,11 @@
// ------------------------------------------------------------------------
/**
- * Encodes a Message object peice by peice often emitting chunks of the
+ * Encodes a Message object piece by piece often emitting chunks of the
* final PDU to the callback if present.
*
- * @param obj
- * the message object to encode into a PDU
- * @throws org.apache.directory.shared.asn1.codec.EncoderException
- * if there are problems while encodinggg
+ * @param obj the message object to encode into a PDU
+ * @throws EncoderException if there are problems while encoding
*/
public void encode( Object obj ) throws EncoderException
{
@@ -136,9 +134,7 @@
* any special callbacks because when encoding we do not need to transform
* before a value return as we did in the decoder.
*
- * @param cb
- * the callback to set on the underlying provider specific
- * encoder
+ * @param cb the callback to set on the underlying provider specific encoder
*/
public void setCallback( EncoderCallback cb )
{
@@ -149,8 +145,7 @@
/**
* Sets the monitor of the underlying implementation.
*
- * @param monitor
- * the monitor to set on the underlying implementation
+ * @param monitor the monitor to set on the underlying implementation
*/
public void setEncoderMonitor( EncoderMonitor monitor )
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModificationItemImpl.java Fri Jun 6 23:28:06 2008
@@ -181,6 +181,7 @@
/**
* @see Object#hashCode()
+ * @return the instance's hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/SearchRequestImpl.java Fri Jun 6 23:28:06 2008
@@ -488,6 +488,8 @@
sb.append( " typesOnly : " ).append( typesOnly ).append( '\n' );
+ sb.append( " Size Limit : " );
+
if ( sizeLimit == 0 )
{
sb.append( "no limit" );
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java Fri Jun 6 23:28:06 2008
@@ -98,9 +98,9 @@
public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
throws NamingException
{
- StoredProcedureResponse resp = ( StoredProcedureResponse ) getResultResponse();
- resp.setResponse( berValue );
- resp.setOid( id );
+ StoredProcedureResponse resp = ( StoredProcedureResponse ) getResultResponse();
+ resp.setResponse( berValue );
+ resp.setOid( id );
return resp;
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AtavSerializer.java Fri Jun 6 23:28:06 2008
@@ -60,6 +60,10 @@
* <li>upValue</li> The User Provided value.
* <li>valueLength</li>
* <li>value</li> The normalized value.
+ *
+ * @param atav the AttributeTypeAndValue to serialize
+ * @param out the OutputStream in which the atav will be serialized
+ * @throws IOException If we can't serialize the atav
*/
public static void serialize( AttributeTypeAndValue atav, ObjectOutput out ) throws IOException
{
@@ -139,8 +143,12 @@
* We read back the data to create a new ATAV. The structure
* read is exposed in the {@link AttributeTypeAndValue#writeExternal(ObjectOutput)}
* method<p>
+ *
+ * @param in the input stream
+ * @throws IOException If the input stream can't be read
+ * @return The constructed AttributeTypeAndValue
*/
- public static AttributeTypeAndValue deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+ public static AttributeTypeAndValue deserialize( ObjectInput in ) throws IOException
{
String upName = in.readUTF();
int start = in.readInt();
@@ -163,11 +171,11 @@
{
int upValueLength = in.readInt();
byte[] upValue = new byte[upValueLength];
- in.readFully( (byte[])upValue );
+ in.readFully( upValue );
int valueLength = in.readInt();
byte[] normValue = new byte[valueLength];
- in.readFully( (byte[])normValue );
+ in.readFully( normValue );
AttributeTypeAndValue atav =
new AttributeTypeAndValue( upType, normType, upValue, normValue, start, length, upName );
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/AttributeTypeAndValue.java Fri Jun 6 23:28:06 2008
@@ -47,6 +47,7 @@
* called upName.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class AttributeTypeAndValue implements Cloneable, Comparable, Externalizable
{
@@ -201,10 +202,13 @@
* Note that the upValue should <b>not</b> be null or empty, or resolved
* to an empty string after having trimmed it.
*
- * @param upType The Usrr Provided type
+ * @param upType The User Provided type
* @param normType The normalized type
* @param upValue The User Provided value
* @param normValue The normalized value
+ * @param start Start of this ATAV in the RDN
+ * @param length Length of this ATAV
+ * @param upName The user provided name
*/
/**No protection*/ AttributeTypeAndValue(
String upType,
@@ -344,8 +348,8 @@
/**
* Store the value of a AttributeTypeAndValue.
*
- * @param value
- * The value of the AttributeTypeAndValue
+ * @param value The user provided value of the AttributeTypeAndValue
+ * @param normValue The normalized value
*/
public void setValue( Object upValue, Object normValue )
{
@@ -538,11 +542,11 @@
/**
* Compare two values
*
- * @param val1
- * First String
- * @param val2
- * Second String
- * @return true if both strings are equals or null.
+ * @param val1 First value
+ * @param val2 Second value
+ * @param sensitivity A flag to define the case sensitivity
+ * @return -1 if the first value is inferior to the second one, +1 if
+ * its superior, 0 if both values are equal
*/
private int compareValue( Object val1, Object val2, boolean sensitivity )
{
@@ -608,7 +612,7 @@
{
if ( normValue instanceof String )
{
- // The result will be gathered in a stringBuilder
+ // The result will be gathered in a stringBuilder
StringBuilder sb = new StringBuilder();
// First, store the type and the '=' char
@@ -620,93 +624,93 @@
if ( normalizedValue.length() > 0 )
{
- char[] chars = normalizedValue.toCharArray();
+ char[] chars = normalizedValue.toCharArray();
- // Loop first assuming the DN won't contain any
- // char needing to be escaped. This is the case
- // for 99.99% of all DN (blind bet, of course ...)
- for ( char c:chars )
- {
+ // Loop first assuming the DN won't contain any
+ // char needing to be escaped. This is the case
+ // for 99.99% of all DN (blind bet, of course ...)
+ for ( char c:chars )
+ {
if ( ( c < 0) || ( c > 128 ) )
{
- escaped = true;
- break;
+ escaped = true;
+ break;
}
else if ( DN_ESCAPED_CHARS[ c ] )
{
- escaped = true;
- break;
+ escaped = true;
+ break;
}
- }
+ }
- // Here, we have a char to escape. Start again the loop...
- if ( escaped )
- {
- for ( int i = 0; i < valueLength; i++ )
- {
- char c = chars[i];
-
- if ( ( c < 0) || ( c > 128 ) )
- {
- // For chars which are not ASCII, use their hexa value prefixed by an '\'
- byte[] bb = StringTools.getBytesUtf8( normalizedValue.substring( i, i + 1 ) );
-
- for ( byte b:bb )
- {
- sb.append( '\\' ).
- append( StringTools.dumpHex( (byte)(( b & 0x00F0 ) >> 4) ) ).
- append( StringTools.dumpHex( b ) );
- }
- }
- else if ( DN_ESCAPED_CHARS[ c ] )
- {
- // Some chars need to be escaped even if they are US ASCII
- // Just prefix them with a '\'
- // Special cases are ' ' (space), '#') which need a special
- // treatment.
- if ( c == ' ' )
- {
- if ( ( i == 0 ) || ( i == valueLength - 1 ) )
- {
- sb.append( '\\' ).append( c );
- }
- else
- {
- sb.append( ' ' );
- }
-
- continue;
- }
- else if ( c == '#' )
- {
- if ( i == 0 )
- {
- sb.append( "\\#" );
- continue;
- }
- else
- {
- sb.append( '#' );
- }
-
- continue;
- }
-
- sb.append( '\\' ).append( c );
- }
- else
- {
- // Standard ASCII chars are just appended
- sb.append( c );
- }
- }
- }
- else
- {
- // The String does not contain any escaped char :
- // just append it.
- sb.append( normalizedValue );
- }
+ // Here, we have a char to escape. Start again the loop...
+ if ( escaped )
+ {
+ for ( int i = 0; i < valueLength; i++ )
+ {
+ char c = chars[i];
+
+ if ( ( c < 0) || ( c > 128 ) )
+ {
+ // For chars which are not ASCII, use their hexa value prefixed by an '\'
+ byte[] bb = StringTools.getBytesUtf8( normalizedValue.substring( i, i + 1 ) );
+
+ for ( byte b:bb )
+ {
+ sb.append( '\\' ).
+ append( StringTools.dumpHex( (byte)(( b & 0x00F0 ) >> 4) ) ).
+ append( StringTools.dumpHex( b ) );
+ }
+ }
+ else if ( DN_ESCAPED_CHARS[ c ] )
+ {
+ // Some chars need to be escaped even if they are US ASCII
+ // Just prefix them with a '\'
+ // Special cases are ' ' (space), '#') which need a special
+ // treatment.
+ if ( c == ' ' )
+ {
+ if ( ( i == 0 ) || ( i == valueLength - 1 ) )
+ {
+ sb.append( '\\' ).append( c );
+ }
+ else
+ {
+ sb.append( ' ' );
+ }
+
+ continue;
+ }
+ else if ( c == '#' )
+ {
+ if ( i == 0 )
+ {
+ sb.append( "\\#" );
+ continue;
+ }
+ else
+ {
+ sb.append( '#' );
+ }
+
+ continue;
+ }
+
+ sb.append( '\\' ).append( c );
+ }
+ else
+ {
+ // Standard ASCII chars are just appended
+ sb.append( c );
+ }
+ }
+ }
+ else
+ {
+ // The String does not contain any escaped char :
+ // just append it.
+ sb.append( normalizedValue );
+ }
}
return sb.toString();
@@ -723,6 +727,7 @@
* Gets the hashcode of this object.
*
* @see java.lang.Object#hashCode()
+ * @return The instance hash code
*/
public int hashCode()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/DefaultStringNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/DefaultStringNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/DefaultStringNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/DefaultStringNormalizer.java Fri Jun 6 23:28:06 2008
@@ -32,10 +32,11 @@
* types only.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class DefaultStringNormalizer implements Normalizer
{
- public static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
private static final DefaultStringNormalizer NORMALIZER = new DefaultStringNormalizer();
@@ -61,6 +62,14 @@
return str;
}
+
+ /**
+ * Normalize the given String
+ *
+ * @param string The string to normalize
+ * @return The normalized object
+ * @throws NamingException If the normalization throws an error
+ */
public static Object normalizeString( String string ) throws NamingException
{
return NORMALIZER.normalize( string );
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java Fri Jun 6 23:28:06 2008
@@ -36,7 +36,6 @@
import javax.naming.Name;
import javax.naming.NamingException;
-import org.apache.directory.shared.ldap.name.DefaultStringNormalizer;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
@@ -60,6 +59,7 @@
* is the first RDN (RDN[n]).
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class LdapDN implements Name, Externalizable
{
@@ -76,10 +76,10 @@
private static final long serialVersionUID = 1L;
/** Value returned by the compareTo method if values are not equals */
- public final static int NOT_EQUALS = -1;
+ public static final int NOT_EQUAL = -1;
/** Value returned by the compareTo method if values are equals */
- public final static int EQUALS = 0;
+ public static final int EQUAL = 0;
/** A flag used to tell if the DN has been normalized */
private boolean normalized;
@@ -114,7 +114,6 @@
*/
public LdapDN()
{
- super();
upName = "";
normName = "";
normalized = true;
@@ -148,6 +147,7 @@
* is a String
*
* @param list of String name components.
+ * @throws InvalidNameException If the nameComponent is incorrect
*/
public LdapDN( List<String> list ) throws InvalidNameException
{
@@ -167,8 +167,8 @@
/**
* Creates an ldap name using a list of name components.
*
- * @param nameComponents
- * List of String name components.
+ * @param nameComponents List of String name components.
+ * @throws InvalidNameException If the nameComponent is incorrect
*/
public LdapDN( Iterator<String> nameComponents ) throws InvalidNameException
{
@@ -217,6 +217,9 @@
* Create a DN when deserializing it.
*
* Note : this constructor is used only by the deserialization method.
+ * @param upName The user provided name
+ * @param normName the normalized name
+ * @param bytes the name as a byte[]
*/
/* No protection */ LdapDN( String upName, String normName, byte[] bytes )
{
@@ -497,9 +500,10 @@
/**
- * Gets the hashcode of this name.
+ * Gets the hash code of this name.
*
* @see java.lang.Object#hashCode()
+ * @return the instance hash code
*/
public int hashCode()
{
@@ -1143,13 +1147,13 @@
// RDN normalized name. The very same for upName.
if (rdns.size() == 1 )
{
- normName = newRdn.toString();
- upName = newRdn.getUpName();
+ normName = newRdn.toString();
+ upName = newRdn.getUpName();
}
else
{
- normName = newRdn + "," + normName;
- upName = newRdn.getUpName() + "," + upName;
+ normName = newRdn + "," + normName;
+ upName = newRdn.getUpName() + "," + upName;
}
bytes = StringTools.getBytesUtf8( normName );
@@ -1237,6 +1241,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
+ * @return <code>true</code> if the two instances are equals
*/
public boolean equals( Object obj )
{
@@ -1278,17 +1283,17 @@
{
if ( obj instanceof LdapDN )
{
- LdapDN ldapDN = ( LdapDN ) obj;
+ LdapDN dn = ( LdapDN ) obj;
- if ( ldapDN.size() != size() )
+ if ( dn.size() != size() )
{
- return size() - ldapDN.size();
+ return size() - dn.size();
}
for ( int i = rdns.size(); i > 0; i-- )
{
Rdn rdn1 = rdns.get( i - 1 );
- Rdn rdn2 = ldapDN.rdns.get( i - 1 );
+ Rdn rdn2 = dn.rdns.get( i - 1 );
int res = rdn1.compareTo( rdn2 );
if ( res != 0 )
@@ -1297,7 +1302,7 @@
}
}
- return EQUALS;
+ return EQUAL;
}
else
{
@@ -1329,8 +1334,8 @@
if ( oidNormalizer != null )
{
return new AttributeTypeAndValue( atav.getUpType(), oidNormalizer.getAttributeTypeOid(),
- atav.getUpValue(),
- oidNormalizer.getNormalizer().normalize( atav.getNormValue() ) );
+ atav.getUpValue(),
+ oidNormalizer.getNormalizer().normalize( atav.getNormValue() ) );
}
else
@@ -1389,11 +1394,8 @@
Rdn rdnCopy = ( Rdn ) rdn.clone();
rdn.clear();
- Iterator<AttributeTypeAndValue> atavs = rdnCopy.iterator();
-
- while ( atavs.hasNext() )
+ for ( AttributeTypeAndValue val:rdnCopy )
{
- AttributeTypeAndValue val = atavs.next();
AttributeTypeAndValue newAtav = atavOidToName( val, oidsMap );
rdn.addAttributeTypeAndValue( val.getUpType(), newAtav.getNormType(), val.getUpValue(), newAtav.getNormValue() );
}
@@ -1471,7 +1473,6 @@
* @param dn The DN to transform.
* @param oidsMap The mapping between names and oids.
* @return A normalized form of the DN.
- * @throws InvalidNameException If the DN is invalid.
* @throws NamingException If something went wrong.
*/
public static LdapDN normalize( LdapDN dn, Map<String, OidNormalizer> oidsMap ) throws NamingException
@@ -1513,8 +1514,8 @@
* 'commonname' share the same OID.
*
* @param oidsMap The mapping between names and oids.
- * @throws InvalidNameException If the DN is invalid.
* @throws NamingException If something went wrong.
+ * @return The normalized DN
*/
public LdapDN normalize( Map<String, OidNormalizer> oidsMap ) throws NamingException
{
@@ -1581,6 +1582,9 @@
*
* for each rdn :
* <li>call the RDN write method</li>
+ *
+ *@param out The stream in which the DN will be serialized
+ *@throws IOException If the serialization fail
*/
public void writeExternal( ObjectOutput out ) throws IOException
{
@@ -1634,8 +1638,12 @@
* We read back the data to create a new LdapDN. The structure
* read is exposed in the {@link LdapDN#writeExternal(ObjectOutput)}
* method<p>
+ *
+ * @param in The stream from which the DN is read
+ * @throws IOException If the stream can't be read
+ * @throws ClassNotFoundException If the RDN can't be created
*/
- public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
+ public void readExternal( ObjectInput in ) throws IOException , ClassNotFoundException
{
// Read the UPName
upName = in.readUTF();
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDNSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDNSerializer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDNSerializer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDNSerializer.java Fri Jun 6 23:28:06 2008
@@ -50,6 +50,10 @@
*
* for each rdn :
* <li>call the RDN write method</li>
+ *
+ * @param dn The DN to serialize
+ * @param out the stream in which the DN will be serialized
+ * @throws IOException If we can't write in this stream
*/
public static void serialize( LdapDN dn, ObjectOutput out ) throws IOException
{
@@ -104,8 +108,12 @@
* We read back the data to create a new LdapDN. The structure
* read is exposed in the {@link LdapDNSerializer#serialize(LdapDN, ObjectOutput)}
* method<p>
+ *
+ * @param in The input stream from which the DN is read
+ * @return a deserialized DN
+ * @throws IOException If the stream can't be read
*/
- public static LdapDN deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+ public static LdapDN deserialize( ObjectInput in ) throws IOException
{
// Read the UPName
String upName = in.readUTF();
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java Fri Jun 6 23:28:06 2008
@@ -24,13 +24,13 @@
import javax.naming.InvalidNameException;
import javax.naming.Name;
+import javax.naming.NameParser;
+
import org.apache.directory.shared.ldap.util.DNUtils;
import org.apache.directory.shared.ldap.util.Position;
import org.apache.directory.shared.ldap.util.StringTools;
-import javax.naming.NameParser;
-
/**
* This class parses a DN. The DN MUST respect this BNF grammar (as of RFC2253,
@@ -65,6 +65,7 @@
* </p>
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
*/
public class LdapDnParser implements NameParser
{
@@ -144,8 +145,8 @@
rdns.add( rdn );
rdn = new Rdn();
- if ( ( StringTools.isCharASCII( dn, pos.start, ',' ) == false )
- && ( StringTools.isCharASCII( dn, pos.start, ';' ) == false ) )
+ if ( ( !StringTools.isCharASCII( dn, pos.start, ',' ) )
+ && ( !StringTools.isCharASCII( dn, pos.start, ';' ) ) )
{
if ( pos.start != dn.length )
@@ -192,8 +193,8 @@
// Now, parse the following nameComponents
do
{
- if ( ( StringTools.isCharASCII( dn, pos.start, ',' ) == false )
- && ( StringTools.isCharASCII( dn, pos.start, ';' ) == false ) )
+ if ( ( !StringTools.isCharASCII( dn, pos.start, ',' ) )
+ && ( !StringTools.isCharASCII( dn, pos.start, ';' ) ) )
{
if ( pos.start != dn.length )
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java Fri Jun 6 23:28:06 2008
@@ -56,6 +56,9 @@
* <li>length</li> The ATAV user provided length
* <li>Call the ATAV write method</li> The ATAV itself
*
+ * @param rdn The RDN to serialize
+ * @param out the stream in which the RDN will be serialized
+ * @throws IOException If we can't write in this stream
*/
public static void serialize( Rdn rdn, ObjectOutput out ) throws IOException
{
@@ -86,14 +89,19 @@
out.flush();
}
+
/**
* Deserialize a RDN instance
*
* We read back the data to create a new RDB. The structure
* read is exposed in the {@link Rdn#writeExternal(ObjectOutput)}
* method<p>
+ *
+ * @param in The input stream from which the RDN is read
+ * @return a deserialized RDN
+ * @throws IOException If the stream can't be read
*/
- public static Rdn deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
+ public static Rdn deserialize( ObjectInput in ) throws IOException
{
// Read the ATAV number
int nbAtavs = in.readInt();
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractAttributeType.java Fri Jun 6 23:28:06 2008
@@ -20,8 +20,8 @@
package org.apache.directory.shared.ldap.schema;
-import javax.naming.NamingException;
import java.io.Serializable;
+import javax.naming.NamingException;
/**
@@ -75,6 +75,8 @@
/**
* @see AttributeType#isSingleValue()
+ * @return true if only one value can exist for this AttributeType, false
+ * otherwise
*/
public boolean isSingleValue()
{
@@ -84,6 +86,7 @@
/**
* @see AttributeType#isCollective()
+ * @return true if the attribute is collective, false otherwise
*/
public boolean isCollective()
{
@@ -93,6 +96,7 @@
/**
* @see AttributeType#isCanUserModify()
+ * @return true if users can modify it, false if only the directory can.
*/
public boolean isCanUserModify()
{
@@ -102,6 +106,7 @@
/**
* @see AttributeType#getUsage()
+ * @return a type safe UsageEnum
*/
public UsageEnum getUsage()
{
@@ -111,6 +116,7 @@
/**
* @see AttributeType#getLength()
+ * @return the length of the attribute
*/
public int getLength()
{
@@ -189,29 +195,41 @@
// -----------------------------------------------------------------------
// Additional Methods
// -----------------------------------------------------------------------
-
-
- public boolean isAncestorOf( AttributeType attributeType ) throws NamingException
+ /**
+ * Checks to see if this AttributeType is the ancestor of another
+ * attributeType.
+ *
+ * @param descendant the perspective descendant to check
+ * @return true if the descendant is truly a derived from this AttributeType
+ * @throws NamingException if there are problems resolving superior types
+ */
+ public boolean isAncestorOf( AttributeType descendant ) throws NamingException
{
- //noinspection SimplifiableIfStatement
- if ( attributeType == null || equals( attributeType ) )
+ if ( ( descendant == null ) || equals( descendant ) )
{
return false;
}
- return isAncestorOrEqual( this, attributeType );
+ return isAncestorOrEqual( this, descendant );
}
- public boolean isDescentantOf( AttributeType attributeType ) throws NamingException
+ /**
+ * Checks to see if this AttributeType is the descendant of another
+ * attributeType.
+ *
+ * @param ancestor the perspective ancestor to check
+ * @return true if this AttributeType truly descends from the ancestor
+ * @throws NamingException if there are problems resolving superior types
+ */
+ public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
{
- //noinspection SimplifiableIfStatement
- if ( attributeType == null || equals( attributeType ) )
+ if ( ( ancestor == null ) || equals( ancestor ) )
{
return false;
}
- return isAncestorOrEqual( attributeType, this );
+ return isAncestorOrEqual( ancestor, this );
}
@@ -227,12 +245,11 @@
*/
private boolean isAncestorOrEqual( AttributeType ancestor, AttributeType descendant ) throws NamingException
{
- if ( ancestor == null || descendant == null )
+ if ( ( ancestor == null ) || ( descendant == null ) )
{
return false;
}
- //noinspection SimplifiableIfStatement
if ( ancestor.equals( descendant ) )
{
return true;
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSchemaObject.java Fri Jun 6 23:28:06 2008
@@ -171,7 +171,8 @@
if ( names != null )
{
- this.names = names;
+ this.names = new String[names.length];
+ System.arraycopy( names, 0, this.names, 0, names.length );
}
hash = oid.hashCode();
@@ -184,6 +185,8 @@
/**
* @see SchemaObject#getOid()
+ * @return an OID for this SchemaObject or its MatchingRule if this
+ * SchemaObject is a MatchingRuleUse object
*/
public String getOid()
{
@@ -193,6 +196,7 @@
/**
* @see SchemaObject#isObsolete()
+ * @return true if inactive, false if active
*/
public boolean isObsolete()
{
@@ -202,8 +206,9 @@
/**
* @see SchemaObject#getNames()
+ * @return the names for this SchemaObject
*/
- public String[] getNames()
+ public String[] getNamesRef()
{
return names;
}
@@ -211,6 +216,7 @@
/**
* @see SchemaObject#getSchema()
+ * @return the name of the schema associated with this schemaObject
*/
public String getSchema()
{
@@ -220,6 +226,8 @@
/**
* @see SchemaObject#getName()
+ * @return the first of the names for this SchemaObject or null if one does
+ * not exist
*/
public String getName()
{
@@ -229,6 +237,7 @@
/**
* @see SchemaObject#getDescription()
+ * @return a short description about this SchemaObject
*/
public String getDescription()
{
@@ -272,7 +281,8 @@
*/
protected void setNames( String[] names )
{
- this.names = names;
+ this.names = new String[names.length];
+ System.arraycopy( names, 0, this.names, 0, names.length );
}
@@ -320,7 +330,6 @@
return true;
}
- //noinspection SimplifiableIfStatement
if ( obj instanceof SchemaObject )
{
return oid.equals( ( ( SchemaObject ) obj ).getOid() );
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSyntax.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSyntax.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AbstractSyntax.java Fri Jun 6 23:28:06 2008
@@ -100,6 +100,7 @@
/**
* @see org.apache.directory.shared.ldap.schema.Syntax#isHumanReadable()
+ * @return true if the syntax can be interpreted by humans, false otherwise
*/
public final boolean isHumanReadable()
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ByteArrayComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ByteArrayComparator.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ByteArrayComparator.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ByteArrayComparator.java Fri Jun 6 23:28:06 2008
@@ -29,18 +29,16 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-public class ByteArrayComparator implements Comparator
+public class ByteArrayComparator implements Comparator<byte[]>
{
- public static final ByteArrayComparator INSTANCE = new ByteArrayComparator();
+ /** A static instance of this comparator */
+ public static final Comparator<byte[]> INSTANCE = new ByteArrayComparator();
- /* (non-Javadoc)
+ /**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
- public int compare( Object o1, Object o2 )
+ public int compare( byte[] b1, byte[] b2 )
{
- byte[] b1 = ( byte[] ) o1;
- byte[] b2 = ( byte[] ) o2;
-
// -------------------------------------------------------------------
// Handle some basis cases
// -------------------------------------------------------------------
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/CachingNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/CachingNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/CachingNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/CachingNormalizer.java Fri Jun 6 23:28:06 2008
@@ -77,6 +77,10 @@
/**
* @see org.apache.directory.shared.ldap.schema.Normalizer#normalize(java.lang.Object)
+ *
+ * @param value the value to normalize. It must *not* be null !
+ * @return the normalized form for a value
+ * @throws NamingException if an error results during normalization
*/
public Object normalize( Object value ) throws NamingException
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ComparableComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ComparableComparator.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ComparableComparator.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ComparableComparator.java Fri Jun 6 23:28:06 2008
@@ -20,8 +20,8 @@
package org.apache.directory.shared.ldap.schema;
-import java.util.Comparator;
import java.io.Serializable;
+import java.util.Comparator;
/**
@@ -30,10 +30,9 @@
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$
*/
-@SuppressWarnings("unchecked")
public class ComparableComparator implements Comparator, Serializable
{
- static final long serialVersionUID = -5295278271807198471L;
+ private static final long serialVersionUID = -5295278271807198471L;
/**
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimNormalizer.java Fri Jun 6 23:28:06 2008
@@ -37,7 +37,7 @@
*/
public class DeepTrimNormalizer implements Normalizer
{
- static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
public Object normalize( Object value ) throws NamingException
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java Fri Jun 6 23:28:06 2008
@@ -38,7 +38,7 @@
*/
public class DeepTrimToLowerNormalizer implements Normalizer
{
- public static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
public Object normalize( Object value ) throws NamingException
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DefaultObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DefaultObjectClass.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DefaultObjectClass.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DefaultObjectClass.java Fri Jun 6 23:28:06 2008
@@ -20,11 +20,11 @@
package org.apache.directory.shared.ldap.schema;
-import java.util.List;
-import java.util.ArrayList;
-
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Objectclass specification bean used to store the schema information for an
@@ -35,7 +35,7 @@
*/
public class DefaultObjectClass extends AbstractSchemaObject implements ObjectClass, Serializable
{
- static final long serialVersionUID = -4744807759763092241L;
+ private static final long serialVersionUID = -4744807759763092241L;
/** empty array of ObjectClasses so we do not have to recreate objects */
private static final ObjectClass[] EMPTY_OCLASS_ARR = new ObjectClass[0];
@@ -109,19 +109,19 @@
public boolean isStructural()
{
- return type == ObjectClassTypeEnum.STRUCTURAL;
+ return type == ObjectClassTypeEnum.STRUCTURAL;
}
public boolean isAbstract()
{
- return type == ObjectClassTypeEnum.ABSTRACT;
+ return type == ObjectClassTypeEnum.ABSTRACT;
}
public boolean isAuxiliary()
{
- return type == ObjectClassTypeEnum.AUXILIARY;
+ return type == ObjectClassTypeEnum.AUXILIARY;
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DescriptionUtils.java Fri Jun 6 23:28:06 2008
@@ -73,6 +73,8 @@
* the attributeType to generate a description for
* @return the AttributeTypeDescription Syntax for the attributeType in a
* pretty formated string
+ * @throws NamingException If an error is raised while accessing some of the attributeType
+ * data
*/
public static String getDescription( AttributeType attributeType ) throws NamingException
{
@@ -173,6 +175,8 @@
* the DIT content rule specification
* @return the specification according to the DITContentRuleDescription
* syntax
+ * @throws NamingException If an error is raised while accessing some of the dITConentRule
+ * data
*/
public static String getDescription( DITContentRule dITContentRule ) throws NamingException
{
@@ -197,51 +201,59 @@
buf.append( '\n' );
}
- // print out all the auxillary object class oids
+ // print out all the auxiliary object class oids
ObjectClass[] aux = dITContentRule.getAuxObjectClasses();
+
if ( aux != null && aux.length > 0 )
{
buf.append( "AUX\n" );
- for ( int ii = 0; ii < aux.length; ii++ )
+
+ for ( ObjectClass objectClass: aux )
{
buf.append( '\t' );
- buf.append( aux[ii].getOid() );
+ buf.append( objectClass.getOid() );
buf.append( '\n' );
}
}
AttributeType[] must = dITContentRule.getMustNames();
+
if ( must != null && must.length > 0 )
{
buf.append( "MUST\n" );
- for ( int ii = 0; ii < must.length; ii++ )
+
+ for ( AttributeType attributeType:must )
{
buf.append( '\t' );
- buf.append( must[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
AttributeType[] may = dITContentRule.getMayNames();
+
if ( may != null && may.length > 0 )
{
buf.append( "MAY\n" );
- for ( int ii = 0; ii < may.length; ii++ )
+
+ for ( AttributeType attributeType:may )
{
buf.append( '\t' );
- buf.append( may[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
AttributeType[] not = dITContentRule.getNotNames();
+
if ( not != null && not.length > 0 )
{
buf.append( "NOT\n" );
- for ( int ii = 0; ii < not.length; ii++ )
+
+ for ( AttributeType attributeType:not )
{
buf.append( '\t' );
- buf.append( not[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
@@ -270,6 +282,8 @@
* @param matchingRule
* the MatchingRule to generate the description for
* @return the MatchingRuleDescription string
+ * @throws NamingException If an error is raised while accessing some of the matchingRule
+ * data
*/
public static String getDescription( MatchingRule matchingRule ) throws NamingException
{
@@ -331,6 +345,8 @@
* @param matchingRuleUse The matching rule from which we want to generate
* a MatchingRuleUseDescription.
* @return The generated MatchingRuleUseDescription
+ * @throws NamingException If an error is raised while accessing some of the matchingRuleUse
+ * data
*/
public static String getDescription( MatchingRuleUse matchingRuleUse ) throws NamingException
{
@@ -400,6 +416,8 @@
* @param nameForm
* the NameForm to generate the description for
* @return the NameFormDescription string
+ * @throws NamingException If an error is raised while accessing some of the nameForm
+ * data
*/
public static String getDescription( NameForm nameForm ) throws NamingException
{
@@ -430,21 +448,24 @@
buf.append( "MUST\n" );
AttributeType[] must = nameForm.getMustUse();
- for ( int ii = 0; ii < must.length; ii++ )
+
+ for ( AttributeType attributeType:must )
{
buf.append( '\t' );
- buf.append( must[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
AttributeType[] may = nameForm.getMayUse();
+
if ( may != null && may.length > 0 )
{
buf.append( "MAY\n" );
- for ( int ii = 0; ii < must.length; ii++ )
+
+ for ( AttributeType attributeType:may )
{
buf.append( '\t' );
- buf.append( may[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
@@ -477,6 +498,8 @@
* @param objectClass
* the ObjectClass to generate a description for
* @return the description in the ObjectClassDescription syntax
+ * @throws NamingException If an error is raised while accessing some of the objectClass
+ * data
*/
public static String getDescription( ObjectClass objectClass ) throws NamingException
{
@@ -502,13 +525,15 @@
}
ObjectClass[] sups = objectClass.getSuperClasses();
+
if ( sups != null && sups.length > 0 )
{
buf.append( "SUP\n" );
- for ( int ii = 0; ii < sups.length; ii++ )
+
+ for ( ObjectClass sup:sups )
{
buf.append( '\t' );
- buf.append( sups[ii].getOid() );
+ buf.append( sup.getOid() );
buf.append( '\n' );
}
}
@@ -523,22 +548,25 @@
if ( must != null && must.length > 0 )
{
buf.append( "MUST\n" );
- for ( int ii = 0; ii < must.length; ii++ )
+
+ for ( AttributeType attributeType:must )
{
buf.append( '\t' );
- buf.append( must[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
AttributeType[] may = objectClass.getMayList();
+
if ( may != null && may.length > 0 )
{
buf.append( "MAY\n" );
- for ( int ii = 0; ii < may.length; ii++ )
+
+ for ( AttributeType attributeType:may )
{
buf.append( '\t' );
- buf.append( may[ii].getOid() );
+ buf.append( attributeType.getOid() );
buf.append( '\n' );
}
}
@@ -568,6 +596,8 @@
* @param dITStructureRule
* the DITStructureRule to generate the description for
* @return the description in the DITStructureRuleDescription syntax
+ * @throws NamingException If an error is raised while accessing some of the dITStructureRule
+ * data
*/
public static String getDescription( DITStructureRule dITStructureRule ) throws NamingException
{
@@ -600,10 +630,11 @@
if ( sups != null && sups.length > 0 )
{
buf.append( "SUP\n" );
- for ( int ii = 0; ii < sups.length; ii++ )
+
+ for ( DITStructureRule sup:sups )
{
buf.append( '\t' );
- buf.append( sups[ii].getOid() );
+ buf.append( sup.getOid() );
buf.append( '\n' );
}
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectIdentifierNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectIdentifierNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectIdentifierNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ObjectIdentifierNormalizer.java Fri Jun 6 23:28:06 2008
@@ -31,7 +31,7 @@
*/
public class ObjectIdentifierNormalizer implements Normalizer
{
- public static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
public Object normalize( Object value ) throws NamingException
{
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/PrepareString.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/PrepareString.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/PrepareString.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/PrepareString.java Fri Jun 6 23:28:06 2008
@@ -90,6 +90,16 @@
WORD
}
+
+ /**
+ * A private constructor, to avoid instance creation of this static class.
+ */
+ private PrepareString()
+ {
+ // Do nothing
+ }
+
+
/**
* Tells if a char is a combining mark.
*
@@ -127,8 +137,9 @@
*
* The first step is already done, the step (3) is not done.
*
- * @param str
- * @return Normalised string.
+ * @param str The String to normalize
+ * @param type The string type
+ * @return A normalized string.
* @throws IOException
*/
public static String normalize( String str, StringType type ) throws IOException
@@ -166,7 +177,10 @@
* - transform to spaces
* - lowercase
*
- * @param array The char array to transform
+ * @param c The char to map
+ * @param target The array which will collect the transformed char
+ * @param pos The current position in the target
+ * @param lowerCase A mask to lowercase the char, if necessary
* @return The transformed StringBuilder
*/
private static int map( char c, char[] target, int pos, char lowerCase )
@@ -3948,6 +3962,7 @@
}
target[pos++] = c;
+ break;
}
return pos - start;
@@ -3963,7 +3978,7 @@
* - Table C.8 of RFC 3454
* - character U-FFFD
*
- * @param str The String to analyze
+ * @param c The char to analyze
* @throws InvalidCharacterException If any character is prohibited
*/
private static void checkProhibited( char c ) throws InvalidCharacterException
@@ -4118,6 +4133,8 @@
case 0xFF00 :
case 0xFFE7 :
throw new InvalidCharacterException( c );
+ default:
+ break;
}
// RFC 3454, Table A.1, intervals
@@ -4528,6 +4545,8 @@
case 0x206E : // NATIONAL DIGIT SHAPES
case 0x206F : // NOMINAL DIGIT SHAPES
throw new InvalidCharacterException( c );
+ default :
+ break;
}
if ( c == 0xFFFD )
@@ -4591,7 +4610,7 @@
* will be trasnformed to :
* "+(33)1123456789"
*
- * @param array The telephone number char array
+ * @param str The telephone number
* @return The modified telephone number String
*/
private static String insignifiantCharTelephoneNumber( String str )
@@ -4630,6 +4649,7 @@
}
array[pos++] = c;
+ break;
}
}
@@ -4644,7 +4664,7 @@
* will be transformed to :
* "123456789"
*
- * @param array The numeric char array
+ * @param str The numeric String
* @return The modified numeric StringBuilder
*/
private static String insignifiantCharNumericString( String str )
@@ -4687,8 +4707,10 @@
* This method use a finite state machine to parse
* the text.
*
- * @param array The char array representing the string
+ * @param str The String to modify
+ * @param caseSensitive A flag telling if the chars must be lowercased
* @return The modified StringBuilder
+ * @throws InvalidCharacterException If an invalid character is found in the String
*/
private static String insignifiantSpacesString( String str, boolean caseSensitive ) throws InvalidCharacterException
{
@@ -4723,7 +4745,7 @@
char c = '\0';
// First remove starting spaces
- for (; i < limit; i++ )
+ for ( i=0; i < limit; i++ )
{
c = target[i];
@@ -4778,7 +4800,7 @@
// a list of chars and spaces. We will consider that
// we have couples of chars and spaces :
// (char * space*)*. We have a special case :
- // a space followed by a comining char.
+ // a space followed by a combining char.
boolean spaceSeen = false;
boolean space2Seen = false;
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/RegexNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/RegexNormalizer.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/RegexNormalizer.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/RegexNormalizer.java Fri Jun 6 23:28:06 2008
@@ -32,7 +32,7 @@
*/
public class RegexNormalizer implements Normalizer
{
- public static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
/** the perl 5 regex engine */
private final Pattern[] regexes;
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java?rev=664290&r1=664289&r2=664290&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaObject.java Fri Jun 6 23:28:06 2008
@@ -60,7 +60,7 @@
*
* @return the names for this SchemaObject
*/
- String[] getNames();
+ String[] getNamesRef();
/**