@Test public void createCompositeException_withSingleInnerException() { IOException inner = new IOException("inner exception"); IOException compositeException = createCompositeException(ImmutableList.of(inner)); assertThat(inner).isSameInstanceAs(compositeException); }
public static IOException createCompositeException(Collection<IOException> innerExceptions) { checkArgument( innerExceptions != null && !innerExceptions.isEmpty(), "innerExceptions (%s) must be not null and contain at least one element", innerExceptions); Iterator<IOException> innerExceptionIterator = innerExceptions.iterator(); if (innerExceptions.size() == 1) { return innerExceptionIterator.next(); } IOException combined = new IOException("Multiple IOExceptions."); while (innerExceptionIterator.hasNext()) { combined.addSuppressed(innerExceptionIterator.next()); } return combined; }
GoogleCloudStorageExceptions { public static IOException createCompositeException(Collection<IOException> innerExceptions) { checkArgument( innerExceptions != null && !innerExceptions.isEmpty(), "innerExceptions (%s) must be not null and contain at least one element", innerExceptions); Iterator<IOException> innerExceptionIterator = innerExceptions.iterator(); if (innerExceptions.size() == 1) { return innerExceptionIterator.next(); } IOException combined = new IOException("Multiple IOExceptions."); while (innerExceptionIterator.hasNext()) { combined.addSuppressed(innerExceptionIterator.next()); } return combined; } }
GoogleCloudStorageExceptions { public static IOException createCompositeException(Collection<IOException> innerExceptions) { checkArgument( innerExceptions != null && !innerExceptions.isEmpty(), "innerExceptions (%s) must be not null and contain at least one element", innerExceptions); Iterator<IOException> innerExceptionIterator = innerExceptions.iterator(); if (innerExceptions.size() == 1) { return innerExceptionIterator.next(); } IOException combined = new IOException("Multiple IOExceptions."); while (innerExceptionIterator.hasNext()) { combined.addSuppressed(innerExceptionIterator.next()); } return combined; } private  GoogleCloudStorageExceptions(); }
GoogleCloudStorageExceptions { public static IOException createCompositeException(Collection<IOException> innerExceptions) { checkArgument( innerExceptions != null && !innerExceptions.isEmpty(), "innerExceptions (%s) must be not null and contain at least one element", innerExceptions); Iterator<IOException> innerExceptionIterator = innerExceptions.iterator(); if (innerExceptions.size() == 1) { return innerExceptionIterator.next(); } IOException combined = new IOException("Multiple IOExceptions."); while (innerExceptionIterator.hasNext()) { combined.addSuppressed(innerExceptionIterator.next()); } return combined; } private  GoogleCloudStorageExceptions(); static FileNotFoundException createFileNotFoundException(
      String bucketName, String objectName, @Nullable IOException cause); static FileNotFoundException createFileNotFoundException(
      StorageResourceId resourceId, @Nullable IOException cause); static IOException createCompositeException(Collection<IOException> innerExceptions); static GoogleJsonResponseException createJsonResponseException(
      GoogleJsonError e, HttpHeaders responseHeaders); }
GoogleCloudStorageExceptions { public static IOException createCompositeException(Collection<IOException> innerExceptions) { checkArgument( innerExceptions != null && !innerExceptions.isEmpty(), "innerExceptions (%s) must be not null and contain at least one element", innerExceptions); Iterator<IOException> innerExceptionIterator = innerExceptions.iterator(); if (innerExceptions.size() == 1) { return innerExceptionIterator.next(); } IOException combined = new IOException("Multiple IOExceptions."); while (innerExceptionIterator.hasNext()) { combined.addSuppressed(innerExceptionIterator.next()); } return combined; } private  GoogleCloudStorageExceptions(); static FileNotFoundException createFileNotFoundException(
      String bucketName, String objectName, @Nullable IOException cause); static FileNotFoundException createFileNotFoundException(
      StorageResourceId resourceId, @Nullable IOException cause); static IOException createCompositeException(Collection<IOException> innerExceptions); static GoogleJsonResponseException createJsonResponseException(
      GoogleJsonError e, HttpHeaders responseHeaders);  }