harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r467245 - in /incubator/harmony/enhanced/classlib/trunk/modules/auth/src: main/java/common/javax/security/auth/kerberos/KerberosTicket.java test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
Date Tue, 24 Oct 2006 05:35:25 GMT
Author: smishura
Date: Mon Oct 23 22:35:23 2006
New Revision: 467245

URL: http://svn.apache.org/viewvc?view=rev&rev=467245
Log:
Fix for KerberosTicket.getStartTime + regression test

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosTicket.java
    incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosTicket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosTicket.java?view=diff&rev=467245&r1=467244&r2=467245
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosTicket.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/javax/security/auth/kerberos/KerberosTicket.java
Mon Oct 23 22:35:23 2006
@@ -157,7 +157,7 @@
             this.startTime = authTime;
         }
 
-        if (startTime.getTime() > endTime.getTime()) {
+        if (this.startTime.getTime() > endTime.getTime()) {
             // TODO: make correct description of the exception  
             throw new IllegalArgumentException(Messages.getString("auth.42")); //$NON-NLS-1$
         }
@@ -251,7 +251,7 @@
 
     public final Date getStartTime() {
         checkState();
-        return startTime;
+        return new Date(startTime.getTime());
     }
 
     public final Date getEndTime() {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java?view=diff&rev=467245&r1=467244&r2=467245
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/javax/security/auth/kerberos/KerberosTicketTest.java
Mon Oct 23 22:35:23 2006
@@ -53,7 +53,9 @@
 
     private static final Date authTime = new Date(AUTH_TIME);
 
-    private static final Date startTime = new Date(1);
+    private static final int START_TIME = 1;
+
+    private static final Date startTime = new Date(START_TIME);
 
     private static final int END_TIME = 2;
 
@@ -258,5 +260,30 @@
                 renewTill, addesses);
 
         assertEquals(KEY_TYPE, krbTicket.getSessionKeyType());
+    }
+
+    /**
+     * @tests javax.security.auth.kerberos.KerberosTicket#getStartTime() 
+     */
+    public void test_getStartTime() throws Exception {
+
+        Date newStartTime = new Date(START_TIME);
+
+        KerberosTicket krbTicket = new KerberosTicket(ticket, pClient, pServer,
+                sessionKey, KEY_TYPE, flags, authTime, newStartTime, endTime,
+                renewTill, addesses);
+
+        // initial value is copied
+        newStartTime.setTime(START_TIME + 1);
+        assertEquals(START_TIME + 1, krbTicket.getStartTime().getTime());
+
+        // returned value is copied 
+        assertNotSame(krbTicket.getStartTime(), krbTicket.getStartTime());
+
+        // start time: null value is valid for contructor
+        krbTicket = new KerberosTicket(ticket, pClient, pServer, sessionKey,
+                KEY_TYPE, flags, authTime, null, endTime, renewTill, addesses);
+        assertEquals(authTime, krbTicket.getStartTime());
+        assertNotSame(authTime, krbTicket.getStartTime());
     }
 }



Mime
View raw message