directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1039310 - in /directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos: components/EncryptedData.java messages/Ticket.java
Date Fri, 26 Nov 2010 11:13:15 GMT
Author: kayyagari
Date: Fri Nov 26 11:13:15 2010
New Revision: 1039310

URL: http://svn.apache.org/viewvc?rev=1039310&view=rev
Log:
o added hashCode and equals methods

Modified:
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/EncryptedData.java
    directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Ticket.java

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/EncryptedData.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/EncryptedData.java?rev=1039310&r1=1039309&r2=1039310&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/EncryptedData.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/components/EncryptedData.java
Fri Nov 26 11:13:15 2010
@@ -22,6 +22,7 @@ package org.apache.directory.shared.kerb
 
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.asn1.AbstractAsn1Object;
@@ -313,6 +314,57 @@ public class EncryptedData extends Abstr
 
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + Arrays.hashCode( cipher );
+        result = prime * result + ( ( eType == null ) ? 0 : eType.hashCode() );
+        result = prime * result + kvno;
+        return result;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        EncryptedData other = ( EncryptedData ) obj;
+        
+        if ( !Arrays.equals( cipher, other.cipher ) )
+        {
+            return false;
+        }
+        
+        if ( eType != other.eType )
+        {
+            return false;
+        }
+        
+        if ( kvno != other.kvno )
+        {
+            return false;
+        }
+        
+        return true;
+    }
+
+    /**
      * @see Object#toString()
      */
     public String toString()

Modified: directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Ticket.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Ticket.java?rev=1039310&r1=1039309&r2=1039310&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Ticket.java
(original)
+++ directory/apacheds/trunk/kerberos-codec/src/main/java/org/apache/directory/shared/kerberos/messages/Ticket.java
Fri Nov 26 11:13:15 2010
@@ -333,6 +333,79 @@ public class Ticket extends KerberosMess
     
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ( ( encPart == null ) ? 0 : encPart.hashCode() );
+        result = prime * result + ( ( realm == null ) ? 0 : realm.hashCode() );
+        result = prime * result + ( ( sName == null ) ? 0 : sName.hashCode() );
+        return result;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        
+        if ( obj == null )
+        {
+            return false;
+        }
+        
+        Ticket other = ( Ticket ) obj;
+        
+        if ( encPart == null )
+        {
+            if ( other.encPart != null )
+            {
+                return false;
+            }
+        }
+        else if ( !encPart.equals( other.encPart ) )
+        {
+            return false;
+        }
+        
+        if ( realm == null )
+        {
+            if ( other.realm != null )
+            {
+                return false;
+            }
+        }
+        else if ( !realm.equals( other.realm ) )
+        {
+            return false;
+        }
+        
+        if ( sName == null )
+        {
+            if ( other.sName != null )
+            {
+                return false;
+            }
+        }
+        else if ( !sName.equals( other.sName ) )
+        {
+            return false;
+        }
+        
+        return true;
+    }
+
+
+    /**
      * @see Object#toString()
      */
     public String toString()



Mime
View raw message