harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r467244 - 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:20:26 GMT
Author: smishura
Date: Mon Oct 23 22:20:25 2006
New Revision: 467244

URL: http://svn.apache.org/viewvc?view=rev&rev=467244
Log:
KerberosTicket constructor - initial values for authTime and endTime are not copied

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=467244&r1=467243&r2=467244
==============================================================================
--- 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:20:25 2006
@@ -162,8 +162,8 @@
             throw new IllegalArgumentException(Messages.getString("auth.42")); //$NON-NLS-1$
         }
 
-        this.authTime = new Date(authTime.getTime());
-        this.endTime = new Date(endTime.getTime());
+        this.authTime = authTime;
+        this.endTime = endTime;
 
         if (clientAddresses != null) {
             this.clientAddresses = new InetAddress[clientAddresses.length];

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=467244&r1=467243&r2=467244
==============================================================================
--- 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:20:25 2006
@@ -49,11 +49,15 @@
     private static final boolean[] flags = { true, false, true, false, true,
             false, true, false, true, false, true, false, };
 
-    private static final Date authTime = new Date(0);
+    private static final int AUTH_TIME = 0;
+
+    private static final Date authTime = new Date(AUTH_TIME);
 
     private static final Date startTime = new Date(1);
 
-    private static final Date endTime = new Date(2);
+    private static final int END_TIME = 2;
+
+    private static final Date endTime = new Date(END_TIME);
 
     private static final Date renewTill = new Date(3);
 
@@ -72,16 +76,17 @@
      */
     public void test_getAuthTime() throws Exception {
 
+        Date newAuthTime = new Date(AUTH_TIME);
+
         KerberosTicket krbTicket = new KerberosTicket(ticket, pClient, pServer,
-                sessionKey, KEY_TYPE, flags, authTime, startTime, endTime,
+                sessionKey, KEY_TYPE, flags, newAuthTime, startTime, endTime,
                 renewTill, addesses);
 
-        assertEquals(0, krbTicket.getAuthTime().getTime());
-
-        // initial value is copied
-        assertNotSame(authTime, krbTicket.getAuthTime());
+        // initial value is not copied
+        newAuthTime.setTime(AUTH_TIME + 1);
+        assertEquals(AUTH_TIME + 1, krbTicket.getAuthTime().getTime());
 
-        // KerberosTicket instance is immutable 
+        // returned value is copied
         assertNotSame(krbTicket.getAuthTime(), krbTicket.getAuthTime());
 
         // auth time: null value is illegal for contructor
@@ -168,16 +173,17 @@
      */
     public void test_getEndTime() throws Exception {
 
+        Date newEndTime = new Date(END_TIME);
+
         KerberosTicket krbTicket = new KerberosTicket(ticket, pClient, pServer,
-                sessionKey, KEY_TYPE, flags, authTime, startTime, endTime,
+                sessionKey, KEY_TYPE, flags, authTime, startTime, newEndTime,
                 renewTill, addesses);
 
-        assertEquals(2, krbTicket.getEndTime().getTime());
+        // initial value is not copied
+        newEndTime.setTime(END_TIME + 1);
+        assertEquals(END_TIME + 1, krbTicket.getEndTime().getTime());
 
-        // initial value is copied
-        assertNotSame(endTime, krbTicket.getEndTime());
-
-        // KerberosTicket instance is immutable 
+        // returned value is copied
         assertNotSame(krbTicket.getEndTime(), krbTicket.getEndTime());
 
         // end time: null value is illegal for contructor



Mime
View raw message