harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r417954 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src: main/java/common/org/apache/harmony/security/asn1/BerInputStream.java test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java
Date Thu, 29 Jun 2006 07:50:26 GMT
Author: smishura
Date: Thu Jun 29 00:50:25 2006
New Revision: 417954

URL: http://svn.apache.org/viewvc?rev=417954&view=rev
Log:
Fixing bug: wrong interpretation of encoded year by UTCTime

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java?rev=417954&r1=417953&r2=417954&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/asn1/BerInputStream.java
Thu Jun 29 00:50:25 2006
@@ -473,9 +473,11 @@
                 times = new int[7];
             }
 
-            times[0] = strToInt(contentOffset, 2) + 1900; // year
-            if (Calendar.getInstance().get(Calendar.YEAR) - times[0] > 80) {
-                times[0] += 100;
+            times[0] = strToInt(contentOffset, 2); // year
+            if (times[0] > 49) {
+                times[0] += 1900;
+            } else {
+                times[0] += 2000;
             }
 
             times[1] = strToInt(contentOffset + 2, 2); // month

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java?rev=417954&r1=417953&r2=417954&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/asn1/der/UTCTimeTest.java
Thu Jun 29 00:50:25 2006
@@ -67,12 +67,11 @@
                                 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A },
                         null },
                 // YYMMDD-HHMMSS = "490203040506Z"
-// FIXME test case fails
-//                {
-//                        "3 Feb 2049 04:05:06",
-//                        new byte[] { 0x17, 0x0D, 0x34, 0x39, 0x30, 0x32, 0x30,
-//                                0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x5A },
-//                        null },
+                {
+                        "3 Feb 2049 04:05:06",
+                        new byte[] { 0x17, 0x0D, 0x34, 0x39, 0x30, 0x32, 0x30,
+                                0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x5A },
+                        null },
                         };
 
         try {



Mime
View raw message