extra info on bad images in ImagesUtils
[fanfix.git] / src / be / nikiroo / utils / android / ImageUtilsAndroid.java
index ec1c2205af4e7beb2db5f571b39034735ce84ba7..b717989505a9b173065b7d7be7cd238f89de2b31 100644 (file)
@@ -76,9 +76,19 @@ public class ImageUtilsAndroid extends ImageUtils {
                try {
                        Bitmap image = BitmapFactory.decodeStream(stream);
                        if (image == null) {
+                               String extra = "";
+                               if (img.getSize() <= 1024) {
+                                       try {
+                                               extra = ", content: "
+                                                               + new String(img.getData(), "UTF-8");
+                                       } catch (Exception e) {
+                                               extra = ", content unavailable";
+                                       }
+                               }
                                String ssize = StringUtils.formatNumber(img.getSize());
                                throw new IOException(
-                                               "Failed to convert input to image, size was: " + ssize);
+                                               "Failed to convert input to image, size was: " + ssize
+                                                               + extra);
                        }
 
                        return image;