Piotr Karwasz created IMAGING-406:
-------------------------------------

             Summary: Imaging.getIccProfile throws IllegalArgumentException for 
an ICC profile rejected by the JDK
                 Key: IMAGING-406
                 URL: https://issues.apache.org/jira/browse/IMAGING-406
             Project: Commons Imaging
          Issue Type: Bug
          Components: imaging.icc.*
    Affects Versions: 1.0.0-alpha6
            Reporter: Piotr Karwasz


{{Imaging.getIccProfile(ByteSource)}} extracts the embedded profile bytes, 
parses them with {{IccProfileParser}}, and returns 
{{ICC_Profile.getInstance(bytes)}} without handling its 
{{IllegalArgumentException}}. A profile that {{IccProfileParser}} accepts but 
the JDK rejects (for example an inconsistent tag table) therefore makes 
{{Imaging.getIccProfile(File | byte[] | InputStream, String)}}, and indirectly 
{{ColorTools.correctImage}}, throw an undeclared {{IllegalArgumentException}} 
instead of an {{ImagingException}}.

{{PngImageParser.getBufferedImage}} already wraps the same call: {{throw new 
ImagingException("The image data does not correspond to a valid ICC Profile", 
iae)}}.

Suggested fix: wrap the {{IllegalArgumentException}} from 
{{ICC_Profile.getInstance}} in an {{ImagingException}} in 
{{Imaging.getIccProfile}} as well.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to