kriegaex / Galileo-Openbook-Cleaner

HTML cleaner for Galileo Computing's openbooks, implemented in Java
Other
64 stars 6 forks source link

Book 'java_insel' yields an exception due to an invalid MD5 check sum #24

Closed sebers closed 10 years ago

sebers commented 10 years ago

I tried to process 'java_insel' using the precompiled version downloaded from your download section.

java -jar galileo_openbook_cleaner-1.0.1.jar java_insel

The initial fails (please see the stack trace below) due to an invalid MD5 check sum. However, when using the exact call again with the previously downloaded zip file in the specified download folder, the conversion works as expected.

    1   Book: java_insel
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: de.scrum_master.util.FileDownloader$MD5MismatchException: ./galileocomputing_javainsel.zip: expected 3f7fa5da11cbec50e9a2f4c7952f0499, got dbf5dd60502be22fd0ac42d44584309f
    at de.scrum_master.util.FileDownloader.download(FileDownloader.java:101)
    at de.scrum_master.galileo.Downloader.downloadBook(Downloader.java:48)
    at de.scrum_master.galileo.Downloader.download_aroundBody0(Downloader.java:37)
    at de.scrum_master.galileo.Downloader.download_aroundBody1$advice(Downloader.java:30)
    at de.scrum_master.galileo.Downloader.download(Downloader.java:37)
    at de.scrum_master.galileo.OpenbookCleaner.downloadAndCleanBook_aroundBody2(OpenbookCleaner.java:51)
    at de.scrum_master.galileo.OpenbookCleaner.downloadAndCleanBook_aroundBody3$advice(OpenbookCleaner.java:23)
    at de.scrum_master.galileo.OpenbookCleaner.downloadAndCleanBook_aroundBody4(OpenbookCleaner.java:1)
    at de.scrum_master.galileo.OpenbookCleaner.downloadAndCleanBook_aroundBody5$advice(OpenbookCleaner.java:18)
    at de.scrum_master.galileo.OpenbookCleaner.downloadAndCleanBook(OpenbookCleaner.java:1)
    at de.scrum_master.galileo.OpenbookCleaner.main_aroundBody0(OpenbookCleaner.java:29)
    at de.scrum_master.galileo.OpenbookCleaner.main_aroundBody1$advice(OpenbookCleaner.java:12)
    at de.scrum_master.galileo.OpenbookCleaner.main(OpenbookCleaner.java:1)
kriegaex commented 10 years ago

The current version is 1.1.0, not 1.0.1. Sometimes Galileo Press updates existing books which leads to changed download archives and thus changed MD5 checksums. In these cases there will be an error message like yours, but not for the _javainsel book because version 1.1.0 already contains the latest checksum.

Furthermore, the behaviour that the program exits after the exception is intended because an MD5 checksum mismatch could also be a result of an interrupted download. So it is up to you to restart the unpacking and cleaning process on a book with an unexpected checksum. There might also be incompatible changes in the book which lead to problems in cleaning the HTML code. If you are sure that the result is okay and want to avoid the same error message next time you download the book, you can run the program with the --write-config or -w parameter so as to create a config.xml file in which you can edit the checksum manually and make it match what is on the Galileo Press download server. So you have several options.

Having said that, I think I should make the error message for MD5 check mismatch more user-friendly and add some explanatory text in the next version.

sebers commented 10 years ago

I am sorry, that was really stupid

kriegaex commented 10 years ago

No, actually that was ticket no. 4 asking a similar question, which shows to me that I need to do something in that area to make it more user-friendly. So I am the stupid one here, assuming that everyone else would understand the reason for the MD5 mismatch just like I do because I wrote the program for myself. I do not have much time to maintain it now, but I created an enhancement ticket anyway. Maybe next time I feel bored I can change it and release a new version.

sebers commented 10 years ago

I perfectly understood the error message and its reason.

However, I now know why I downloaded the wrong version. On your German description page [1] you provide a link to a download section [2] where version 1.0.1 is the latest one. Since 1.0.1 and 1.1.0 looks quite similar (if you do not look too closely), I ended up with an old version.

Another reason for opening the ticket was that I was amazed that the application's behavior depends on whether you downloaded the book in the first step or not. Since this could indicate a bug, I opened the ticket.

Anyhow, thanks for your effort. Your application was exactly what I was looking for!

[1] https://github.com/kriegaex/Galileo-Openbook-Cleaner/wiki/Galileo-Openbook-Cleaner [2] https://github.com/kriegaex/Galileo-Openbook-Cleaner/downloads

kriegaex commented 10 years ago

Thanks for the hint. I changed the wiki. Unfortunately GitHub no longer supports uploading new files, so the download section is obsolete. This is why nowadays I provide download links in the README on the main page.