Here's the code:
public static String getNotFoundUrl(int size) {
try {
BlobKey blob_key =
BLOB_STORE.createGsBlobKey("/gs/web_content/placeholder_img.png");
// Simple Test to make sure blob_key points at the right thing.
byte[] image_data = BLOB_STORE.fetchData(blob_key, 0, 100);
Application.getLogger().warning(new String(image_data));
// This parts works and gets the first 100 bytes.
ServingUrlOptions opts =
ServingUrlOptions.Builder.withBlobKey(blob_key);
if(size > 0) opts.imageSize(size);
return IMAGES_SERVICE.getServingUrl(opts);
} catch(IllegalArgumentException e) {
Application.getLogger().warning("Unable to serve placeholder image
from Cloud Storage.");
Application.getLogger().warning(e.getMessage());
Application.logException(e);
return "/placeholder_img.png";
}
}
The fetchData call succeeds and I successfully read the first 100 bytes of
the file that way. But the getServingUrl fails with
IllegalArgumentException.
java.lang.IllegalArgumentException:
at
com.google.appengine.api.images.ImagesServiceImpl.getServingUrl(ImagesServiceImpl.java:282)
Any ideas on why this happens will be much appreciated.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.