directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1679817 - in /directory/shared/trunk: asn1/api/src/main/java/org/apache/directory/api/asn1/ dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/ dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ dsml/parser/src/main/j...
Date Sun, 17 May 2015 06:22:08 GMT
Author: elecharny
Date: Sun May 17 06:22:07 2015
New Revision: 1679817

URL: http://svn.apache.org/r1679817
Log:
Some more Sonar warning removals

Modified:
    directory/shared/trunk/asn1/api/src/main/java/org/apache/directory/api/asn1/package.html
    directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/Dsmlv2Engine.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ParserUtils.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java
    directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/Dsmlv2ResponseGrammar.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/AddResponseDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/BindRequestDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/LdapResultDecorator.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ResponseDecorator.java
    directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/ACIItemParser.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/whoAmI/WhoAmIResponseDecorator.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterEncoder.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/NotNode.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/PasswordUtil.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java

Modified: directory/shared/trunk/asn1/api/src/main/java/org/apache/directory/api/asn1/package.html
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1/api/src/main/java/org/apache/directory/api/asn1/package.html?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/asn1/api/src/main/java/org/apache/directory/api/asn1/package.html (original)
+++ directory/shared/trunk/asn1/api/src/main/java/org/apache/directory/api/asn1/package.html Sun May 17 06:22:07 2015
@@ -25,16 +25,16 @@ Provides the fundamental stateful codec
 <h2>Package Specification</h2>
 
 <ul>
-  <li><a href="codec/stateful">##### REFER TO ANY SPECIFICATIONS HERE #####</a>
+  <li><a href="codec/stateful">##### REFER TO ANY SPECIFICATIONS HERE #####</a></li>
 </ul>
 
 <h2>Related Documentation</h2>
 
 For overviews, tutorials, examples, guides, and tool documentation, please see:
 <ul>
-  <li><a href="http://directory.apache.org/subprojects/asn1/index.html">ASN.1 Project</a>
-  <li><a href="http://directory.apache.org/subprojects/asn1/codec-stateful/index.html">Stateful Codecs</a>
-  <li><a href="http://directory.apache.org/subprojects/asn1/ber-codec/index.html">ASN.1 BER Codecs</a>
+  <li><a href="http://directory.apache.org/subprojects/asn1/index.html">ASN.1 Project</a></li>
+  <li><a href="http://directory.apache.org/subprojects/asn1/codec-stateful/index.html">Stateful Codecs</a></li>
+  <li><a href="http://directory.apache.org/subprojects/asn1/ber-codec/index.html">ASN.1 BER Codecs</a></li>
 </ul>
 
 <!-- Put @see and @since tags down here. -->

Modified: directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/Dsmlv2Engine.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/Dsmlv2Engine.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/Dsmlv2Engine.java (original)
+++ directory/shared/trunk/dsml/engine/src/main/java/org/apache/directory/api/dsmlv2/engine/Dsmlv2Engine.java Sun May 17 06:22:07 2015
@@ -358,11 +358,13 @@ public class Dsmlv2Engine
 
             sb.append( ParserUtils.DSML_NAMESPACE.asXML() );
 
-            sb.append( " " ); // a space to separate the namespace declarations
+            // a space to separate the namespace declarations
+            sb.append( " " );
 
             sb.append( ParserUtils.XSD_NAMESPACE.asXML() );
 
-            sb.append( " " ); // a space to separate the namespace declarations
+            // a space to separate the namespace declarations
+            sb.append( " " );
 
             sb.append( ParserUtils.XSI_NAMESPACE.asXML() );
 
@@ -412,7 +414,8 @@ public class Dsmlv2Engine
             return;
         }
 
-        while ( request != null ) // (Request == null when there's no more request to process)
+        // (Request == null when there's no more request to process)
+        while ( request != null )
         {
             // Checking the request has a requestID attribute if Processing = Parallel and ResponseOrder = Unordered
             if ( ( batchRequest.getProcessing().equals( Processing.PARALLEL ) )

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ParserUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ParserUtils.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ParserUtils.java (original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/ParserUtils.java Sun May 17 06:22:07 2015
@@ -339,7 +339,7 @@ public final class ParserUtils
     /**
      * GrammarAction that reads the SOAP header data
      */
-    public static final GrammarAction readSoapHeader = new GrammarAction( "Reads SOAP header" )
+    public static final GrammarAction READ_SOAP_HEADER = new GrammarAction( "Reads SOAP header" )
     {
         public void action( Dsmlv2Container container ) throws XmlPullParserException
         {

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java (original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/request/Dsmlv2Grammar.java Sun May 17 06:22:07 2015
@@ -92,7 +92,7 @@ public final class Dsmlv2Grammar extends
         name = Dsmlv2Grammar.class.getName();
 
         // Create the transitions table
-        super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 200 ); // TODO Change this value
+        super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 200 );
 
         //====================================================
         //  Transitions concerning : BATCH REQUEST
@@ -1138,7 +1138,7 @@ public final class Dsmlv2Grammar extends
         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <header>
         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()].put( new Tag( "header", Tag.START ),
             new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_START_TAG,
-                ParserUtils.readSoapHeader ) );
+                ParserUtils.READ_SOAP_HEADER ) );
 
         // state: [SOAP_HEADER_START_TAG] -> Tag: </header>
         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()]
@@ -2670,7 +2670,8 @@ public final class Dsmlv2Grammar extends
                 throw new XmlPullParserException( I18n.err( I18n.ERR_03012 ), xpp, null );
             }
 
-            AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter( LdapCodecConstants.APPROX_MATCH_FILTER );
+            AttributeValueAssertionFilter filter = new AttributeValueAssertionFilter(
+                LdapCodecConstants.APPROX_MATCH_FILTER );
 
             filter.setAssertion( assertion );
 

Modified: directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/Dsmlv2ResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/Dsmlv2ResponseGrammar.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/Dsmlv2ResponseGrammar.java (original)
+++ directory/shared/trunk/dsml/parser/src/main/java/org/apache/directory/api/dsmlv2/response/Dsmlv2ResponseGrammar.java Sun May 17 06:22:07 2015
@@ -72,6 +72,7 @@ import org.apache.directory.api.util.Str
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
+
 /**
  * This Class represents the DSMLv2 Response Grammar
  * 
@@ -135,7 +136,7 @@ public final class Dsmlv2ResponseGrammar
         name = Dsmlv2ResponseGrammar.class.getName();
 
         // Create the transitions table
-        super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 300 ); // TODO Change this value
+        super.transitions = ( HashMap<Tag, GrammarTransition>[] ) Array.newInstance( HashMap.class, 300 );
 
         //====================================================
         //  Transitions concerning : BATCH RESPONSE
@@ -219,7 +220,7 @@ public final class Dsmlv2ResponseGrammar
         // State: [ERROR_RESPONSE] - Tag: <detail>
         super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE.ordinal()].put( new Tag( "detail", Tag.START ),
             new GrammarTransition(
-                Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) );
+                Dsmlv2StatesEnum.ERROR_RESPONSE, Dsmlv2StatesEnum.DETAIL_START, ERROR_RESPONSE_ADD_DETAIL ) );
 
         // State: [MESSAGE_END] - Tag: </errorResponse>
         super.transitions[Dsmlv2StatesEnum.MESSAGE_END.ordinal()].put( new Tag( "errorResponse", Tag.END ),
@@ -228,7 +229,7 @@ public final class Dsmlv2ResponseGrammar
         // State: [MESSAGE_END] - Tag: <detail>
         super.transitions[Dsmlv2StatesEnum.MESSAGE_END.ordinal()].put( new Tag( "detail", Tag.START ),
             new GrammarTransition(
-                Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.DETAIL_START, errorResponseAddDetail ) );
+                Dsmlv2StatesEnum.MESSAGE_END, Dsmlv2StatesEnum.DETAIL_START, ERROR_RESPONSE_ADD_DETAIL ) );
 
         // State: [DETAIL_START] - Tag: </detail>
         super.transitions[Dsmlv2StatesEnum.DETAIL_START.ordinal()].put( new Tag( "detail", Tag.END ),
@@ -238,7 +239,7 @@ public final class Dsmlv2ResponseGrammar
         // State: [DETAIL_END] - Tag: <detail>
         super.transitions[Dsmlv2StatesEnum.DETAIL_END.ordinal()].put( new Tag( "detail", Tag.END ),
             new GrammarTransition(
-                Dsmlv2StatesEnum.DETAIL_END, Dsmlv2StatesEnum.DETAIL_END, errorResponseAddDetail ) );
+                Dsmlv2StatesEnum.DETAIL_END, Dsmlv2StatesEnum.DETAIL_END, ERROR_RESPONSE_ADD_DETAIL ) );
 
         // State: [ERROR_RESPONSE] - Tag: </errorResponse>
         super.transitions[Dsmlv2StatesEnum.ERROR_RESPONSE.ordinal()].put( new Tag( "errorResponse", Tag.END ),
@@ -813,7 +814,7 @@ public final class Dsmlv2ResponseGrammar
             Tag.START ),
             new GrammarTransition( Dsmlv2StatesEnum.SEARCH_RESULT_REFERENCE_LOOP, Dsmlv2StatesEnum.LDAP_RESULT,
                 searchResultDoneCreation ) );
-        
+
         //------------------------------------------ handle SOAP envelopes --------------------------
         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()] = new HashMap<Tag, GrammarTransition>();
@@ -831,7 +832,7 @@ public final class Dsmlv2ResponseGrammar
         // state: [SOAP_ENVELOPE_START_TAG] -> Tag: <header>
         super.transitions[Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG.ordinal()].put( new Tag( "header", Tag.START ),
             new GrammarTransition( Dsmlv2StatesEnum.SOAP_ENVELOPE_START_TAG, Dsmlv2StatesEnum.SOAP_HEADER_START_TAG,
-                    ParserUtils.readSoapHeader ) );
+                ParserUtils.READ_SOAP_HEADER ) );
 
         // state: [SOAP_HEADER_START_TAG] -> Tag: </header>
         super.transitions[Dsmlv2StatesEnum.SOAP_HEADER_START_TAG.ordinal()]
@@ -1294,7 +1295,8 @@ public final class Dsmlv2ResponseGrammar
     /**
      * GrammarAction that adds Detail to an Error Response
      */
