git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
extra info on bad images in ImagesUtils
[fanfix.git]
/
src
/
be
/
nikiroo
/
utils
/
android
/
ImageUtilsAndroid.java
diff --git
a/src/be/nikiroo/utils/android/ImageUtilsAndroid.java
b/src/be/nikiroo/utils/android/ImageUtilsAndroid.java
index f50af005316c3fdc169aabfe8d11269171db8458..b717989505a9b173065b7d7be7cd238f89de2b31 100644
(file)
--- a/
src/be/nikiroo/utils/android/ImageUtilsAndroid.java
+++ b/
src/be/nikiroo/utils/android/ImageUtilsAndroid.java
@@
-45,7
+45,7
@@
public class ImageUtilsAndroid extends ImageUtils {
}
// Some formats are not reliable
}
// Some formats are not reliable
- // Second chan
g
e: PNG
+ // Second chan
c
e: PNG
if (!ok && !format.equals("png")) {
ok = image.compress(Bitmap.CompressFormat.PNG, 90, fos);
}
if (!ok && !format.equals("png")) {
ok = image.compress(Bitmap.CompressFormat.PNG, 90, fos);
}
@@
-76,9
+76,19
@@
public class ImageUtilsAndroid extends ImageUtils {
try {
Bitmap image = BitmapFactory.decodeStream(stream);
if (image == null) {
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(
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;
}
return image;