ExternalIdsUpdate: Document IllegalStateException with @throws

Change-Id: I733f1f6b357442c6d13645438a230ba8d168a225
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-03-27 10:34:14 +02:00
parent f4391cf3ac
commit c03dae284d

View File

@@ -254,8 +254,8 @@ public class ExternalIdsUpdate {
/** /**
* Deletes an external ID. * Deletes an external ID.
* *
* <p>The deletion fails with {@link IllegalStateException} if there is an existing external ID * @throws IllegalStateException is thrown if there is an existing external ID that has the same
* that has the same key, but otherwise doesn't match the specified external ID. * key, but otherwise doesn't match the specified external ID.
*/ */
public void delete(ReviewDb db, ExternalId extId) public void delete(ReviewDb db, ExternalId extId)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -265,9 +265,9 @@ public class ExternalIdsUpdate {
/** /**
* Deletes external IDs. * Deletes external IDs.
* *
* <p>The deletion fails with {@link IllegalStateException} if there is an existing external ID * @throws IllegalStateException is thrown if there is an existing external ID that has the same
* that has the same key as any of the external IDs that should be deleted, but otherwise doesn't * key as any of the external IDs that should be deleted, but otherwise doesn't match the that
* match the that external ID. * external ID.
*/ */
public void delete(ReviewDb db, Collection<ExternalId> extIds) public void delete(ReviewDb db, Collection<ExternalId> extIds)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -284,8 +284,8 @@ public class ExternalIdsUpdate {
/** /**
* Delete an external ID by key. * Delete an external ID by key.
* *
* <p>The external ID is only deleted if it belongs to the specified account. If it belongs to * @throws IllegalStateException is thrown if the external ID does not belong to the specified
* another account the deletion fails with {@link IllegalStateException}. * account.
*/ */
public void delete(ReviewDb db, Account.Id accountId, ExternalId.Key extIdKey) public void delete(ReviewDb db, Account.Id accountId, ExternalId.Key extIdKey)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -295,8 +295,8 @@ public class ExternalIdsUpdate {
/** /**
* Delete external IDs by external ID key. * Delete external IDs by external ID key.
* *
* <p>The external IDs are only deleted if they belongs to the specified account. If any of the * @throws IllegalStateException is thrown if any of the external IDs does not belong to the
* external IDs belongs to another account the deletion fails with {@link IllegalStateException}. * specified account.
*/ */
public void delete(ReviewDb db, Account.Id accountId, Collection<ExternalId.Key> extIdKeys) public void delete(ReviewDb db, Account.Id accountId, Collection<ExternalId.Key> extIdKeys)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -341,8 +341,8 @@ public class ExternalIdsUpdate {
* be added, the old external ID with that key is deleted first and then the new external ID is * be added, the old external ID with that key is deleted first and then the new external ID is
* added (so the external ID for that key is replaced). * added (so the external ID for that key is replaced).
* *
* <p>If any of the specified external IDs belongs to another account the replacement fails with * @throws IllegalStateException is thrown if any of the specified external IDs does not belong to
* {@link IllegalStateException}. * the specified account.
*/ */
public void replace( public void replace(
ReviewDb db, ReviewDb db,
@@ -398,8 +398,8 @@ public class ExternalIdsUpdate {
/** /**
* Replaces an external ID. * Replaces an external ID.
* *
* <p>If the specified external IDs belongs to different accounts the replacement fails with * @throws IllegalStateException is thrown if the specified external IDs belong to different
* {@link IllegalStateException}. * accounts.
*/ */
public void replace(ReviewDb db, ExternalId toDelete, ExternalId toAdd) public void replace(ReviewDb db, ExternalId toDelete, ExternalId toAdd)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -414,8 +414,8 @@ public class ExternalIdsUpdate {
* added, the old external ID with that key is deleted first and then the new external ID is added * added, the old external ID with that key is deleted first and then the new external ID is added
* (so the external ID for that key is replaced). * (so the external ID for that key is replaced).
* *
* <p>If the specified external IDs belong to different accounts the replacement fails with {@link * @throws IllegalStateException is thrown if the specified external IDs belong to different
* IllegalStateException}. * accounts.
*/ */
public void replace(ReviewDb db, Collection<ExternalId> toDelete, Collection<ExternalId> toAdd) public void replace(ReviewDb db, Collection<ExternalId> toDelete, Collection<ExternalId> toAdd)
throws IOException, ConfigInvalidException, OrmException { throws IOException, ConfigInvalidException, OrmException {
@@ -502,8 +502,8 @@ public class ExternalIdsUpdate {
/** /**
* Removes an external ID from the note map. * Removes an external ID from the note map.
* *
* <p>The removal fails with {@link IllegalStateException} if there is an existing external ID * @throws IllegalStateException is thrown if there is an existing external ID that has the same
* that has the same key, but otherwise doesn't match the specified external ID. * key, but otherwise doesn't match the specified external ID.
*/ */
public static void remove(RevWalk rw, NoteMap noteMap, ExternalId extId) public static void remove(RevWalk rw, NoteMap noteMap, ExternalId extId)
throws IOException, ConfigInvalidException { throws IOException, ConfigInvalidException {
@@ -526,9 +526,8 @@ public class ExternalIdsUpdate {
/** /**
* Removes an external ID from the note map by external ID key. * Removes an external ID from the note map by external ID key.
* *
* <p>If an expected account ID is provided the external ID is only deleted if it belongs to this * @throws IllegalStateException is thrown if an expected account ID is provided and an external
* account and the deletion fails with {@link IllegalStateException} if the external IDs belongs * ID with the specified key exists, but belongs to another account.
* to another account.
*/ */
private static void remove( private static void remove(
RevWalk rw, NoteMap noteMap, ExternalId.Key extIdKey, Account.Id expectedAccountId) RevWalk rw, NoteMap noteMap, ExternalId.Key extIdKey, Account.Id expectedAccountId)