-
Notifications
You must be signed in to change notification settings - Fork 78
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
REFACT - PDF Module error messages #347
Conversation
- added ID location markers for all PDF module error messages; - moved messages exclusively for logger use to a different class;
- corrected message typos and improved consistency of terms; - corrected constant name typos;
- tidied use of generics and construction for `PdfDictionary`;
…IOException` in constructor; - `Destinations`: tidied instance construction; - `Destinations`: factored out indirect object resolution;
- `DocNode`: removed debug code; - `DocNode`: `getMediaBox()` now returns null when no meida box is found as documented;
- explicit types for generic declarations; - removed associated and unnecessary casts; and - added missing `@Override` annotations.
- added markers for all error numbers; - reviewed and documented errors (in spreadsheet for wiki); - removed unthrown exceptions in method definitions; - removed unused variables and code; - changed some private method names to be more descriptive of function; - explicit types for generic declarations; - removed associated and unnecessary casts; and - added missing `@Override` annotations.
- added markers for all error numbers; - factored out some repetetive patterns; - removed unused variables and code; - changed some private method names to be more descriptive of function; - explicit types for generic declarations; - removed associated and unnecessary casts; and - added missing `@Override` annotations.
- added markers for all error numbers; - simplified file specification handling; - removed unused variables and code; - explicit types for generic declarations; and - removed associated and unnecessary casts.
- added markers for all error numbers; - `int` constants for recursion limits; - factored out object stream handling; - small simplification to page label sequence handling; - removed unthrown exceptions, unused variables and unused code; - explicit types for generic declarations; and - removed associated and unnecessary casts.
Codecov Report
@@ Coverage Diff @@
## integration #347 +/- ##
=================================================
+ Coverage 44.48% 44.49% +<.01%
- Complexity 3415 3418 +3
=================================================
Files 368 368
Lines 30321 30269 -52
Branches 5987 5979 -8
=================================================
- Hits 13489 13468 -21
+ Misses 14423 14395 -28
+ Partials 2409 2406 -3
Continue to review full report at Codecov.
|
@@ -1550,7 +1533,7 @@ else if ("f".equals(keyval)) { | |||
} | |||
else { | |||
throw new PdfMalformedException | |||
(MessageConstants.ERR_XREF_TABLE_OPERATOR_ILLEGAL, | |||
(MessageConstants.ERR_XREF_TABLE_OPERATOR_ILLEGAL, // PDF-HUL-83 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDF-HUL-84
@@ -831,7 +815,7 @@ public final void parse(RandomAccessFile raf, RepInfo info) | |||
} | |||
// Beware infinite loop on badly broken file | |||
if (_startxref == _prevxref) { | |||
info.setMessage(new ErrorMessage(MessageConstants.ERR_XREF_TABLES_BROKEN, | |||
info.setMessage(new ErrorMessage(MessageConstants.ERR_XREF_TABLES_BROKEN, // {PDF-HUL-134 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra "{"
MessageConstants.ERR_DOC_CAT_NOT_SIMPLE)) { | ||
MessageConstants.ERR_DOC_CAT_TYPE_INVALID, // PDF-HUL-141 | ||
MessageConstants.ERR_DOC_CAT_NO_TYPE, // PDF-HUL-142 | ||
MessageConstants.ERR_DOC_CAT_NOT_SIMPLE)) { // PDF-HUL-142 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDF-HUL-143?
@@ -3021,7 +2962,7 @@ protected Property buildPageProperty(PageObject page, | |||
// but we do report that we don't report them. | |||
if (!_skippedAnnotationsReported) { | |||
info.setMessage(new InfoMessage | |||
(annotationsSkippedString)); | |||
(MessageConstants.INF_ANNOTATIONS_SKIPPED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDF-HUL-115
@@ -2943,7 +2884,7 @@ protected void addPagesProperty(List<Property> metadataList, RepInfo info) | |||
else { | |||
if (!_skippedPagesReported) { | |||
info.setMessage(new InfoMessage | |||
(pagesSkippedString)); | |||
(MessageConstants.INF_PAGES_SKIPPED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDF-HUL-112
@@ -96,7 +94,7 @@ public Token getNext (long max) throws IOException, PdfException | |||
else if (tok instanceof DictionaryEnd) { | |||
--_dictDepth; | |||
if (_dictDepth < 0) { | |||
throw new PdfMalformedException (MessageConstants.ERR_DICT_DELIMETERS_IMPROPERLY_NESTED); | |||
throw new PdfMalformedException (MessageConstants.ERR_DICT_DELIMITERS_IMPROPERLY_NESTED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDF-HUL-33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, am thinking of adding a consistency check for errors in unit tests, but this is why adding an error number to the message soon is a good idea. Then the compiler takes care of it.
- fixed message id marker comments. Thanks to @david-russo
…jhove into refact/pdf-module-messages
@Override
annotations.