-    private final GrammarAction errorResponseAddDetail = null; // TODO Look for documentation about this Detail element (the DSML documentation doesn't give enough information)
+    // TODO Look for documentation about this Detail element (the DSML documentation doesn't give enough information)
+    private static final GrammarAction ERROR_RESPONSE_ADD_DETAIL = null;
 
 
     /**

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java Sun May 17 06:22:07 2015
@@ -71,38 +71,57 @@ public class DefaultConfigurableBinaryAt
     /** A list of all the known binary attributes */
     public static final String[] DEFAULT_BINARY_ATTRIBUTES = new String[]
         {
-            "entryACI", // Syntax : ACI Item
-            "prescriptiveACI", // Syntax : ACI Item
-            "subentryACI", // Syntax : ACI Item
-            "audio", // Syntax : Audio
-            "javaByteCode", // Syntax : Binary
-            "javaClassByteCode", // Syntax : Binary
-            "krb5key", // Syntax : Binary
-            "m-byteCode", // Syntax : Binary
-            "privateKey", // Syntax : Binary
-            "publicKey", // Syntax : Binary
-            "userPKCS12", // Syntax : Binary
-            "userSMIMECertificate", // Syntax : Binary
-            "cACertificate", // Syntax : Certificate
-            "userCertificate", // Syntax : Certificate
-            "authorityRevocationList", // Syntax : Certificate List
-            "certificateRevocationList",// Syntax : Certificate List
-            "deltaRevocationList", // Syntax : Certificate List
-            "crossCertificatePair", // Syntax : Certificate Pair
-            "personalSignature", // Syntax : Fax
-            "photo", // Syntax : Fax
-            "jpegPhoto", // Syntax : JPEG
-            "supportedAlgorithms", // Syntax : Supported Algorithm
-            "javaSerializedData", // Syntax : Octet String
-            "userPassword", // Syntax : Octet String
-            
+            // Syntax : ACI Item
+            "entryACI",
+            "prescriptiveACI",
+            "subentryACI",
+
+            // Syntax : AUDIO
+            "audio",
+
+            // Syntax : Binary
+            "javaByteCode",
+            "javaClassByteCode",
+            "krb5key",
+            "m-byteCode",
+            "privateKey",
+            "publicKey",
+            "userPKCS12",
+            "userSMIMECertificate",
+
+            // Syntax : Certificate
+            "cACertificate",
+            "userCertificate",
+
+            // Syntax : Certificate List
+            "authorityRevocationList",
+            "certificateRevocationList",
+            "deltaRevocationList",
+
+            // Syntax : Certificate Pair
+            "crossCertificatePair",
+
+            // Syntax : Fax
+            "personalSignature",
+            "photo",
+
+            // Syntax : JPEG
+            "jpegPhoto",
+
+            // Syntax : Supported Algorithm
+            "supportedAlgorithms",
+
+            // Syntax : Octet String
+            "javaSerializedData",
+            "userPassword",
+
             // Active Directory specific attributes see DIRAPI-177
             "objectSid",
             "objectGUID",
             "thumbnailLogo",
             "thumbnailPhoto",
             "x500uniqueIdentifier"
-        };
+    };
 
 
     /**

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java Sun May 17 06:22:07 2015
@@ -80,7 +80,8 @@ public class LdapEncoder
         // The criticality, only if true
         if ( control.isCritical() )
         {
-            controlLength += 1 + 1 + 1; // Always 3 for a boolean
+            // Always 3 for a boolean
+            controlLength += 1 + 1 + 1;
         }
 
         if ( controlValueLength != 0 )

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzDecorator.java Sun May 17 06:22:07 2015
@@ -25,7 +25,6 @@ import java.nio.ByteBuffer;
 import org.apache.directory.api.asn1.Asn1Object;
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
-import org.apache.directory.api.asn1.ber.Asn1Decoder;
 import org.apache.directory.api.asn1.ber.tlv.BerValue;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.codec.api.ControlDecorator;
@@ -47,9 +46,6 @@ public class ProxiedAuthzDecorator exten
     /** A temporary storage for the authzId */
     private byte[] authzIdBytes = null;
 
-    /** An instance of this decoder */
-    private static final Asn1Decoder decoder = new Asn1Decoder();
-
 
     /**
      * Creates a new instance of ProxiedAuthzDecoder wrapping a newly created

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeDecorator.java Sun May 17 06:22:07 2015
@@ -58,7 +58,7 @@ public class EntryChangeDecorator extend
     private int eccSeqLength;
 
     /** An instance of this decoder */
-    private static final Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
 
     /**
@@ -265,7 +265,7 @@ public class EntryChangeDecorator extend
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         EntryChangeContainer container = new EntryChangeContainer( getCodecService(), this );
-        decoder.decode( bb, container );
+        DECODER.decode( bb, container );
         return this;
     }
 }

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsDecorator.java Sun May 17 06:22:07 2015
@@ -49,7 +49,7 @@ public class PagedResultsDecorator exten
     private int pscSeqLength;
 
     /** An instance of this decoder */
-    private static final Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
 
     /**
@@ -303,7 +303,7 @@ public class PagedResultsDecorator exten
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         PagedResultsContainer container = new PagedResultsContainer( getCodecService(), this );
-        decoder.decode( bb, container );
+        DECODER.decode( bb, container );
         return this;
     }
 }

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchDecorator.java Sun May 17 06:22:07 2015
@@ -48,7 +48,7 @@ public class PersistentSearchDecorator e
     private int psearchSeqLength;
 
     /** An instance of this decoder */
-    private static final Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
 
     /**
@@ -219,7 +219,7 @@ public class PersistentSearchDecorator e
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         PersistentSearchContainer container = new PersistentSearchContainer( getCodecService(), this );
-        decoder.decode( bb, container );
+        DECODER.decode( bb, container );
         return this;
     }
 }

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesDecorator.java Sun May 17 06:22:07 2015
@@ -43,7 +43,7 @@ import org.apache.directory.api.ldap.mod
 public class SubentriesDecorator extends ControlDecorator<Subentries> implements Subentries
 {
     /** The sub entry decoder */
