diff --git a/app/src/main/java/com/keepassdroid/database/PwDate.java b/app/src/main/java/com/keepassdroid/database/PwDate.java index ae542162b..28f55a836 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDate.java +++ b/app/src/main/java/com/keepassdroid/database/PwDate.java @@ -44,11 +44,9 @@ public class PwDate implements Cloneable, Serializable { private byte[] cDate; public static final Date NEVER_EXPIRE = getNeverExpire(); - public static final Date NEVER_EXPIRE_BUG = getNeverExpireBug(); - public static final Date DEFAULT_DATE = getDefaultDate(); + public static final PwDate PW_NEVER_EXPIRE = new PwDate(NEVER_EXPIRE); - public static final PwDate PW_NEVER_EXPIRE_BUG = new PwDate(NEVER_EXPIRE_BUG); public static final PwDate DEFAULT_PWDATE = new PwDate(DEFAULT_DATE); private static Date getDefaultDate() { @@ -74,24 +72,6 @@ public class PwDate implements Cloneable, Serializable { return cal.getTime(); } - - /** This date was was accidentally being written - * out when an entry was supposed to be marked as - * expired. We'll use this to silently correct those - * entries. - * @return - */ - private static Date getNeverExpireBug() { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.YEAR, 2999); - cal.set(Calendar.MONTH, 11); - cal.set(Calendar.DAY_OF_MONTH, 30); - cal.set(Calendar.HOUR, 23); - cal.set(Calendar.MINUTE, 59); - cal.set(Calendar.SECOND, 59); - - return cal.getTime(); - } public PwDate(byte[] buf, int offset) { cDate = new byte[DATE_SIZE]; diff --git a/app/src/main/java/com/keepassdroid/database/PwNode.java b/app/src/main/java/com/keepassdroid/database/PwNode.java index dbd74100e..3acc39355 100644 --- a/app/src/main/java/com/keepassdroid/database/PwNode.java +++ b/app/src/main/java/com/keepassdroid/database/PwNode.java @@ -37,7 +37,7 @@ public abstract class PwNode implements ISmallTimeLogger protected PwDate creation = new PwDate(); protected PwDate lastMod = new PwDate(); protected PwDate lastAccess = new PwDate(); - protected PwDate expireDate = new PwDate(NEVER_EXPIRE); + protected PwDate expireDate = PW_NEVER_EXPIRE; protected void construct(Parent parent) { this.parent = parent; @@ -151,7 +151,8 @@ public abstract class PwNode implements ISmallTimeLogger } public boolean expires() { - return ! PwDate.IsSameDate(NEVER_EXPIRE, expireDate.getDate()); + return expireDate.getDate().equals(NEVER_EXPIRE) + || expireDate.getDate().after(NEVER_EXPIRE); } /**