You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2010/10/04 00:43:52 UTC
svn commit: r1004064 [3/3] - in
/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap:
./ codec/ codec/actions/ codec/controls/replication/syncRequestValue/
codec/extended/operations/certGeneration/ csn/ entry/ message/ message/ex...
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ConcreteNameComponentNormalizer.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ConcreteNameComponentNormalizer.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/normalizers/ConcreteNameComponentNormalizer.java Sun Oct 3 22:43:50 2010
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
public class ConcreteNameComponentNormalizer implements NameComponentNormalizer
{
/** The LoggerFactory used by this Interceptor */
- private static Logger LOG = LoggerFactory.getLogger( ConcreteNameComponentNormalizer.class );
+ private static final Logger LOG = LoggerFactory.getLogger( ConcreteNameComponentNormalizer.class );
/** the schemaManager used to dynamically resolve Normalizers */
private final SchemaManager schemaManager;
@@ -105,7 +105,7 @@ public class ConcreteNameComponentNormal
}
/**
- * @see NameComponentNormalizer#normalizeByName(String, String)
+ * {@inheritDoc}
*/
public Object normalizeByName( String name, String value ) throws LdapException
{
@@ -136,7 +136,7 @@ public class ConcreteNameComponentNormal
/**
- * @see NameComponentNormalizer#normalizeByName(String, String)
+ * {@inheritDoc}
*/
public Object normalizeByName( String name, byte[] value ) throws LdapException
{
@@ -164,7 +164,7 @@ public class ConcreteNameComponentNormal
/**
- * @see NameComponentNormalizer#normalizeByOid(String, String)
+ * {@inheritDoc}
*/
public Object normalizeByOid( String oid, String value ) throws LdapException
{
@@ -173,7 +173,7 @@ public class ConcreteNameComponentNormal
/**
- * @see NameComponentNormalizer#normalizeByOid(String, String)
+ * {@inheritDoc}
*/
public Object normalizeByOid( String oid, byte[] value ) throws LdapException
{
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/ACIItemSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/ACIItemSyntaxChecker.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/ACIItemSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/ACIItemSyntaxChecker.java Sun Oct 3 22:43:50 2010
@@ -45,7 +45,7 @@ public class ACIItemSyntaxChecker extend
private static final long serialVersionUID = 1L;
/** An instance of ACI Item Checker */
- private ACIItemChecker ACI_ITEM_CHECKER;
+ private ACIItemChecker aciItemChecker;
/**
* Creates a new instance of ACIItemSyntaxChecker
@@ -90,9 +90,9 @@ public class ACIItemSyntaxChecker extend
try
{
- synchronized( ACI_ITEM_CHECKER )
+ synchronized( aciItemChecker )
{
- ACI_ITEM_CHECKER.parse( strValue );
+ aciItemChecker.parse( strValue );
}
LOG.debug( "Syntax valid for '{}'", value );
@@ -111,6 +111,6 @@ public class ACIItemSyntaxChecker extend
*/
public void setSchemaManager( SchemaManager schemaManager )
{
- ACI_ITEM_CHECKER = new ACIItemChecker( schemaManager );
+ aciItemChecker = new ACIItemChecker( schemaManager );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/SubtreeSpecificationSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/SubtreeSpecificationSyntaxChecker.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/SubtreeSpecificationSyntaxChecker.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntaxCheckers/SubtreeSpecificationSyntaxChecker.java Sun Oct 3 22:43:50 2010
@@ -46,7 +46,7 @@ public class SubtreeSpecificationSyntaxC
private static final long serialVersionUID = 1L;
/** The associated checker */
- private SubtreeSpecificationChecker SUBTREE_SPECIFICATION_CHECKER;
+ private SubtreeSpecificationChecker subtreeSpecificationChecker;
/**
* Creates an instance of SubtreeSpecificationSyntaxChecker
@@ -91,9 +91,9 @@ public class SubtreeSpecificationSyntaxC
try
{
- synchronized( SUBTREE_SPECIFICATION_CHECKER )
+ synchronized( subtreeSpecificationChecker )
{
- SUBTREE_SPECIFICATION_CHECKER.parse( strValue );
+ subtreeSpecificationChecker.parse( strValue );
}
LOG.debug( "Syntax valid for '{}'", value );
@@ -112,6 +112,6 @@ public class SubtreeSpecificationSyntaxC
*/
public void setSchemaManager( SchemaManager schemaManager )
{
- SUBTREE_SPECIFICATION_CHECKER = new SubtreeSpecificationChecker( schemaManager );
+ subtreeSpecificationChecker = new SubtreeSpecificationChecker( schemaManager );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base32.java Sun Oct 3 22:43:50 2010
@@ -24,11 +24,14 @@ package org.apache.directory.shared.ldap
/**
* decoding of base32 characters to raw bytes.
*
+ * TODO: This class isn't used, remove it?
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public final class Base32
{
- private static byte[] CHARS = new byte[]{
+ /** The available characters */
+ private static final byte[] CHARS = new byte[]{
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
@@ -43,6 +46,12 @@ public final class Base32
}
+ /**
+ * Encodes a string to a Base64 encoded String.
+ *
+ * @param str the string
+ * @return the Base64 encoded string
+ */
public static String encode( String str )
{
if ( StringTools.isEmpty( str ) )
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base64.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base64.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base64.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/Base64.java Sun Oct 3 22:43:50 2010
@@ -20,11 +20,12 @@
package org.apache.directory.shared.ldap.util;
+
import org.apache.directory.shared.i18n.I18n;
/**
- * decoding of base64 characters to raw bytes.
+ * Encoding and decoding of Base64 characters to and from raw bytes.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -40,49 +41,49 @@ public final class Base64
/**
- * passed data array.
+ * Encodes binary data to a Base64 encoded characters.
*
- * @param a_data
+ * @param data
* the array of bytes to encode
* @return base64-coded character array.
*/
- public static char[] encode( byte[] a_data )
+ public static char[] encode( byte[] data )
{
- char[] l_out = new char[( ( a_data.length + 2 ) / 3 ) * 4];
+ char[] out = new char[( ( data.length + 2 ) / 3 ) * 4];
//
// 3 bytes encode to 4 chars. Output is always an even
// multiple of 4 characters.
//
- for ( int ii = 0, l_index = 0; ii < a_data.length; ii += 3, l_index += 4 )
+ for ( int ii = 0, index = 0; ii < data.length; ii += 3, index += 4 )
{
- boolean l_quad = false;
- boolean l_trip = false;
+ boolean isQuadrupel = false;
+ boolean isTripel = false;
- int l_val = ( 0xFF & a_data[ii] );
- l_val <<= 8;
- if ( ( ii + 1 ) < a_data.length )
+ int val = ( 0xFF & data[ii] );
+ val <<= 8;
+ if ( ( ii + 1 ) < data.length )
{
- l_val |= ( 0xFF & a_data[ii + 1] );
- l_trip = true;
+ val |= ( 0xFF & data[ii + 1] );
+ isTripel = true;
}
- l_val <<= 8;
- if ( ( ii + 2 ) < a_data.length )
+ val <<= 8;
+ if ( ( ii + 2 ) < data.length )
{
- l_val |= ( 0xFF & a_data[ii + 2] );
- l_quad = true;
+ val |= ( 0xFF & data[ii + 2] );
+ isQuadrupel = true;
}
- l_out[l_index + 3] = s_alphabet[( l_quad ? ( l_val & 0x3F ) : 64 )];
- l_val >>= 6;
- l_out[l_index + 2] = s_alphabet[( l_trip ? ( l_val & 0x3F ) : 64 )];
- l_val >>= 6;
- l_out[l_index + 1] = s_alphabet[l_val & 0x3F];
- l_val >>= 6;
- l_out[l_index + 0] = s_alphabet[l_val & 0x3F];
+ out[index + 3] = ALPHABET[( isQuadrupel ? ( val & 0x3F ) : 64 )];
+ val >>= 6;
+ out[index + 2] = ALPHABET[( isTripel ? ( val & 0x3F ) : 64 )];
+ val >>= 6;
+ out[index + 1] = ALPHABET[val & 0x3F];
+ val >>= 6;
+ out[index + 0] = ALPHABET[val & 0x3F];
}
- return l_out;
+ return out;
}
@@ -108,10 +109,10 @@ public final class Base64
// just because of extraneous throw-away junk
int tempLen = data.length;
-
- for ( char c:data)
+
+ for ( char c : data )
{
- if ( ( c > 255 ) || s_codes[c] < 0 )
+ if ( ( c > 255 ) || CODES[c] < 0 )
{
--tempLen; // ignore non-valid chars and padding
}
@@ -121,39 +122,39 @@ public final class Base64
// -- plus 2 bytes if there are 3 extra base64 chars,
// or plus 1 byte if there are 2 extra.
- int l_len = ( tempLen / 4 ) * 3;
+ int len = ( tempLen / 4 ) * 3;
if ( ( tempLen % 4 ) == 3 )
{
- l_len += 2;
+ len += 2;
}
if ( ( tempLen % 4 ) == 2 )
{
- l_len += 1;
+ len += 1;
}
- byte[] l_out = new byte[l_len];
+ byte[] out = new byte[len];
- int l_shift = 0; // # of excess bits stored in accum
- int l_accum = 0; // excess bits
- int l_index = 0;
+ int shift = 0; // # of excess bits stored in accum
+ int accum = 0; // excess bits
+ int index = 0;
// we now go through the entire array (NOT using the 'tempLen' value)
- for ( char c:data )
+ for ( char c : data )
{
- int l_value = ( c > 255 ) ? -1 : s_codes[c];
+ int value = ( c > 255 ) ? -1 : CODES[c];
- if ( l_value >= 0 ) // skip over non-code
+ if ( value >= 0 ) // skip over non-code
{
- l_accum <<= 6; // bits shift up by 6 each time thru
- l_shift += 6; // loop, with new bits being put in
- l_accum |= l_value; // at the bottom. whenever there
- if ( l_shift >= 8 ) // are 8 or more shifted in, write them
+ accum <<= 6; // bits shift up by 6 each time thru
+ shift += 6; // loop, with new bits being put in
+ accum |= value; // at the bottom. whenever there
+ if ( shift >= 8 ) // are 8 or more shifted in, write them
{
- l_shift -= 8; // out (from the top, leaving any excess
- l_out[l_index++] = // at the bottom for next iteration.
- ( byte ) ( ( l_accum >> l_shift ) & 0xff );
+ shift -= 8; // out (from the top, leaving any excess
+ out[index++] = // at the bottom for next iteration.
+ ( byte ) ( ( accum >> shift ) & 0xff );
}
}
// we will also have skipped processing a padding null byte ('=')
@@ -169,44 +170,44 @@ public final class Base64
}
// if there is STILL something wrong we just have to throw up now!
- if ( l_index != l_out.length )
+ if ( index != out.length )
{
- throw new Error( I18n.err( I18n.ERR_04348, l_index, l_out.length ) );
+ throw new Error( I18n.err( I18n.ERR_04348, index, out.length ) );
}
- return l_out;
+ return out;
}
/** code characters for values 0..63 */
- private static char[] s_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
+ private static final char[] ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
.toCharArray();
/** lookup table for converting base64 characters to value in range 0..63 */
- private static byte[] s_codes = new byte[256];
+ private static final byte[] CODES = new byte[256];
static
{
for ( int ii = 0; ii < 256; ii++ )
{
- s_codes[ii] = -1;
+ CODES[ii] = -1;
}
for ( int ii = 'A'; ii <= 'Z'; ii++ )
{
- s_codes[ii] = ( byte ) ( ii - 'A' );
+ CODES[ii] = ( byte ) ( ii - 'A' );
}
for ( int ii = 'a'; ii <= 'z'; ii++ )
{
- s_codes[ii] = ( byte ) ( 26 + ii - 'a' );
+ CODES[ii] = ( byte ) ( 26 + ii - 'a' );
}
for ( int ii = '0'; ii <= '9'; ii++ )
{
- s_codes[ii] = ( byte ) ( 52 + ii - '0' );
+ CODES[ii] = ( byte ) ( 52 + ii - '0' );
}
- s_codes['+'] = 62;
- s_codes['/'] = 63;
+ CODES['+'] = 62;
+ CODES['/'] = 63;
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/DateUtils.java Sun Oct 3 22:43:50 2010
@@ -35,11 +35,11 @@ public final class DateUtils
{
private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "GMT" );
- private static final SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyyMMddHHmmss'Z'" );
+ private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat( "yyyyMMddHHmmss'Z'" );
static
{
- dateFormat.setTimeZone( UTC_TIME_ZONE );
+ DATE_FORMAT.setTimeZone( UTC_TIME_ZONE );
}
@@ -171,9 +171,9 @@ public final class DateUtils
{
Date date = new Date();
- synchronized ( dateFormat )
+ synchronized ( DATE_FORMAT )
{
- return dateFormat.format( date );
+ return DATE_FORMAT.format( date );
}
}
@@ -187,9 +187,9 @@ public final class DateUtils
*/
public static String getGeneralizedTime( Date date )
{
- synchronized ( dateFormat )
+ synchronized ( DATE_FORMAT )
{
- return dateFormat.format( date );
+ return DATE_FORMAT.format( date );
}
}
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?rev=1004064&r1=1004063&r2=1004064&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java Sun Oct 3 22:43:50 2010
@@ -668,8 +668,8 @@ public final class StringTools
{
int index = ii << 1;
- String l_digit = hexString.substring( index, index + 2 );
- buf[ii] = ( byte ) Integer.parseInt( l_digit, 16 );
+ String digit = hexString.substring( index, index + 2 );
+ buf[ii] = ( byte ) Integer.parseInt( digit, 16 );
}
return buf;