Don't use Date, instead use Calendar. I still want to sneak in LocalDate somehow...

This commit is contained in:
Tux 2014-07-30 18:03:07 -04:00
parent 13b62f7269
commit ee778953e8
1 changed files with 3 additions and 4 deletions

View File

@ -35,10 +35,9 @@ public final class UUIDTranslator {
// Cache the entry for three days. // Cache the entry for three days.
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 3); calendar.add(Calendar.DAY_OF_MONTH, 3);
Date date = calendar.getTime();
// Create the entry and populate the local maps // Create the entry and populate the local maps
CachedUUIDEntry entry = new CachedUUIDEntry(name, uuid, date); CachedUUIDEntry entry = new CachedUUIDEntry(name, uuid, calendar);
nameToUuidMap.put(name.toLowerCase(), entry); nameToUuidMap.put(name.toLowerCase(), entry);
uuidToNameMap.put(uuid, entry); uuidToNameMap.put(uuid, entry);
} }
@ -199,10 +198,10 @@ public final class UUIDTranslator {
private class CachedUUIDEntry { private class CachedUUIDEntry {
private final String name; private final String name;
private final UUID uuid; private final UUID uuid;
private final Date expiry; private final Calendar expiry;
public boolean expired() { public boolean expired() {
return new Date().after(expiry); return Calendar.getInstance().after(expiry);
} }
} }
} }