Skip to content

Commit

Permalink
Tryng LocalDateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Jul 25, 2016
1 parent bb84b52 commit 03732c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/sf/jabref/logic/net/Cookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package net.sf.jabref.logic.net;

import java.net.URI;
import java.time.ZonedDateTime;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.Locale;
Expand All @@ -27,7 +27,7 @@ class Cookie {
private final String name;
private final String value;
private String domain;
private ZonedDateTime expires;
private LocalDateTime expires;
private String path;

private final DateTimeFormatter whiteSpaceFormat = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz",
Expand Down Expand Up @@ -79,10 +79,10 @@ public Cookie(URI uri, String header) {
this.path = value;
} else if ("expires".equalsIgnoreCase(name)) {
try {
this.expires = ZonedDateTime.parse(value, whiteSpaceFormat);
this.expires = LocalDateTime.parse(value, whiteSpaceFormat);
} catch (DateTimeParseException e) {
try {
this.expires = ZonedDateTime.parse(value, hyphenFormat);
this.expires = LocalDateTime.parse(value, hyphenFormat);
} catch (DateTimeParseException e2) {
throw new IllegalArgumentException(
"Bad date format in header: " + value);
Expand All @@ -96,7 +96,7 @@ public boolean hasExpired() {
if (expires == null) {
return false;
}
return ZonedDateTime.now().isAfter(expires);
return LocalDateTime.now().isAfter(expires);
}

/**
Expand Down

0 comments on commit 03732c1

Please sign in to comment.