git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do not allow empty cover images
[nikiroo-utils.git]
/
src
/
be
/
nikiroo
/
fanfix
/
supported
/
BasicSupportImages.java
diff --git
a/src/be/nikiroo/fanfix/supported/BasicSupportImages.java
b/src/be/nikiroo/fanfix/supported/BasicSupportImages.java
index 4b7eeba36574f084ee6c044b1d1dd4ced798416e..f56b50c2b67a6dd9f5a4b1e0de572767d0a42dde 100644
(file)
--- a/
src/be/nikiroo/fanfix/supported/BasicSupportImages.java
+++ b/
src/be/nikiroo/fanfix/supported/BasicSupportImages.java
@@
-54,8
+54,14
@@
public class BasicSupportImages {
}
InputStream in = null;
try {
}
InputStream in = null;
try {
- in = Instance.getCache().open(url, support, true);
- return new Image(in);
+ in = Instance.getInstance().getCache().open(url, support, true);
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ return img;
} catch (IOException e) {
} finally {
if (in != null) {
} catch (IOException e) {
} finally {
if (in != null) {
@@
-126,7
+132,7
@@
public class BasicSupportImages {
// try for URLs
try {
for (String ext : getImageExt(true)) {
// try for URLs
try {
for (String ext : getImageExt(true)) {
- if (Instance.getCache()
+ if (Instance.get
Instance().get
Cache()
.check(new URL(line + ext), true)) {
url = new URL(line + ext);
break;
.check(new URL(line + ext), true)) {
url = new URL(line + ext);
break;
@@
-138,7
+144,7
@@
public class BasicSupportImages {
for (String ext : getImageExt(true)) {
try {
url = new URL(line + ext);
for (String ext : getImageExt(true)) {
try {
url = new URL(line + ext);
- Instance.getCache().refresh(url, support, true);
+ Instance.get
Instance().get
Cache().refresh(url, support, true);
break;
} catch (IOException e) {
// no image with this ext
break;
} catch (IOException e) {
// no image with this ext
@@
-154,7
+160,7
@@
public class BasicSupportImages {
// refresh the cached file
if (url != null) {
try {
// refresh the cached file
if (url != null) {
try {
- Instance.getCache().refresh(url, support, true);
+ Instance.get
Instance().get
Cache().refresh(url, support, true);
} catch (IOException e) {
// woops, broken image
url = null;
} catch (IOException e) {
// woops, broken image
url = null;