mirror of
https://github.com/google/nomulus.git
synced 2025-05-29 08:50:09 +02:00
Don't crash on a null completion timestamp (#296)
* Don't crash on a null completion timestamp * optional
This commit is contained in:
parent
c25adbbd9c
commit
cc018a6dac
1 changed files with 5 additions and 2 deletions
|
@ -21,7 +21,9 @@ import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
|
|||
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.util.DateTimeUtils;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Optional;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
|
@ -149,8 +151,9 @@ public final class RegistryLock extends ImmutableObject implements Buildable {
|
|||
return toJodaDateTime(creationTimestamp);
|
||||
}
|
||||
|
||||
public DateTime getCompletionTimestamp() {
|
||||
return toJodaDateTime(completionTimestamp);
|
||||
/** Returns the completion timestamp, or empty if this lock has not been completed yet. */
|
||||
public Optional<DateTime> getCompletionTimestamp() {
|
||||
return Optional.ofNullable(completionTimestamp).map(DateTimeUtils::toJodaDateTime);
|
||||
}
|
||||
|
||||
public String getVerificationCode() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue