google-nomulus/java/google/registry
mcilwain 4491b7b909 Make loadByForeignKey() and related methods return Optional
This is safer and addresses a common source of confusion in the codebase because it's always explicit that the resource returned may not be present, whether because it's soft-deleted when projected to the given time or because it never existed in the first place.

In production code, the presence of the returned value is always checked. In test code, its presence is assumed using .get() where that is expected and convenient, as it not being present will throw an NPE that will cause the test to fail anyway.

Note that the roughly equivalent reloadResourceByForeignKey(), which is widely used in test code, is not having this same treatment applied to it. That is out of the scope of this CL, and has much smaller returns anyway because it's only used in tests (where the unexpected absence of a given resource would just cause the test to fail).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=225424002
2018-12-14 11:24:49 -05:00
..
backup Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
batch Update lastEppUpdateTime and lastEppUpdateClientId when necessary 2018-12-03 19:13:55 -05:00
beam Switch all added usages of java.time to be joda.time 2018-12-12 13:22:34 -05:00
bigquery Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
builddefs Replace iteration over depsets with an explicit .to_list() call 2018-11-14 11:55:43 -05:00
config Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
cron Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
dns Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
env Backup Datastore using the Admin REST API 2018-12-12 13:22:34 -05:00
export Backup Datastore using the Admin REST API 2018-12-12 13:22:34 -05:00
flows Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
gcs Clean up annotation imports in BUILD files 2018-06-27 15:28:53 -04:00
groups Account for GoogleJsonResponseException#getDetails returning null 2018-12-03 19:09:11 -05:00
idn Update IDN tables to comply with https://www.iana.org/help/idn-repository-procedure 2018-02-01 21:59:14 -05:00
keyring Remove the ability to download service account credentials 2018-12-05 16:00:51 -05:00
loadtest Clean up annotation imports in BUILD files 2018-06-27 15:28:53 -04:00
mapreduce Use locking on async mapreduces 2018-08-10 13:44:25 -04:00
model Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
module Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
monitoring/whitebox Stop exporting EPP flow metrics to BigQuery 2018-10-08 16:59:29 -04:00
pricing Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
proxy Use gson to make JSON string in proxy log formatter 2018-12-12 13:22:34 -05:00
rdap Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
rde Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
reporting Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
request Remove Google-internal auth mechanism 2018-12-13 15:05:44 -05:00
security Improve internal build system speed 2018-06-27 15:28:52 -04:00
storage/drive Clean up third_party imports in BUILD files 2018-07-14 01:11:51 -04:00
tldconfig/idn Remove the use of InjectRule in IdnLabelValidatorTest 2018-10-22 18:54:53 -04:00
tmch Refactor TmchCertificateAuthority 2018-10-25 14:40:38 -04:00
tools Make loadByForeignKey() and related methods return Optional 2018-12-14 11:24:49 -05:00
ui Hide the edit/add buttons for fields the user can't update 2018-12-03 19:25:05 -05:00
util Isolate customizable code in activity reporting 2018-12-13 15:07:29 -05:00
whois Make loadByForeignKeyCached() return an Optional type 2018-12-12 13:22:34 -05:00
xjc Run bazel installer as a argument to bash 2018-08-10 13:44:25 -04:00
xml Pretty-print actual XML in tests 2018-07-14 01:37:03 -04:00
BUILD Remove deprecated DNS subsystem 2018-09-14 12:01:08 -04:00
repositories.bzl Add an option to perform login on remote machines 2018-12-12 13:22:34 -05:00