From d3c15421430e85e3afeefef211b4f791753e17ba Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 12 Feb 2017 15:26:11 +0100 Subject: [PATCH] Small fixes Samll fixes: - configure.sh fix to include sources into the created JARs - fix source name of MangaFox (.me, not .met) - fix a check in Library to be more verbose in case of error --- Makefile.base | 6 +++-- configure.sh | 2 +- src/be/nikiroo/fanfix/Library.java | 26 ++++++++++++------- src/be/nikiroo/fanfix/supported/MangaFox.java | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Makefile.base b/Makefile.base index 300db50..86050e6 100644 --- a/Makefile.base +++ b/Makefile.base @@ -62,7 +62,7 @@ test: clean: rm -rf bin/ @echo Removing sources taken from libs... - @for lib in libs/*.jar; do \ + @for lib in libs/*-sources.jar; do \ basename "$$lib"; \ jar tf "$$lib" | while read -r ln; do \ [ -f "src/$$ln" ] && rm "src/$$ln"; \ @@ -92,7 +92,7 @@ resources: libs libs: bin @[ -e bin/libs -o ! -d libs ] || echo Extracting sources from libs... - @[ -e bin/libs -o ! -d libs ] || (cd src&& for lib in ../libs/*.jar;do \ + @[ -e bin/libs -o ! -d libs ] || (cd src && for lib in ../libs/*-sources.jar; do \ basename "$$lib"; \ jar xf "$$lib"; \ done ) @@ -105,6 +105,8 @@ $(NAME).jar: resources @echo "Main-Class: `echo "$(MAIN)" | sed 's:/:.:g'`" > bin/manifest @echo >> bin/manifest $(JAR) cfm $(NAME).jar bin/manifest $(JAR_FLAGS) + @[ ! -e VERSION ] || echo Copying to "$(NAME)-`cat VERSION`.jar" + @[ ! -e VERSION ] || cp $(NAME).jar "$(NAME)-`cat VERSION`.jar" run: @[ -e bin/$(MAIN).class ] || echo You need to build the sources diff --git a/configure.sh b/configure.sh index 2eab91b..76697d9 100755 --- a/configure.sh +++ b/configure.sh @@ -36,7 +36,7 @@ done echo "MAIN = be/nikiroo/fanfix/Main" > Makefile echo "NAME = fanfix" >> Makefile echo "PREFIX = $PREFIX" >> Makefile -echo "JAR_FLAGS += -C bin/ org -C bin/ be" >> Makefile +echo "JAR_FLAGS += -C bin/ org -C bin/ be -C ./ src" >> Makefile cat Makefile.base >> Makefile diff --git a/src/be/nikiroo/fanfix/Library.java b/src/be/nikiroo/fanfix/Library.java index 9864ad7..602a25f 100644 --- a/src/be/nikiroo/fanfix/Library.java +++ b/src/be/nikiroo/fanfix/Library.java @@ -230,18 +230,26 @@ public class Library { && !path.endsWith(format)) { MetaData meta = itSupport.processMeta( file.toURI().toURL()).getMeta(); - stories.put(meta, file); - - try { - int id = Integer.parseInt(meta.getLuid()); - if (id > lastId) { - lastId = id; + if (meta != null) { + stories.put(meta, file); + try { + int id = Integer.parseInt(meta + .getLuid()); + if (id > lastId) { + lastId = id; + } + } catch (Exception e) { + // not normal!! + Instance.syserr(new IOException( + "Cannot understand the LUID of " + + file.getPath() + ": " + + meta.getLuid(), e)); } - } catch (Exception e) { + } else { // not normal!! Instance.syserr(new IOException( - "Cannot read the LUID of: " - + file.getPath(), e)); + "Cannot get metadata for: " + + file.getPath())); } } } catch (IOException e) { diff --git a/src/be/nikiroo/fanfix/supported/MangaFox.java b/src/be/nikiroo/fanfix/supported/MangaFox.java index fb72bf5..2c4c2f3 100644 --- a/src/be/nikiroo/fanfix/supported/MangaFox.java +++ b/src/be/nikiroo/fanfix/supported/MangaFox.java @@ -21,7 +21,7 @@ class MangaFox extends BasicSupport { @Override public String getSourceName() { - return "MangaFox.met"; + return "MangaFox.me"; } @Override -- 2.27.0