-    private static final Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
 
     /**
@@ -143,7 +143,7 @@ public class SubentriesDecorator extends
     {
         ByteBuffer bb = ByteBuffer.wrap( controlBytes );
         SubentriesContainer container = new SubentriesContainer( this );
-        decoder.decode( bb, container );
+        DECODER.decode( bb, container );
 
         return this;
     }

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestDecorator.java Sun May 17 06:22:07 2015
@@ -48,16 +48,17 @@ import org.apache.directory.api.util.Str
  */
 public class SortRequestDecorator extends ControlDecorator<SortRequest> implements SortRequest
 {
-    private Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
     private int sortReqLen = 0;
 
     private List<Integer> sortKeyLenList = new ArrayList<Integer>();
 
     public static int ORDERING_RULE_TAG = 0x80;
-    
+
     public static int REVERSE_ORDER_TAG = 0x81;
 
+
     /**
      * Creates a new instance of SortRequestDecorator.
      *
@@ -148,7 +149,7 @@ public class SortRequestDecorator extend
             String mrId = sk.getMatchingRuleId();
             if ( mrId != null )
             {
-                buffer.put( (byte)ORDERING_RULE_TAG );
+                buffer.put( ( byte ) ORDERING_RULE_TAG );
                 byte[] value = Asn1StringUtils.getBytesUtf8( mrId );
 
                 buffer.put( TLV.getBytes( value.length ) );
@@ -157,8 +158,8 @@ public class SortRequestDecorator extend
 
             if ( sk.isReverseOrder() )
             {
-                buffer.put( (byte)REVERSE_ORDER_TAG );
-                buffer.put( (byte)0x01 );
+                buffer.put( ( byte ) REVERSE_ORDER_TAG );
+                buffer.put( ( byte ) 0x01 );
                 buffer.put( BerValue.TRUE_VALUE );
             }
         }
@@ -172,7 +173,7 @@ public class SortRequestDecorator extend
     {
         ByteBuffer buffer = ByteBuffer.wrap( controlBytes );
         SortRequestContainer container = new SortRequestContainer( getCodecService(), this );
-        decoder.decode( buffer, container );
+        DECODER.decode( buffer, container );
         return this;
     }
 

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseDecorator.java Sun May 17 06:22:07 2015
@@ -45,7 +45,7 @@ import org.apache.directory.api.util.Str
  */
 public class SortResponseDecorator extends ControlDecorator<SortResponse> implements SortResponse
 {
-    private Asn1Decoder decoder = new Asn1Decoder();
+    private static final Asn1Decoder DECODER = new Asn1Decoder();
 
     private int sortRespLen = 0;
 
@@ -84,13 +84,13 @@ public class SortResponseDecorator exten
 
         // result code value
         sortRespLen += 1 + 1 + 1;
-        
-        if( getAttributeName() != null )
+
+        if ( getAttributeName() != null )
         {
             byte[] data = Strings.getBytesUtf8( getAttributeName() );
             sortRespLen += 1 + TLV.getNbBytes( data.length ) + data.length;
         }
-        
+
         valueLength = 1 + TLV.getNbBytes( sortRespLen ) + sortRespLen;
 
         return valueLength;
@@ -107,14 +107,14 @@ public class SortResponseDecorator exten
 
         buffer.put( UniversalTag.SEQUENCE.getValue() );
         buffer.put( TLV.getBytes( sortRespLen ) );
-        
+
         BerValue.encodeEnumerated( buffer, getSortResult().getVal() );
-        
-        if( getAttributeName() != null )
+
+        if ( getAttributeName() != null )
         {
             BerValue.encode( buffer, getAttributeName() );
         }
-        
+
         return buffer;
     }
 
@@ -127,7 +127,7 @@ public class SortResponseDecorator exten
     {
         ByteBuffer buffer = ByteBuffer.wrap( controlBytes );
         SortResponseContainer container = new SortResponseContainer( getCodecService(), this );
-        decoder.decode( buffer, container );
+        DECODER.decode( buffer, container );
         return this;
     }
 

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/AddResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/AddResponseDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/AddResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/AddResponseDecorator.java Sun May 17 06:22:07 2015
@@ -100,7 +100,7 @@ public class AddResponseDecorator extend
     public int computeLength()
     {
         AddResponse addResponse = getAddResponse();
-        setLdapResult( new LdapResultDecorator( addResponse.getLdapResult() ) );
+        setLdapResult( new LdapResultDecorator( getCodecService(), addResponse.getLdapResult() ) );
         int addResponseLength = ( ( LdapResultDecorator ) getLdapResult() ).computeLength();
 
         setAddResponseLength( addResponseLength );

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/BindRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/BindRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/BindRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/BindRequestDecorator.java Sun May 17 06:22:07 2015
@@ -342,7 +342,8 @@ public class BindRequestDecorator extend
      */
     public int computeLength()
     {
-        int bindRequestLength = 1 + 1 + 1; // Initialized with version
+        // Initialized with version
+        int bindRequestLength = 1 + 1 + 1;
 
         Dn dn = getDn();
 

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/LdapResultDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/LdapResultDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/LdapResultDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/LdapResultDecorator.java Sun May 17 06:22:07 2015
@@ -65,9 +65,10 @@ public class LdapResultDecorator impleme
      *
      * @param decoratedLdapResult the decorated LdapResult
      */
-    public LdapResultDecorator( LdapResult decoratedLdapResult )
+    public LdapResultDecorator( LdapApiService codec, LdapResult decoratedLdapResult )
     {
         this.decoratedLdapResult = decoratedLdapResult;
+        this.codec = codec;
     }
 
 

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ResponseDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/decorators/ResponseDecorator.java Sun May 17 06:22:07 2015
@@ -46,7 +46,7 @@ public abstract class ResponseDecorator<
     {
         super( codec, decoratedMessage );
 
-        ldapResultDecorator = new LdapResultDecorator( ( ( ResultResponse ) decoratedMessage ).getLdapResult() );
+        ldapResultDecorator = new LdapResultDecorator( codec, ( ( ResultResponse ) decoratedMessage ).getLdapResult() );
     }
 
 

Modified: directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/ACIItemParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/ACIItemParser.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/ACIItemParser.java (original)
+++ directory/shared/trunk/ldap/extras/aci/src/main/java/org/apache/directory/api/ldap/aci/ACIItemParser.java Sun May 17 06:22:07 2015
@@ -119,7 +119,8 @@ public class ACIItemParser
             return null;
         }
 
-        reset( spec ); // reset and initialize the parser / lexer pair
+        // reset and initialize the parser / lexer pair
+        reset( spec );
 
         try
         {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyDecorator.java Sun May 17 06:22:07 2015
@@ -82,7 +82,7 @@ public class PasswordPolicyDecorator ext
         {
             setResponse( null );
         }
-        else if ( value != null && !hasResponse() )
+        else if ( !hasResponse() )
         {
             setResponse( true );
         }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestDecorator.java Sun May 17 06:22:07 2015
@@ -139,14 +139,14 @@ public class VirtualListViewRequestDecor
             if ( value != null )
             {
                 buffer.put( TLV.getBytes( value.length ) );
+
+                // The by assertionValue value
+                buffer.put( value );
             }
             else
             {
                 buffer.put( TLV.getBytes( 0 ) );
             }
-
-            // The by assertionValue value
-            buffer.put( value );
         }
 
         if ( getContextId() != null )

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelRequestDecorator.java Sun May 17 06:22:07 2015
@@ -118,19 +118,20 @@ public class CancelRequestDecorator exte
 
         try
         {
-            CancelRequest cancel = decoder.decode( requestValue );
-
             if ( requestValue != null )
             {
+                CancelRequest cancel = decoder.decode( requestValue );
+                cancelRequest.setCancelId( cancel.getCancelId() );
+
                 this.requestValue = new byte[requestValue.length];
                 System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
             else
             {
                 this.requestValue = null;
+                cancelRequest.setCancelId( 0 );
             }
 
-            cancelRequest.setCancelId( cancel.getCancelId() );
         }
         catch ( DecoderException e )
         {
@@ -147,7 +148,7 @@ public class CancelRequestDecorator exte
      *   | 
      *   +--> 0x02 0x0(1-4) [0..2^31-1] 
      */
-    /* no qualifier */ int computeLengthInternal()
+    /* no qualifier */int computeLengthInternal()
     {
         // The messageId length
         cancelSequenceLength = 1 + 1 + BerValue.getNbBytes( cancelRequest.getCancelId() );
@@ -163,7 +164,7 @@ public class CancelRequestDecorator exte
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/certGeneration/CertGenerationRequestDecorator.java Sun May 17 06:22:07 2015
@@ -52,6 +52,7 @@ public class CertGenerationRequestDecora
     /** stores the length of the request*/
     private int requestLength = 0;
 
+
     public CertGenerationRequestDecorator( LdapApiService codec, CertGenerationRequest decoratedMessage )
     {
         super( codec, decoratedMessage );
@@ -114,13 +115,9 @@ public class CertGenerationRequestDecora
             }
         }
 
-        if ( requestValue == null )
-        {
-            return null;
-        }
-
         final byte[] copy = new byte[requestValue.length];
         System.arraycopy( requestValue, 0, copy, 0, requestValue.length );
+
         return copy;
     }
 
@@ -219,7 +216,7 @@ public class CertGenerationRequestDecora
      *   +--> 0x04 LL key algorithm
      * </pre>
      */
-    /* no qualifier */ int computeLengthInternal()
+    /* no qualifier */int computeLengthInternal()
     {
         int len = Strings.getBytesUtf8( certGenerationRequest.getTargetDN() ).length;
         requestLength = 1 + TLV.getNbBytes( len ) + len;
@@ -243,7 +240,7 @@ public class CertGenerationRequestDecora
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/gracefulShutdown/GracefulShutdownRequestDecorator.java Sun May 17 06:22:07 2015
@@ -51,6 +51,7 @@ public class GracefulShutdownRequestDeco
 
     private GracefulShutdownRequest gracefulShutdownRequest;
 
+
     /**
      * Creates a new instance of GracefulShutdownRequestDecorator.
      *
@@ -73,10 +74,10 @@ public class GracefulShutdownRequestDeco
 
         try
         {
-            gracefulShutdownRequest = decoder.decode( requestValue );
-
             if ( requestValue != null )
             {
+                gracefulShutdownRequest = decoder.decode( requestValue );
+
                 this.requestValue = new byte[requestValue.length];
                 System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
@@ -162,7 +163,7 @@ public class GracefulShutdownRequestDeco
      * </pre>  
      * L1 will always be &lt 11.
      */
-    /* no qualifier */ int computeLengthInternal()
+    /* no qualifier */int computeLengthInternal()
     {
         int gracefulLength = 1 + 1;
         gracefulSequenceLength = 0;
@@ -187,7 +188,7 @@ public class GracefulShutdownRequestDeco
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyRequestDecorator.java Sun May 17 06:22:07 2015
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PasswordModifyRequestDecorator extends ExtendedRequestDecorator<PasswordModifyRequest> 
+public class PasswordModifyRequestDecorator extends ExtendedRequestDecorator<PasswordModifyRequest>
     implements PasswordModifyRequest
 {
     private static final Logger LOG = LoggerFactory.getLogger( PasswordModifyRequestDecorator.class );
@@ -74,10 +74,10 @@ public class PasswordModifyRequestDecora
 
         try
         {
-            passwordModifyRequest = decoder.decode( requestValue );
-            
             if ( requestValue != null )
             {
+                passwordModifyRequest = decoder.decode( requestValue );
+
                 this.requestValue = new byte[requestValue.length];
                 System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
@@ -191,7 +191,7 @@ public class PasswordModifyRequestDecora
      *  [+-- 0x82 L4 newPassword] 
      * </pre>
      */
-    /* No qualifier */ int computeLengthInternal()
+    /* No qualifier */int computeLengthInternal()
     {
         requestLength = 0;
 
@@ -223,7 +223,7 @@ public class PasswordModifyRequestDecora
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* No qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* No qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/pwdModify/PasswordModifyResponseDecorator.java Sun May 17 06:22:07 2015
@@ -68,10 +68,10 @@ public class PasswordModifyResponseDecor
 
         try
         {
-            passwordModifyResponse = decoder.decode( responseValue );
-
             if ( responseValue != null )
             {
+                passwordModifyResponse = decoder.decode( responseValue );
+
                 this.responseValue = new byte[responseValue.length];
                 System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
             }
@@ -99,11 +99,6 @@ public class PasswordModifyResponseDecor
             try
             {
                 responseValue = encodeInternal().array();
-
-                if ( responseValue == null )
-                {
-                    return null;
-                }
             }
             catch ( EncoderException e )
             {
@@ -152,7 +147,7 @@ public class PasswordModifyResponseDecor
      *  [+-- 0x80 L2 genPassword] 
      * </pre>
      */
-    /* no qualifier */ int computeLengthInternal()
+    /* no qualifier */int computeLengthInternal()
     {
         requestLength = 0;
 
@@ -172,11 +167,11 @@ public class PasswordModifyResponseDecor
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         // Allocate the bytes buffer.
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
-        
+
         bb.put( UniversalTag.SEQUENCE.getValue() );
         bb.put( TLV.getBytes( requestLength ) );
 

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/whoAmI/WhoAmIResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/whoAmI/WhoAmIResponseDecorator.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/whoAmI/WhoAmIResponseDecorator.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/whoAmI/WhoAmIResponseDecorator.java Sun May 17 06:22:07 2015
@@ -48,6 +48,7 @@ public class WhoAmIResponseDecorator ext
 
     private WhoAmIResponse whoAmIResponse;
 
+
     public WhoAmIResponseDecorator( LdapApiService codec, WhoAmIResponse decoratedMessage )
     {
         super( codec, decoratedMessage );
@@ -65,17 +66,13 @@ public class WhoAmIResponseDecorator ext
 
         try
         {
-            whoAmIResponse = decoder.decode( responseValue );
-
             if ( responseValue != null )
             {
+                whoAmIResponse = decoder.decode( responseValue );
+
                 this.responseValue = new byte[responseValue.length];
                 System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
             }
-            else
-            {
-                this.responseValue = null;
-            }
         }
         catch ( DecoderException e )
         {
@@ -96,11 +93,6 @@ public class WhoAmIResponseDecorator ext
             try
             {
                 responseValue = encodeInternal().array();
-
-                if ( responseValue == null )
-                {
-                    return null;
-                }
             }
             catch ( EncoderException e )
             {
@@ -134,18 +126,18 @@ public class WhoAmIResponseDecorator ext
     /**
      * Set the userId
      */
-    /* no qualifier*/ void setUserId( String userId )
+    /* no qualifier*/void setUserId( String userId )
     {
-        ((WhoAmIResponseImpl)whoAmIResponse).setUserId( userId );
+        ( ( WhoAmIResponseImpl ) whoAmIResponse ).setUserId( userId );
     }
 
 
     /**
      * Set the DnId
      */
-    /* no qualifier*/ void setDn( Dn dn )
+    /* no qualifier*/void setDn( Dn dn )
     {
-        ((WhoAmIResponseImpl)whoAmIResponse).setDn( dn );
+        ( ( WhoAmIResponseImpl ) whoAmIResponse ).setDn( dn );
     }
 
 
@@ -210,11 +202,11 @@ public class WhoAmIResponseDecorator ext
      * 0x04 L1 authzId
      * </pre>
      */
-    /* no qualifier */ int computeLengthInternal()
+    /* no qualifier */int computeLengthInternal()
     {
         if ( whoAmIResponse.getAuthzId() != null )
         {
-            return 1 + TLV.getNbBytes( whoAmIResponse.getAuthzId().length ) + 
+            return 1 + TLV.getNbBytes( whoAmIResponse.getAuthzId().length ) +
                 whoAmIResponse.getAuthzId().length;
         }
         else
@@ -230,12 +222,12 @@ public class WhoAmIResponseDecorator ext
      * @return A ByteBuffer that contains the encoded PDU
      * @throws org.apache.directory.api.asn1.EncoderException If anything goes wrong.
      */
-    /* no qualifier */ ByteBuffer encodeInternal() throws EncoderException
+    /* no qualifier */ByteBuffer encodeInternal() throws EncoderException
     {
         ByteBuffer bb = ByteBuffer.allocate( computeLengthInternal() );
 
         BerValue.encode( bb, whoAmIResponse.getAuthzId() );
-    
+
         return bb;
     }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultAttribute.java Sun May 17 06:22:07 2015
@@ -1151,13 +1151,6 @@ public class DefaultAttribute implements
 
                     Value<byte[]> value = createBinaryValue( attributeType, valBytes );
 
-                    if ( value == null )
-                    {
-                        // The value can't be normalized or is invalid : we don't add it.
-                        LOG.error( I18n.err( I18n.ERR_04449, val ) );
-                        continue;
-                    }
-
                     // Now call the add(Value) method
                     if ( add( value ) == 1 )
                     {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java Sun May 17 06:22:07 2015
@@ -388,19 +388,22 @@ public final class DefaultEntry implemen
         }
 
         LdifAttributesReader reader = null;
-        
+
         try
-        { 
+        {
             reader = new LdifAttributesReader();
             Entry entry = reader.parseEntry( schemaManager, sb.toString() );
-    
+
             return entry;
         }
         finally
         {
             try
             {
-                reader.close();
+                if ( reader != null )
+                {
+                    reader.close();
+                }
             }
             catch ( IOException e )
             {
@@ -641,7 +644,7 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -673,7 +676,7 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -705,7 +708,7 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -740,7 +743,7 @@ public final class DefaultEntry implemen
             // and the upId
             createAttribute( id, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -772,7 +775,7 @@ public final class DefaultEntry implemen
         {
             createAttribute( id, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -806,7 +809,7 @@ public final class DefaultEntry implemen
             // and the upId
             createAttribute( id, attributeType, values );
         }
-        
+
         return this;
     }
 
@@ -865,7 +868,7 @@ public final class DefaultEntry implemen
                 }
             }
         }
-        
+
         return this;
     }
 
@@ -909,7 +912,7 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
-        
+
         return this;
     }
 
@@ -953,7 +956,7 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
-        
+
         return this;
     }
 
@@ -997,7 +1000,7 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
-        
+
         return this;
     }
 
@@ -1048,12 +1051,6 @@ public final class DefaultEntry implemen
             // First, clone the structure
             DefaultEntry clone = ( DefaultEntry ) super.clone();
 
-            // Just in case ... Should *never* happen
-            if ( clone == null )
-            {
-                return null;
-            }
-
             // An Entry has a Dn and many attributes.
             clone.dn = dn; // note that Dn is immutable now
 
@@ -2630,7 +2627,7 @@ public final class DefaultEntry implemen
         }
 
         sb.append( '\n' );
-        
+
         if ( attributes.size() != 0 )
         {
             for ( Attribute attribute : attributes.values() )

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterEncoder.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterEncoder.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterEncoder.java Sun May 17 06:22:07 2015
@@ -244,23 +244,6 @@ public class FilterEncoder
             sb.append( "\\5C" );
         }
 
-        return ( sb == null ? value : sb.toString() );
-    }
-
-
-    private static void handleEscaped( boolean escaped, boolean hexPair, char hex, StringBuilder sb )
-    {
-        if ( escaped )
-        {
-            sb.append( "\\5C" );
-
-            if ( hexPair )
-            {
-                sb.append( hex );
-                hexPair = false;
-            }
-
-            escaped = false;
-        }
+        return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/FilterParser.java Sun May 17 06:22:07 2015
@@ -107,7 +107,7 @@ public class FilterParser
                     pos.start++;
 
                     // Get the assertionValue
-                    node.setValue( parseAssertionValue( schemaManager, attribute, filter, pos ) );
+                    node.setValue( parseAssertionValue( schemaManager, filter, pos ) );
 
                     return node;
                 }
@@ -122,7 +122,7 @@ public class FilterParser
                         pos.start += 2;
 
                         // Get the assertionValue
-                        node.setValue( parseAssertionValue( schemaManager, attribute, filter, pos ) );
+                        node.setValue( parseAssertionValue( schemaManager, filter, pos ) );
 
                         return node;
                     }
@@ -333,6 +333,102 @@ public class FilterParser
         }
     }
 
+
+    /**
+     * An assertion value :
+     * assertionvalue = valueencoding
+     * valueencoding  = 0*(normal / escaped)
+     * normal         = UTF1SUBSET / UTFMB
+     * escaped        = '\' HEX HEX
+     * HEX            = '0'-'9' / 'A'-'F' / 'a'-'f'
+     * UTF1SUBSET     = %x01-27 / %x2B-5B / %x5D-7F (Everything but '\0', '*', '(', ')' and '\')
+     * UTFMB          = UTF2 / UTF3 / UTF4
+     * UTF0           = %x80-BF
+     * UTF2           = %xC2-DF UTF0
+     * UTF3           = %xE0 %xA0-BF UTF0 / %xE1-EC UTF0 UTF0 / %xED %x80-9F UTF0 / %xEE-EF UTF0 UTF0
+     * UTF4           = %xF0 %x90-BF UTF0 UTF0 / %xF1-F3 UTF0 UTF0 UTF0 / %xF4 %x80-8F UTF0 UTF0
+     *
+     * With the specific constraints (RFC 4515):
+     *    "The <valueencoding> rule ensures that the entire filter string is a"
+     *    "valid UTF-8 string and provides that the octets that represent the"
+     *    "ASCII characters "*" (ASCII 0x2a), "(" (ASCII 0x28), ")" (ASCII"
+     *    "0x29), "\" (ASCII 0x5c), and NUL (ASCII 0x00) are represented as a"
+     *    "backslash "\" (ASCII 0x5c) followed by the two hexadecimal digits"
+     *    "representing the value of the encoded octet."
+     *
+     * The incoming String is already transformed from UTF-8 to unicode, so we must assume that the
+     * grammar we have to check is the following :
+     *
+     * assertionvalue = valueencoding
+     * valueencoding  = 0*(normal / escaped)
+     * normal         = unicodeSubset
+     * escaped        = '\' HEX HEX
+     * HEX            = '0'-'9' / 'A'-'F' / 'a'-'f'
+     * unicodeSubset     = %x01-27 / %x2B-5B / %x5D-FFFF
+     */
+    private static Value<?> parseAssertionValue( SchemaManager schemaManager, byte[] filter, Position pos )
+        throws ParseException
+    {
+        byte b = Strings.byteAt( filter, pos.start );
+
+        // Create a buffer big enough to contain the value once converted
+        byte[] value = new byte[filter.length - pos.start];
+        int current = 0;
+
+        do
+        {
+            if ( Unicode.isUnicodeSubset( b ) )
+            {
+                value[current++] = b;
+                pos.start++;
+            }
+            else if ( Strings.isCharASCII( filter, pos.start, '\\' ) )
+            {
+                // Maybe an escaped
+                pos.start++;
+
+                // First hex
+                if ( Chars.isHex( filter, pos.start ) )
+                {
+                    pos.start++;
+                }
+                else
+                {
+                    throw new ParseException( I18n.err( I18n.ERR_04149 ), pos.start );
+                }
+
+                // second hex
+                if ( Chars.isHex( filter, pos.start ) )
+                {
+                    value[current++] = Hex.getHexValue( filter[pos.start - 1], filter[pos.start] );
+                    pos.start++;
+                }
+                else
+                {
+                    throw new ParseException( I18n.err( I18n.ERR_04149 ), pos.start );
+                }
+            }
+            else
+            {
+                // not a valid char, so let's get out
+                break;
+            }
+        }
+        while ( ( b = Strings.byteAt( filter, pos.start ) ) != '\0' );
+
+        if ( current != 0 )
+        {
+            byte[] result = new byte[current];
+            System.arraycopy( value, 0, result, 0, current );
+
+            return new BinaryValue( result );
+        }
+        else
+        {
+            return new BinaryValue( null );
+        }
+    }
+
 
     /**
      * Parse a substring

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/NotNode.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/NotNode.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/NotNode.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/filter/NotNode.java Sun May 17 06:22:07 2015
@@ -83,7 +83,7 @@ public class NotNode extends BranchNode
      */
     public void addNode( ExprNode node )
     {
-        if ( ( children != null ) && ( children.size() >= 1 ) )
+        if ( ( children == null ) || ( children.size() >= 1 ) )
         {
             throw new IllegalStateException( I18n.err( I18n.ERR_04159 ) );
         }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/ldif/LdifReader.java Sun May 17 06:22:07 2015
@@ -1835,8 +1835,7 @@ public class LdifReader implements Itera
 
             if ( LOG.isDebugEnabled() )
             {
-                LOG.debug( "Parsed {} entries.", ( entries == null ? Integer.valueOf( 0 ) : Integer.valueOf( entries
-                    .size() ) ) );
+                LOG.debug( "Parsed {} entries.", Integer.valueOf( entries.size() ) );
             }
 
             return entries;

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Ava.java Sun May 17 06:22:07 2015
@@ -866,21 +866,12 @@ public class Ava implements Externalizab
         {
             pos = ( ( StringValue ) upValue ).serialize( buffer, pos );
         }
-        else
-        {
-            //pos = ( ( BinaryValue ) upValue ).serialize( buffer, pos );
-
-        }
 
         // Write the normValue
         if ( normValue.isHumanReadable() )
         {
             pos = ( ( StringValue ) normValue ).serialize( buffer, pos );
         }
-        else
-        {
-            //pos = ( ( BinaryValue ) normValue ).serialize( buffer, pos );
-        }
 
         // Write the hash code
         pos = Serialize.serialize( h, buffer, pos );
@@ -965,10 +956,6 @@ public class Ava implements Externalizab
             normValue = new StringValue( attributeType );
             pos = ( ( StringValue ) normValue ).deserialize( buffer, pos );
         }
-        else
-        {
-            // TODO
-        }
 
         // Read the hashCode
         h = Serialize.deserializeInt( buffer, pos );

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/name/Rdn.java Sun May 17 06:22:07 2015
@@ -1275,7 +1275,7 @@ public class Rdn implements Cloneable, E
                                 }
 
                             default:
-                                if ( ( chars[i] >= 0 ) && ( chars[i] < 128 ) )
+                                if ( chars[i] < 128 )
                                 {
                                     bytes[pos++] = ( byte ) chars[i];
                                 }
@@ -1458,11 +1458,11 @@ public class Rdn implements Cloneable, E
     public static boolean isValid( String dn )
     {
         Rdn rdn = new Rdn();
-        
+
         try
         {
             parse( dn, rdn );
-            
+
             return true;
         }
         catch ( LdapInvalidDnException e )

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/PasswordUtil.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/PasswordUtil.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/PasswordUtil.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/password/PasswordUtil.java Sun May 17 06:22:07 2015
@@ -66,6 +66,7 @@ public class PasswordUtil
     /** The PKCS5S2 hash length */
     public static final int PKCS5S2_LENGTH = 32;
 
+
     /**
      * Get the algorithm from the stored password. 
      * It can be found on the beginning of the stored password, between 
@@ -157,7 +158,7 @@ public class PasswordUtil
                 salt = new byte[16]; // we use 16 byte salt for PKCS5S2
                 new SecureRandom().nextBytes( salt );
                 break;
-                
+
             case HASH_METHOD_CRYPT:
                 salt = new byte[2];
                 SecureRandom sr = new SecureRandom();
@@ -175,38 +176,31 @@ public class PasswordUtil
         byte[] hashedPassword = encryptPassword( credentials, algorithm, salt );
         StringBuffer sb = new StringBuffer();
 
-        if ( algorithm != null )
+        sb.append( '{' ).append( algorithm.getPrefix().toUpperCase() ).append( '}' );
+
+        if ( algorithm == LdapSecurityConstants.HASH_METHOD_CRYPT )
+        {
+            sb.append( Strings.utf8ToString( salt ) );
+            sb.append( Strings.utf8ToString( hashedPassword ) );
+        }
+        else if ( salt != null )
         {
-            sb.append( '{' ).append( algorithm.getPrefix().toUpperCase() ).append( '}' );
+            byte[] hashedPasswordWithSaltBytes = new byte[hashedPassword.length + salt.length];
 
-            if ( algorithm == LdapSecurityConstants.HASH_METHOD_CRYPT )
+            if ( algorithm == LdapSecurityConstants.HASH_METHOD_PKCS5S2 )
             {
-                sb.append( Strings.utf8ToString( salt ) );
-                sb.append( Strings.utf8ToString( hashedPassword ) );
-            }
-            else if ( salt != null )
-            {
-                byte[] hashedPasswordWithSaltBytes = new byte[hashedPassword.length + salt.length];
-
-                if ( algorithm == LdapSecurityConstants.HASH_METHOD_PKCS5S2 )
-                {
-                    merge( hashedPasswordWithSaltBytes, salt, hashedPassword );
-                }
-                else
-                {
-                    merge( hashedPasswordWithSaltBytes, hashedPassword, salt );
-                }
-                
-                sb.append( String.valueOf( Base64.encode( hashedPasswordWithSaltBytes ) ) );
+                merge( hashedPasswordWithSaltBytes, salt, hashedPassword );
             }
             else
             {
-                sb.append( String.valueOf( Base64.encode( hashedPassword ) ) );
+                merge( hashedPasswordWithSaltBytes, hashedPassword, salt );
             }
+
+            sb.append( String.valueOf( Base64.encode( hashedPasswordWithSaltBytes ) ) );
         }
         else
         {
-            sb.append( Strings.utf8ToString( hashedPassword ) );
+            sb.append( String.valueOf( Base64.encode( hashedPassword ) ) );
         }
 
         return Strings.getBytesUtf8( sb.toString() );
@@ -330,7 +324,7 @@ public class PasswordUtil
 
             case HASH_METHOD_PKCS5S2:
                 return generatePbkdf2Hash( credentials, algorithm, salt );
-                
+
             default:
                 return credentials;
         }
@@ -445,7 +439,7 @@ public class PasswordUtil
 
             case HASH_METHOD_PKCS5S2:
                 return getPbkdf2Credentials( credentials, algoLength, encryptionMethod );
-                
+
             case HASH_METHOD_CRYPT:
                 // The password is associated with a salt. Decompose it
                 // in two parts, storing the salt into the EncryptionMethod structure.
@@ -534,8 +528,8 @@ public class PasswordUtil
 
         return expired;
     }
-    
-    
+
+
     /**
      * generates a hash based on the <a href="http://en.wikipedia.org/wiki/PBKDF2">PKCS5S2 spec</a>
      * 
@@ -556,13 +550,13 @@ public class PasswordUtil
             Key key = sk.generateSecret( keySpec );
             return key.getEncoded();
         }
-        catch( Exception e )
+        catch ( Exception e )
         {
             throw new RuntimeException( e );
         }
     }
 
-    
+
     /**
      * Gets the credentials from a PKCS5S2 hash.
      * The salt for PKCS5S2 hash is prepended to the password
@@ -581,7 +575,7 @@ public class PasswordUtil
             int saltLength = passwordAndSalt.length - PKCS5S2_LENGTH;
             encryptionMethod.setSalt( new byte[saltLength] );
             byte[] password = new byte[PKCS5S2_LENGTH];
-            
+
             split( passwordAndSalt, 0, encryptionMethod.getSalt(), password );
 
             return password;
@@ -592,5 +586,5 @@ public class PasswordUtil
             return credentials;
         }
     }
-    
+
 }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java?rev=1679817&r1=1679816&r2=1679817&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AttributeType.java Sun May 17 06:22:07 2015
@@ -20,8 +20,6 @@
 package org.apache.directory.api.ldap.model.schema;
 
 
-
-
 /**
  * An attributeType specification. attributeType specifications describe the
  * nature of attributes within the directory. The attributeType specification's



Mime
View raw message