mirror of
https://github.com/google/nomulus
synced 2025-12-23 14:25:44 +00:00
Don't crash on a null completion timestamp (#296)
* Don't crash on a null completion timestamp * optional
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user