Source:
private GoogleCloudStorageItemInfo getFileInfoInternal( StorageResourceId resourceId, boolean inferImplicitDirectories) throws IOException { if (resourceId.isRoot() || resourceId.isBucket()) { return gcs.getItemInfo(resourceId); } StorageResourceId dirId = resourceId.toDirectoryId(); ExecutorService dirExecutor = options.isStatusParallelEnabled() ? newSingleThreadExecutor(DAEMON_THREAD_FACTORY) : new LazyExecutorService(); try { Future<List<GoogleCloudStorageItemInfo>> listDirFuture = dirExecutor.submit( () -> gcs.listObjectInfo( dirId.getBucketName(), dirId.getObjectName(), GET_FILE_INFO_LIST_OPTIONS)); dirExecutor.shutdown(); if (!resourceId.isDirectory()) { GoogleCloudStorageItemInfo itemInfo = gcs.getItemInfo(resourceId); if (itemInfo.exists()) { return itemInfo; } } List<GoogleCloudStorageItemInfo> listDirInfo; try { listDirInfo = listDirFuture.get(); } catch (ExecutionException | InterruptedException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new IOException(String.format("Failed to get dir info for '%s'", resourceId), e); } if (listDirInfo.isEmpty()) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } checkState(listDirInfo.size() <= 2, "listed more than 2 objects: '%s'", listDirInfo); GoogleCloudStorageItemInfo dirInfo = Iterables.get(listDirInfo, 0); checkState( dirInfo.getResourceId().equals(dirId) || !inferImplicitDirectories, "listed wrong object '%s', but should be '%s'", dirInfo.getResourceId(), resourceId); return dirInfo.getResourceId().equals(dirId) ? dirInfo : GoogleCloudStorageItemInfo.createNotFound(resourceId); } finally { dirExecutor.shutdownNow(); } }

Target:
private GoogleCloudStorageItemInfo getFileInfoInternal( StorageResourceId resourceId, boolean inferImplicitDirectories) throws IOException { if (resourceId.isRoot() || resourceId.isBucket()) { return gcs.getItemInfo(resourceId); } StorageResourceId dirId = resourceId.toDirectoryId(); ExecutorService dirExecutor = options.isStatusParallelEnabled() ? newSingleThreadExecutor(DAEMON_THREAD_FACTORY) : new LazyExecutorService(); try { Future<List<GoogleCloudStorageItemInfo>> listDirFuture = dirExecutor.submit( () -> inferImplicitDirectories ? gcs.listObjectInfo( dirId.getBucketName(), dirId.getObjectName(), GET_FILE_INFO_LIST_OPTIONS) : ImmutableList.of(gcs.getItemInfo(dirId))); dirExecutor.shutdown(); if (!resourceId.isDirectory()) { GoogleCloudStorageItemInfo itemInfo = gcs.getItemInfo(resourceId); if (itemInfo.exists()) { return itemInfo; } } List<GoogleCloudStorageItemInfo> listDirInfo; try { listDirInfo = listDirFuture.get(); } catch (ExecutionException | InterruptedException e) { if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new IOException(String.format("Failed to get dir info for '%s'", resourceId), e); } if (listDirInfo.isEmpty()) { return GoogleCloudStorageItemInfo.createNotFound(resourceId); } checkState(listDirInfo.size() <= 2, "listed more than 2 objects: '%s'", listDirInfo); GoogleCloudStorageItemInfo dirInfo = Iterables.get(listDirInfo, 0); checkState( dirInfo.getResourceId().equals(dirId) || !inferImplicitDirectories, "listed wrong object '%s', but should be '%s'", dirInfo.getResourceId(), resourceId); return dirInfo.getResourceId().equals(dirId) && dirInfo.exists() ? dirInfo : GoogleCloudStorageItemInfo.createNotFound(resourceId); } finally { dirExecutor.shutdownNow(); } }