} else {
pg.setMinMax(0, 100);
}
+
+ pg.setName("Initialising");
Progress pgMeta = new Progress();
pg.addProgress(pgMeta, 10);
MetaData meta = story.getMeta();
pgMeta.done(); // 10%
-
- File tmpDir = Instance.getTempFiles().createTempDir("info-text");
+
+ File tmpDir = Instance.getInstance().getTempFiles().createTempDir("info-text");
String basename = null;
Map<String, Image> images = new HashMap<String, Image>();
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.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
}
if (pg.getProgress() < 85) {
}
String ext = "."
- + Instance.getConfig()
- .getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER)
- .toLowerCase();
+ + Instance.getInstance().getConfig().getString(Config.FILE_FORMAT_IMAGE_FORMAT_COVER).toLowerCase();
String coverName = meta.getUuid() + "_" + basename + ext;
Image cover = images.get(coverName);
images.remove(coverName);
}
if (!imagesList.isEmpty()) {
- Chapter chap = new Chapter(story.getChapters().size() + 1, null);
+ Chapter chap = new Chapter(story.getChapters().size() + 1, "");
story.getChapters().add(chap);
for (String uuid : imagesList) {
chap.getParagraphs().add(
new Paragraph(images.get(uuid)));
} catch (Exception e) {
- Instance.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
}
}
}
}
}
- pg.setProgress(100);
+ pg.done();
return story;
}