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

FIX - PDF minor version number checking. #317

Merged
merged 10 commits into from
Mar 28, 2018
Merged

Conversation

carlwilson
Copy link
Member

  • added test for invalid minor version number;
  • added MessageConstant for invalid minor version;
  • bumped PDF Module release details for release candidate;
  • refactored PdfHeader class;
  • JavaDoc for PdfHeader;
  • unit tests and test resources for PdfHeader;
  • added JHOVE RC PDF Module details to baseline; and
  • improved result logging for Travis tests.
    Closes PDF version checking not correct #207

- added test for invalid minor version number;
- added MessageConstant for invalid minor version;
- bumped PDF Module release details for release candidate;
- refactored `PdfHeader` class;
- JavaDoc for `PdfHeader`;
- unit tests and test resources for `PdfHeader`;
- added JHOVE RC PDF Module details to baseline; and
- improved result logging for Travis tests.
Closes #207
@codecov
Copy link

codecov bot commented Mar 16, 2018

Codecov Report

Merging #317 into integration will increase coverage by 0.05%.
The diff coverage is 72.46%.

Impacted file tree graph

@@                Coverage Diff                @@
##             integration     #317      +/-   ##
=================================================
+ Coverage          43.47%   43.52%   +0.05%     
- Complexity          3308     3321      +13     
=================================================
  Files                366      367       +1     
  Lines              30123    30148      +25     
  Branches            5959     5962       +3     
=================================================
+ Hits               13096    13122      +26     
+ Misses             14630    14627       -3     
- Partials            2397     2399       +2
Impacted Files Coverage Δ Complexity Δ
...ard/hul/ois/jhove/module/pdf/MessageConstants.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...va/edu/harvard/hul/ois/jhove/module/PdfModule.java 70.7% <100%> (+0.52%) 280 <4> (+2) ⬆️
...du/harvard/hul/ois/jhove/module/pdf/PdfHeader.java 67.24% <67.24%> (ø) 11 <11> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 959edd8...4e1a9fe. Read the comment docs.

@carlwilson carlwilson self-assigned this Mar 16, 2018
@carlwilson carlwilson added this to the Release v1.20 milestone Mar 16, 2018
_pdfACompliant = false;
}
return true;
if (!header.isVersionValid()) {
Copy link
Member

@david-russo david-russo Mar 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed indentation white-space.

@@ -0,0 +1,184 @@
/**
*
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Javadoc.

try {
minorVersion = getMinorVersion(this.versionString);
} catch (NumberFormatException nfe) {
// TODO : Do nothing for now, the version number is still invalid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Nothing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The aim is to not break existing behaviour. This ensures that this case is handled as before as the minor version number is set too large and false is returned. I've left the TODO as I'm intending to polish this a little more, but it needs a new error messages and is outside of the PR scope.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if in the long term view it is as easy as thinking about the minor version not being set too large, especially with PDF 2.0 now available. Couldn't it be instead checking the versionString against a list of currently available versions? So, as of today: 1.0, 1.1, 1.2, 1.3, ,1.4, 1.5., 1.6, 1.7, 2.0 ?
Downside is that the list of available versions would have to be updated everytime a new version becomes available - but if the code instead states that the max correct minor version is 7, which is true for PDF 1.x, it would have to still be updated regarding the limitation of minor version for 2.x as there currently only is 2.0 (and this would again have to be updated once 2.1 becomes available).
Does that make any sense?

@@ -0,0 +1,101 @@
/**
*
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty Javadoc.

carlwilson and others added 3 commits March 28, 2018 22:18
- replaced inconistent tabs with spaces; and
- removed empty JavaDoc headers.
Thanks to @david-russo for review.
Fixed the header JavaDoc generation on my IDE now also.
@carlwilson carlwilson merged commit 3d44106 into integration Mar 28, 2018
@carlwilson carlwilson deleted the fix/pdf-header branch March 28, 2018 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants