summaryrefslogtreecommitdiffstats
path: root/pki
diff options
context:
space:
mode:
authorEndi Sukma Dewata <edewata@redhat.com>2012-03-19 12:38:20 -0500
committerEndi Sukma Dewata <edewata@redhat.com>2012-03-22 09:06:04 -0500
commit7e6da86e37c4dc60ed537316f6bc0dee76a3d6dc (patch)
tree11c6e495692959797176fa05c466a7f3598dab4c /pki
parent29629861abfc92ce754a99fcee6c2df6febf7387 (diff)
downloadpki-7e6da86e37c4dc60ed537316f6bc0dee76a3d6dc.tar.gz
pki-7e6da86e37c4dc60ed537316f6bc0dee76a3d6dc.tar.xz
pki-7e6da86e37c4dc60ed537316f6bc0dee76a3d6dc.zip
Replaced deprecated Date API.
The deprecated Date(year, month, date) constructor has been replaced with Calendar API. There are similar Date constructors in JavaScript but those are not deprecated and should not be replaced. Ticket #3
Diffstat (limited to 'pki')
-rw-r--r--pki/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/pki/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java b/pki/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java
index c09d6efa7..61d9506e6 100644
--- a/pki/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java
+++ b/pki/base/console/src/com/netscape/admin/certsrv/config/WBaseValidityPage.java
@@ -174,12 +174,12 @@ January 2038.
//DateFormat dateFormat = DataFormat.getDateTimeInstance(
// DateFormat.FULL,DateFormat.MEDIUM);
- Date nowDate = new Date();
-
- Date afterDate = new Date(nowDate.getYear()+5, nowDate.getMonth(),
- nowDate.getDate());
-
- mBYear = new JTextField(""+(nowDate.getYear()+1900));
+ Calendar nowDate = Calendar.getInstance();
+
+ Calendar afterDate = (Calendar)nowDate.clone();
+ afterDate.add(Calendar.YEAR, 5);
+
+ mBYear = new JTextField(""+nowDate.get(Calendar.YEAR));
mBYear.setColumns(4);
CMSAdminUtil.resetGBC(gbc);
gbc.anchor = gbc.WEST;
@@ -188,11 +188,11 @@ January 2038.
COMPONENT_SPACE);
add(mBYear, gbc);
- mBMonth = new JTextField(""+(nowDate.getMonth()+1));
+ mBMonth = new JTextField(""+(nowDate.get(Calendar.MONTH)+1));
mBMonth.setColumns(3);
add(mBMonth, gbc);
- mBDay = new JTextField(""+nowDate.getDate());
+ mBDay = new JTextField(""+nowDate.get(Calendar.DAY_OF_MONTH));
mBDay.setColumns(3);
add(mBDay, gbc);
@@ -217,7 +217,7 @@ January 2038.
COMPONENT_SPACE, COMPONENT_SPACE);
add(expireLbl, gbc);
- mEYear = new JTextField(""+(afterDate.getYear()+1900));
+ mEYear = new JTextField(""+afterDate.get(Calendar.YEAR));
mEYear.setColumns(4);
CMSAdminUtil.resetGBC(gbc);
gbc.anchor = gbc.WEST;
@@ -226,11 +226,11 @@ January 2038.
COMPONENT_SPACE);
add(mEYear, gbc);
- mEMonth = new JTextField(""+(afterDate.getMonth()+1));
+ mEMonth = new JTextField(""+(afterDate.get(Calendar.MONTH)+1));
mEMonth.setColumns(3);
add(mEMonth, gbc);
- mEDay = new JTextField(""+afterDate.getDate());
+ mEDay = new JTextField(""+afterDate.get(Calendar.DAY_OF_MONTH));
mEDay.setColumns(3);
add(mEDay, gbc);