openpreserve / jpylyzer

JP2 (JPEG 2000 Part 1) validator and properties extractor. Jpylyzer was specifically created to check that a JP2 file really conforms to the format's specifications. Additionally jpylyzer is able to extract technical characteristics.
http://jpylyzer.openpreservation.org/
Other
69 stars 28 forks source link

Crash for 18th Century "last modified" date #82

Closed bitsgalore closed 8 years ago

bitsgalore commented 8 years ago

I have a file whose last modified date is ‎01 ‎January ‎1768, ‏‎00:01:00 (don't even ask!). This results in a ValueError:

E:\testjp2hecker>f:\johan\pythoncode\jpylyzer\jpylyzer\jpylyzer.py test.xml
<?xml version='1.0' encoding='UTF-8'?>
Traceback (most recent call last):
  File "F:\johan\pythoncode\jpylyzer\jpylyzer\jpylyzer.py", line 683, in <module
>
    main()
  File "F:\johan\pythoncode\jpylyzer\jpylyzer\jpylyzer.py", line 679, in main
    checkFiles(args.inputRecursiveFlag, args.inputWrapperFlag, jp2In)
  File "F:\johan\pythoncode\jpylyzer\jpylyzer\jpylyzer.py", line 605, in checkFi
les
    xmlElement = checkOneFile(path)
  File "F:\johan\pythoncode\jpylyzer\jpylyzer\jpylyzer.py", line 329, in checkOn
eFile
    "fileLastModified", time.ctime(os.path.getmtime(file)))
ValueError: unconvertible time

Issue only happens under Windows (7); Linux (Mint) works fine.

Solution: add exception handler for this ValueError and/or impose lower limit on dates.

bitsgalore commented 8 years ago

Fix here: https://github.com/openpreserve/jpylyzer/commit/e0caaa4ef70c86b8276cf44170a74b0831997b3f