commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kinow <>
Subject [GitHub] commons-imaging pull request #36: Avoid jpeg parse fail due to jfxx and exif
Date Sun, 22 Jul 2018 03:14:52 GMT
Github user kinow commented on a diff in the pull request:
    --- Diff: src/main/java/org/apache/commons/imaging/formats/jpeg/ ---
    @@ -312,7 +312,12 @@ private void dumpSegments(final List<? extends Segment> v)
         public ImageMetadata getMetadata(final ByteSource byteSource, final Map<String,
Object> params)
                 throws ImageReadException, IOException {
    -        final TiffImageMetadata exif = getExifMetadata(byteSource, params);
    +        TiffImageMetadata exif = null;
    +        try {
    +            exif = getExifMetadata(byteSource, params);
    +        } catch (Exception e) {
    +            // exif parse failed.
    +        }
    --- End diff --
    I think we should still fail here. Other parsers such as the `TiffImageParser` fail, so
`JpegImageParser` not throwing an exception would be wrong.
    Also, not even logging the exception can cause problems to users of the API that would
have to debug the code to understand why they were not seeing the EXIF metadata, just to find
an exception that was not propagated.
    The rest of the code looks good. Would you be able to provide at least one unit tests
for your code @hyunuck, please?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message