You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/09/03 16:32:20 UTC

svn commit: r267462 - /directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java

Author: elecharny
Date: Sat Sep  3 07:32:14 2005
New Revision: 267462

URL: http://svn.apache.org/viewcvs?rev=267462&view=rev
Log:
- Added Javadoco
- Added logs
- Deprecated setDecodeMonitor

Modified:
    directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java

Modified: directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java?rev=267462&r1=267461&r2=267462&view=diff
==============================================================================
--- directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java (original)
+++ directory/shared/ldap/branches/new-codec-integration/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixDecoder.java Sat Sep  3 07:32:14 2005
@@ -45,7 +45,11 @@
     }
 
     /**
+     * Decodes a PDU
      * 
+     * @param encoded The PDU containing the LdapMessage to decode
+     * 
+     * @throws DecoderException If anything went wrong
      */
     public void decode( Object encoded ) throws DecoderException
     {
@@ -92,6 +96,11 @@
        	
        	if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
        	{
+       		if ( log.isDebugEnabled() )
+       		{
+       			log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage() );
+       		}
+       		
        		decoderCallback.decodeOccurred( null, ldapMessageContainer.getLdapMessage() );
        		ldapMessageContainer.clean();
        	}
@@ -101,8 +110,8 @@
      * Feeds the bytes within the input stream to the digester to generate the
      * resultant decoded Message.
      *
-     * @param in
-     * @throws ProviderException
+     * @param in The InputStream containing the PDU to be decoded
+     * @throws ProviderException If the decoding went wrong
      */
     private void digest( InputStream in )
             throws ProviderException
@@ -127,6 +136,7 @@
         }
         catch( Exception e )
         {
+        	log.error( "Twix decoder failure : " + e.getMessage() );
             ProviderException pe =  new ProviderException( provider,
                 "Twix decoder failure!" ) ;
             pe.addThrowable( e ) ;
@@ -138,8 +148,8 @@
      * Decodes a PDU from an input stream into a Snickers compiler generated
      * stub envelope.
      *
-     * @param lock lock object used to exclusively read from the input stream
-     * @param in the input stream to read and decode PDU bytes from
+     * @param lock Lock object used to exclusively read from the input stream
+     * @param in The input stream to read and decode PDU bytes from
      * @return return decoded stub
      */
     public Object decode( Object lock, InputStream in ) throws ProviderException
@@ -150,10 +160,16 @@
         	
            	if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
            	{
+           		if ( log.isDebugEnabled() )
+           		{
+           			log.debug("Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage() );
+           		}
+           		
            		return ldapMessageContainer.getLdapMessage();
            	}
            	else
            	{
+           		log.error( "Twix decoder failure, PDU does not contain enough data");
     			ProviderException pe =  new ProviderException( provider, "Twix decoder failure!" ) ;
     			pe.addThrowable( new DecoderException( "The input stream does not contain a full PDU" ) ) ;
     			throw pe ;
@@ -174,6 +190,7 @@
 			}
 	        catch( Exception e )
 	        {
+	        	log.error( "Twix decoder failure : " + e.getMessage() );
 				ProviderException pe =  new ProviderException( provider,
 	                "Twix decoder failure!" ) ;
 	            pe.addThrowable( e ) ;
@@ -182,10 +199,16 @@
 	
            	if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
            	{
+           		if ( log.isDebugEnabled() )
+           		{
+           			log.debug( "Decoded LdapMessage : " + ldapMessageContainer.getLdapMessage() );
+           		}
+           		
            		return ldapMessageContainer.getLdapMessage();
            	}
            	else
            	{
+           		log.error( "Twix decoder failure : The input stream does not contain a full PDU" );
 				ProviderException pe =  new ProviderException( provider, "Twix decoder failure!" ) ;
 				pe.addThrowable( new DecoderException( "The input stream does not contain a full PDU" ) ) ;
 				throw pe ;
@@ -204,14 +227,18 @@
     }
 
     /**
+     * Not used ...
      * 
+     * @deprecated
      */
     public void setDecoderMonitor( DecoderMonitor monitor )
     {
     }
 
     /**
+     * Set the callback to call when the PDU has been decoded
      * 
+     *  @param cb The callback
      */
     public void setCallback( DecoderCallback cb )
     {