The Cloud Storage documentation shows how to rename an object. It involves copying it to a new object then deleting the original via this code:
// Copy source object to target object
storage.copy(
Storage.CopyRequest.newBuilder().setSource(source).setTarget(target, precondition).build());
Blob copiedObject = storage.get(target);
// Delete the original blob now that we've copied to where we want it, finishing the "move"
// operation
storage.get(source).delete();
But I do not see any error handling here. What if the original object does not get copied and you delete it? What would be the appropriate try/catch or other technique to ensure the object got copied before deleting it?