directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1039813 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec: apRep/actions/ apReq/actions/ authenticator/actions/ kdcReq/actions/ krbCred/actions/ krbError/actions/ krbPriv/actions/ krbSaf...
Date Sun, 28 Nov 2010 02:30:49 GMT
Author: elecharny
Date: Sun Nov 28 02:30:49 2010
New Revision: 1039813

URL: http://svn.apache.org/viewvc?rev=1039813&view=rev
Log:
Used the AbstractReadPvno all over the codec

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreAuthenticatorVno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/StorePvno.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/StorePvno.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apRep/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -21,19 +21,8 @@ package org.apache.directory.shared.kerb
 
 
 import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
-import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPvno;
 import org.apache.directory.shared.kerberos.codec.apRep.ApRepContainer;
-import org.apache.directory.shared.kerberos.messages.ApRep;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -41,15 +30,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StorePvno extends GrammarAction
+public class StorePvno extends AbstractReadPvno
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( KerberosMessageGrammar.class
);
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StorePvno action.
      */
@@ -62,43 +44,10 @@ public class StorePvno extends GrammarAc
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setPvno( int pvno, Asn1Container container )
     {
         ApRepContainer apRepContainer = ( ApRepContainer ) container;
-
-        TLV tlv = apRepContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // The value should be an integer an equal to 5
-        Value value = tlv.getValue();
-        ApRep apRep = apRepContainer.getApRep();
-
-        try
-        {
-            int pvno = IntegerDecoder.parse( value, 5, 5 );
-
-            apRep.setProtocolVersionNumber( pvno );
-
-            if ( IS_DEBUG )
-            {
-                LOG.debug( "Pvno : " + pvno );
-            }
-        }
-        catch ( IntegerDecoderException ide )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ),
ide
-                .getLocalizedMessage() ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( ide.getMessage() );
-        }
+        apRepContainer.getApRep().setProtocolVersionNumber( pvno );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/apReq/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -21,19 +21,8 @@ package org.apache.directory.shared.kerb
 
 
 import org.apache.directory.shared.asn1.ber.Asn1Container;
-import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
-import org.apache.directory.shared.asn1.ber.tlv.TLV;
-import org.apache.directory.shared.asn1.ber.tlv.Value;
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.asn1.util.IntegerDecoder;
-import org.apache.directory.shared.asn1.util.IntegerDecoderException;
-import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.kerberos.codec.KerberosMessageGrammar;
+import org.apache.directory.shared.kerberos.codec.actions.AbstractReadPvno;
 import org.apache.directory.shared.kerberos.codec.apReq.ApReqContainer;
-import org.apache.directory.shared.kerberos.messages.ApReq;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -41,15 +30,8 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StorePvno extends GrammarAction
+public class StorePvno extends AbstractReadPvno
 {
-    /** The logger */
-    private static final Logger LOG = LoggerFactory.getLogger( KerberosMessageGrammar.class
);
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
-
     /**
      * Instantiates a new StorePvno action.
      */
@@ -62,43 +44,10 @@ public class StorePvno extends GrammarAc
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    protected void setPvno( int pvno, Asn1Container container )
     {
         ApReqContainer apReqContainer = ( ApReqContainer ) container;
-
-        TLV tlv = apReqContainer.getCurrentTLV();
-
-        // The Length should not be null
-        if ( tlv.getLength() == 0 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        // The value should be an integer an equal to 5
-        Value value = tlv.getValue();
-        ApReq apReq = apReqContainer.getApReq();
-
-        try
-        {
-            int pvno = IntegerDecoder.parse( value, 5, 5 );
-
-            apReq.setProtocolVersionNumber( pvno );
-
-            if ( IS_DEBUG )
-            {
-                LOG.debug( "Pvno : " + pvno );
-            }
-        }
-        catch ( IntegerDecoderException ide )
-        {
-            LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData() ),
ide
-                .getLocalizedMessage() ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( ide.getMessage() );
-        }
+        apReqContainer.getApReq().setProtocolVersionNumber( pvno );
     }
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreAuthenticatorVno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreAuthenticatorVno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreAuthenticatorVno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/authenticator/actions/StoreAuthenticatorVno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StoreAuthenticatorVno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StoreAuthenticatorVno action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePvno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StorePvno action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbCred/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePvno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StorePvno action.
      */
@@ -51,5 +50,4 @@ public class StorePvno extends AbstractR
         KrbCredContainer krbCredContainer = ( KrbCredContainer ) container;
         krbCredContainer.getKrbCred().setProtocolVersionNumber( pvno );
     }
-
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbError/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePvno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StorePvno action.
      */
@@ -51,5 +50,4 @@ public class StorePvno extends AbstractR
         KrbErrorContainer krbErrorContainer = ( KrbErrorContainer ) container;
         krbErrorContainer.getKrbError().setProtocolVersionNumber( pvno );
     }
-
 }

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbPriv/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePvno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StorePvno action.
      */

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/StorePvno.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/StorePvno.java?rev=1039813&r1=1039812&r2=1039813&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/StorePvno.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/krbSafe/actions/StorePvno.java
Sun Nov 28 02:30:49 2010
@@ -32,7 +32,6 @@ import org.apache.directory.shared.kerbe
  */
 public class StorePvno extends AbstractReadPvno
 {
-
     /**
      * Instantiates a new StorePvno action.
      */
@@ -51,5 +50,4 @@ public class StorePvno extends AbstractR
         KrbSafeContainer krbSafeContainer = ( KrbSafeContainer ) container;
         krbSafeContainer.getKrbSafe().setProtocolVersionNumber( pvno );
     }
-
 }



Mime
View raw message