File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,26 @@ public static void beforeClass() {
6161
@AfterClass
6262
public static void afterClass() {
6363
for (String databaseId : idGenerator.getDatabaseIds()) {
64+
System.out.println("Trying to drop " + databaseId);
6465
try {
66+
// If the database is not found, it is ignored (no exception is thrown)
6567
databaseAdminClient.dropDatabase(instanceId, databaseId);
66-
} catch (Exception e1) {
67-
try {
68-
databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId);
69-
} catch (Exception e2) {
70-
System.out.println(
71-
"Failed to drop database " + databaseId + " due to " + e2.getMessage()
72-
+ ", skipping..."
73-
);
74-
}
68+
databaseAdminClient.dropDatabase(multiRegionalInstanceId, databaseId);
69+
} catch (Exception e) {
70+
System.out.println(
71+
"Failed to drop database " + databaseId + " due to " + e.getMessage() + ", skipping..."
72+
);
7573
}
7674
}
7775
for (String backupId : idGenerator.getBackupIds()) {
7876
try {
77+
// If the backup is not found, it is ignored (no exception is thrown)
7978
databaseAdminClient.deleteBackup(instanceId, backupId);
80-
} catch (Exception e1) {
81-
try {
82-
databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId);
83-
} catch (Exception e2) {
84-
System.out.println(
85-
"Failed to delete backup " + backupId + " due to " + e2.getMessage() + ", skipping..."
86-
);
87-
}
79+
databaseAdminClient.deleteBackup(multiRegionalInstanceId, backupId);
80+
} catch (Exception e) {
81+
System.out.println(
82+
"Failed to delete backup " + backupId + " due to " + e.getMessage() + ", skipping..."
83+
);
8884
}
8985
}
9086
spanner.close();

0 commit comments

Comments
 (0)