commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kinow <...@git.apache.org>
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:

    https://github.com/apache/commons-imaging/pull/36#discussion_r204226858
  
    --- Diff: src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java ---
    @@ -312,7 +312,12 @@ private void dumpSegments(final List<? extends Segment> v)
{
         @Override
         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?
    
    Thanks
    Bruno


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message