summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms/servlet
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/cms/servlet')
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java22
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java25
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java8
3 files changed, 33 insertions, 22 deletions
diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java b/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java
index b584316c..1355bebb 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/cert/Monitor.java
@@ -19,6 +19,7 @@ package com.netscape.cms.servlet.cert;
import java.io.IOException;
+import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
@@ -343,8 +344,9 @@ public class Monitor extends CMSServlet {
int hour = Integer.parseInt(z.substring(8, 10));
int minute = Integer.parseInt(z.substring(10, 12));
int second = Integer.parseInt(z.substring(12, 14));
-
- d = new Date(year, month, date, hour, minute, second);
+ Calendar calendar= Calendar.getInstance();
+ calendar.set(year, month, date, hour, minute, second);
+ d = calendar.getTime();
} catch (NumberFormatException nfe) {
}
} else if (z != null && z.length() > 1 && z.charAt(0) == '-') { // -5
@@ -361,21 +363,25 @@ public class Monitor extends CMSServlet {
}
String DateToZString(Date d) {
- String time = "" + (d.getYear() + 1900);
- int i = d.getMonth() + 1;
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(d);
+
+
+ String time = "" + (calendar.get(Calendar.YEAR));
+ int i = calendar.get(Calendar.MONTH) + 1;
if (i < 10) time += "0";
time += i;
- i = d.getDate();
+ i = calendar.get(Calendar.DAY_OF_MONTH);
if (i < 10) time += "0";
time += i;
- i = d.getHours();
+ i = calendar.get(Calendar.HOUR_OF_DAY);
if (i < 10) time += "0";
time += i;
- i = d.getMinutes();
+ i = calendar.get(Calendar.MINUTE);
if (i < 10) time += "0";
time += i;
- i = d.getSeconds();
+ i = calendar.get(Calendar.SECOND);
if (i < 10) time += "0";
time += i + "Z";
return time;
diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java b/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java
index 465e129c..ee75b6a2 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/cert/RemoteAuthConfig.java
@@ -19,6 +19,7 @@ package com.netscape.cms.servlet.cert;
import java.io.IOException;
+import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
@@ -593,20 +594,20 @@ public class RemoteAuthConfig extends CMSServlet {
}
private String makeInstanceName() {
- Date now = new Date();
- int y = 1900 + now.getYear();
+ Calendar now = Calendar.getInstance();
+ int y = now.get(Calendar.YEAR);
String name = "R" + y;
- if (now.getMonth() < 10) name += "0";
- name += now.getMonth();
- if (now.getDate() < 10) name += "0";
- name += now.getDate();
- if (now.getHours() < 10) name += "0";
- name += now.getHours();
- if (now.getMinutes() < 10) name += "0";
- name += now.getMinutes();
- if (now.getSeconds() < 10) name += "0";
- name += now.getSeconds();
+ if (now.get(Calendar.MONTH) < 10) name += "0";
+ name += now.get(Calendar.MONTH);
+ if (now.get(Calendar.DAY_OF_MONTH) < 10) name += "0";
+ name += now.get(Calendar.DAY_OF_MONTH);
+ if (now.get(Calendar.HOUR_OF_DAY) < 10) name += "0";
+ name += now.get(Calendar.HOUR_OF_DAY);
+ if (now.get(Calendar.MINUTE) < 10) name += "0";
+ name += now.get(Calendar.MINUTE);
+ if (now.get(Calendar.SECOND) < 10) name += "0";
+ name += now.get(Calendar.SECOND);
return name;
}
}
diff --git a/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java b/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java
index a83c390d..72a5e809 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/cert/RenewalServlet.java
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.math.BigInteger;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
+import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
@@ -185,8 +186,11 @@ public class RenewalServlet extends CMSServlet {
if (beginYear != -1 && beginMonth != -1 && beginDate != -1 &&
endYear != -1 && endMonth != -1 && endDate != -1) {
- notBefore = new Date(beginYear, beginMonth, beginDate);
- notAfter = new Date(endYear, endMonth, endDate);
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(beginYear, beginMonth, beginDate);
+ notBefore = calendar.getTime();
+ calendar.set(endYear, endMonth, endDate);
+ notAfter = calendar.getTime();
}
} // coming from client
else {