>        // see https://issues.apache.org/jira/browse/JCLOUDS-570
>        Optional<? extends Image> image = tryFind(images, idPredicate);
> -      if (!image.isPresent()) {
> -         logger.warn("Image %s not found in the image cache. Trying to get 
> it directly...", imageId);
> -         // Note that this might generate make a call to the provider 
> instead of using a cache, but
> -         // this will be executed rarely, only when an image is not present 
> in the image list but
> -         // it actually exists in the provider. It shouldn't be an expensive 
> call so using a cache just for
> -         // this corner case is overkill.
> -         image = Optional.fromNullable(getImageStrategy.getImage(imageId));
> -         if (!image.isPresent()) {
> -            throwNoSuchElementExceptionAfterLoggingImageIds(format("%s not 
> found", idPredicate), images);
> -         }
> +      if (image.isPresent()) {
> +         return image.get();
> +      }
> +
> +      logger.warn("Image %s not found in the image cache. Trying to get it 
> from the provider...", imageId);

That's a good point. WARN indicates something is slightly off but if a user is 
putting in the id directly, this is expected behaviour.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/401/files#r13755496

Reply via email to