Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error PKG-1 when file not found #149

Closed
maria-messerschmidt opened this issue Apr 11, 2024 · 6 comments · Fixed by #158
Closed

Error PKG-1 when file not found #149

maria-messerschmidt opened this issue Apr 11, 2024 · 6 comments · Fixed by #158
Assignees
Labels
bug Something isn't working

Comments

@maria-messerschmidt
Copy link

When the validator is executed, and the file is not found, an error is thrown. But the error message is:

PKG-1: alm.ods [ERROR] An OpenDocument Package shall be a well formed Zip Archive.
POL-2: alm.ods [ERROR] Standard Compliance | The file MUST comply with the standard "OASIS Open Document Document Format for Office Applications (OpenDocument) v1.3".

This is somewhat misleading when the file does in fact not exist.

@carlwilson
Copy link
Member

Hi @maria-messerschmidt I'll look at this soon, I assume it's when the CLI app is used. I'd agree that a clear message should be sent when either:

  • the file doesn't exist, with a warning to that effect; and
  • if the passed path exists but is a directory, with a warning to that effect.

I'll look to produce a candidate fix for next week if you concur.

@maria-messerschmidt
Copy link
Author

Thanks! Let me get back to you tomorrow. I managed to get a "File does not exist" error, so I need to figure out under what circumstances it works and doesn't work.

@maria-messerschmidt
Copy link
Author

Ok, so this only happens, when I run the validator with -p (but of course, I use that in most cases). I think the error produced when running it without -p is fine, it just needs to also produce the error when running with -p.

C:\odf\odf-validator-main>odf-validator.bat "filer/testfiler/xxx.ods"
APP-1: [INFO] Validating filer\testfiler\xxx.ods.
APP-2: [ERROR] Supplied Path parameter: filer\testfiler\xxx.ods does not exist.

C:\odf\odf-validator-main>odf-validator.bat -p filer/testfiler/xxx.ods"
APP-1: [INFO] Validating filer\testfiler\xxx.ods.
APP-5: [INFO] DNA ODF Spreadsheets Preservation Specification Profile report for filer\testfiler\xxx.ods.
PKG-1: xxx.ods [ERROR] An OpenDocument Package SHALL be a well formed Zip Archive.
POL_2: xxx.ods [ERROR] Standard Compliance | The file MUST comply with the standard "OASIS Open Document Format for Office Applications (OpenDocument) v1.3".
NOT VALID, 2 errors, 0 warnings and 0 info messages.

@carlwilson
Copy link
Member

OK, that looks a straightforward fix, and possibly a little refactor to get the option thing in line.

@carlwilson
Copy link
Member

Hi @maria-messerschmidt there is now a PR that fixes this issue. If you want to take a look and test its #158

@carlwilson carlwilson self-assigned this May 8, 2024
@carlwilson carlwilson added the bug Something isn't working label May 8, 2024
@maria-messerschmidt
Copy link
Author

Fix is working for this issue. I now get the same error message whether I run it with or without -p.

C:\odf\odf-validator-fix-missing-file-profile>odf-validator.bat -p testfiler/T001.ods
APP-1: [INFO] Validating testfiler\T001.ods.
APP-2: [ERROR] Supplied Path parameter: testfiler\T001.ods does not exist.

C:\odf\odf-validator-fix-missing-file-profile>odf-validator.bat testfiler/T001.ods
APP-1: [INFO] Validating testfiler\T001.ods.
APP-2: [ERROR] Supplied Path parameter: testfiler\T001.ods does not exist.

I can see in the changes to CliValidator that you aligned the checks for with/without profile for the FileNotFound exception. But I noticed that the IOException (which was moved to line 82) is not identical to the equivalent line for running the validator without the profile (line 71) which contains three exceptions (ParserConfigurationException | SAXException | IOException). I have not managed to trigger any of these exceptions, but I was wondering whether there is a reason for the discrepancy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants