directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1036374 - /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java
Date Thu, 18 Nov 2010 09:47:23 GMT
Author: kayyagari
Date: Thu Nov 18 09:47:23 2010
New Revision: 1036374

URL: http://svn.apache.org/viewvc?rev=1036374&view=rev
Log:
o now extends AbstractReadPvno

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/codec/kdcReq/actions/StorePvno.java

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=1036374&r1=1036373&r2=1036374&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
Thu Nov 18 09:47:23 2010
@@ -21,18 +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.actions.AbstractReadPvno;
 import org.apache.directory.shared.kerberos.codec.kdcReq.KdcReqContainer;
-import org.apache.directory.shared.kerberos.components.KdcReq;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 
 /**
@@ -40,14 +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( StorePvno.class );
-
-    /** Speedup for logs */
-    private static final boolean IS_DEBUG = LOG.isDebugEnabled();
-
 
     /**
      * Instantiates a new StorePvno action.
@@ -61,51 +45,10 @@ public class StorePvno extends GrammarAc
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    @Override
+    public void setPvno( int pvno, Asn1Container container )
     {
         KdcReqContainer kdcReqContainer = ( KdcReqContainer ) container;
-
-        TLV tlv = kdcReqContainer.getCurrentTLV();
-
-        // The Length should not be null and should be 1
-        if ( tlv.getLength() != 1 )
-        {
-            LOG.error( I18n.err( I18n.ERR_04066 ) );
-
-            // This will generate a PROTOCOL_ERROR
-            throw new DecoderException( I18n.err( I18n.ERR_04067 ) );
-        }
-        
-        KdcReq kdcReq = kdcReqContainer.getKdcReq();
-        
-        Value value = tlv.getValue();
-        
-        try
-        {
-            int pvno = IntegerDecoder.parse( value );
-            
-            if ( pvno != 5 )
-            {
-                LOG.error( I18n.err( I18n.ERR_04070, StringTools.dumpBytes( value.getData()
), "The PVNO should be 5" ) );
-
-                // This will generate a PROTOCOL_ERROR
-                throw new DecoderException( "The PVNO should be 5" );
-            }
-
-            kdcReq.setPvno( 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() );
-        }
+        kdcReqContainer.getKdcReq().setPvno( pvno );
     }
 }



Mime
View raw message