-
Notifications
You must be signed in to change notification settings - Fork 112
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 exception when parsing EXIF data with LONG Orientation #684
Merged
DiegoPino
merged 8 commits into
cantaloupe-project:develop
from
janhoy:TIFF-EXIF-orientation-classcast
Oct 9, 2024
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2191421
TIFF EXIF orientation fix
janhoy 565de9e
Add signed variants and log warning on unknown dataType
janhoy c6e9d67
Add tests
janhoy 8cc0389
Fix indents
janhoy 623723f
Merge branch 'develop' into TIFF-EXIF-orientation-classcast
glenrobson 86f7af4
Merge branch 'develop' into TIFF-EXIF-orientation-classcast
jcoyne a1d96f9
Merge branch 'develop' into TIFF-EXIF-orientation-classcast
janhoy 2cc413d
Add extra comments about data types
janhoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
hi @janhoy question about the
else if
. How would be thevalue instanceof Integer
if the field is already instance of Long? Is that a Java typing issue when the Value is read from EXIF? This is just me not knowing enough probably. Thanks!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.
I was also surprised by this. Looks like some bug somewhere, that the EXIF typing is long but it gets stuffed into an integer, thus causing ClassCastException. That's the kind of stuff you see in the wild even if it is not as per spec.
So we could really skip the reading of EXIF type and just check the Java type of the value, since we need to fall back to that anyway. The only value in the four switch-case clauses is to trigger the warn log msg, but it could also have been in an
else
clause afterinstanceof
checks of Long and Integer fails.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.
@janhoy it would be helpful to put those assumptions in a comment
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.
@janhoy We are quite happy with this contribution. We'd like to get this merged for an upcoming release. Are you able to add these code comments?
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.
I added three lines of java comment already about this, what execlty do you feel is unclear and could you propose additional comment text to fix it?
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.
Added these two lines:
Hope this is mergeable and will be included in next release!