+ public Image getCustomAuthorCover(String author) {
+ synchronized (lock) {
+ if (authorCovers == null) {
+ authorCovers = new HashMap<String, Image>();
+ }
+ }
+
+ synchronized (lock) {
+ Image img = authorCovers.get(author);
+ if (img != null) {
+ return img;
+ }
+ }
+
+ File cover = getAuthorCoverFile(author);
+ if (cover.exists()) {
+ InputStream in;
+ try {
+ in = new FileInputStream(cover);
+ try {
+ synchronized (lock) {
+ 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();
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ Instance.getInstance().getTraceHandler()
+ .error(new IOException(
+ "Cannot load the existing custom author cover: "
+ + cover,
+ e));
+ }
+ }
+
+ synchronized (lock) {
+ return authorCovers.get(author);
+ }
+ }
+
+ @Override
+ public void setSourceCover(String source, String luid) throws IOException {