in = new FileInputStream(cover);
try {
synchronized (lock) {
- sourceCovers.put(source, new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ sourceCovers.put(source, img);
}
} finally {
in.close();
in = new FileInputStream(cover);
try {
synchronized (lock) {
- authorCovers.put(author, new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ authorCovers.put(author, img);
}
} finally {
in.close();
try {
Image img = new Image(in);
if (img.getSize() > 0) {
+ img.close();
return img;
}
try {
Image img = new Image(in);
if (img.getSize() > 0) {
+ img.close();
return img;
}
try {
Image img = new Image(in);
if (img.getSize() > 0) {
+ img.close();
return img;
}
try {
InputStream in = Instance.getInstance().getCache().open(new URL(coverUrl), getSupport(), true);
try {
- meta.setCover(new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ meta.setCover(img);
} finally {
in.close();
}
InputStream in = Instance.getInstance().getCache().open(new URL(coverUrl), getSupport(),
true);
try {
- meta.setCover(new Image(in));
+ Image ii = new Image(in);
+ if (ii.getSize() == 0) {
+ ii.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ meta.setCover(ii);
} finally {
in.close();
}
InputStream in = null;
try {
in = Instance.getInstance().getCache().open(url, support, true);
- return new Image(in);
+ 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) {
InputStream in = null;
try {
in = Instance.getInstance().getCache().open(url, support, true);
- return new Image(in);
+ 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) {
InputStream in = null;
try {
in = Instance.getInstance().getCache().open(url, getSupport(url), true);
- return new Image(in);
+ 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) {
if (imageEntry) {
String uuid = meta.getUuid() + "_" + entry.getName();
try {
- images.put(uuid, new Image(zipIn));
+ Image img = new Image(zipIn);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ images.put(uuid, img);
} catch (Exception e) {
Instance.getInstance().getTraceHandler().error(e);
}
// Cover
if (getCover() && cover == null) {
try {
- cover = new Image(zipIn);
+ Image img = new Image(zipIn);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ cover = img;
} catch (Exception e) {
Instance.getInstance().getTraceHandler()
.error(e);
try {
InputStream in = Instance.getInstance().getCache().open(coverImageUrl, null, true);
try {
- meta.setCover(new Image(in));
+ Image img = new Image(in);
+ if (img.getSize() == 0) {
+ img.close();
+ throw new IOException(
+ "Empty image not accepted");
+ }
+ meta.setCover(img);
} finally {
in.close();
}
if (img != null) {
String coverUrl = img.absUrl("src");
- InputStream coverIn;
try {
- coverIn = Instance.getInstance().getCache().open(new URL(coverUrl), this, true);
+ InputStream coverIn = Instance.getInstance().getCache()
+ .open(new URL(coverUrl), this, true);
try {
- return new Image(coverIn);
+ Image ii = new Image(coverIn);
+ if (ii.getSize() == 0) {
+ ii.close();
+ throw new IOException("Empty image not accepted");
+ }
+
+ return ii;
} finally {
coverIn.close();
}