[
https://issues.apache.org/jira/browse/IMAGING-246?focusedWorklogId=370404&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-370404
]
ASF GitHub Bot logged work on IMAGING-246:
------------------------------------------
Author: ASF GitHub Bot
Created on: 11/Jan/20 23:04
Start Date: 11/Jan/20 23:04
Worklog Time Spent: 10m
Work Description: kinow commented on pull request #68: [IMAGING-246] Skip
Photoshop IPTC blocks that are not recommended to be interpreted by parsers in
the specification
URL: https://github.com/apache/commons-imaging/pull/68#discussion_r365546675
##########
File path:
src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
##########
@@ -598,12 +598,12 @@ public JpegPhotoshopMetadata getPhotoshopMetadata(final
ByteSource byteSource,
final App13Segment segment = (App13Segment) s;
final PhotoshopApp13Data data =
segment.parsePhotoshopSegment(params);
- if (data != null && photoshopApp13Data != null) {
- throw new ImageReadException(
- "Jpeg contains more than one Photoshop App13
segment.");
+ if (data != null) {
+ if (photoshopApp13Data != null) {
+ throw new ImageReadException("Jpeg contains more than one
Photoshop App13 segment.");
+ }
+ photoshopApp13Data = data;
Review comment:
The logic removed had an issue, where if the first data was not null, then
the second was null; the second value would be used. Resulting in missing
photoshop APP13 data.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 370404)
Time Spent: 20m (was: 10m)
> Invalid Block Size error prevents handling of block 1084, Macintosh
> NSPrintInfo
> -------------------------------------------------------------------------------
>
> Key: IMAGING-246
> URL: https://issues.apache.org/jira/browse/IMAGING-246
> Project: Commons Imaging
> Issue Type: Bug
> Components: Format: JPEG
> Affects Versions: 1.0-alpha1
> Reporter: Liberty Wollerman
> Assignee: Bruno P. Kinoshita
> Priority: Major
> Attachments: FallHarvestKitKat_07610.jpg
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> When processing an image created on a Mac with Adobe Photoshop which contains
> embedded metadata having block 1084, an invalid block size error occurs.
> |0x043C|1084|_(Photoshop CS5)_ Macintosh NSPrintInfo. Variable OS specific
> info for Macintosh. NSPrintInfo. It is recommened that you do not interpret
> or use this data.|
>
> Here is some simple test code that replicates what our application is trying
> to do, and recreates the error:
> {code:java}
> import java.util.regex.Matcher;
> import java.util.regex.Pattern;
> public class RegexMatches {
> public static void main(String args[]) { // String to be scanned
> to find the pattern.
> String line = "This order was placed for QT3000! OK?";
> String pattern = "(.*)(\\d+)(.*)"; // Create a Pattern object
> Pattern r = Pattern.compile(pattern); // Now create matcher
> object.
> Matcher m = r.matcher(line);
> if (m.find()) {
> System.out.println("Found value: " + m.group(0));
> System.out.println("Found value: " + m.group(1));
> System.out.println("Found value: " + m.group(2));
> } else {
> System.out.println("NO MATCH");
> }
> }
> }{code}
>
> Here is the resulting error:
> {noformat}
> Exception in thread "main" org.apache.commons.imaging.ImageReadException:
> Invalid Block Size : 89562 > 65504Exception in thread "main"
> org.apache.commons.imaging.ImageReadException: Invalid Block Size : 89562 >
> 65504 at
>
> org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parseAllBlocks(IptcParser.java:318)
> at
>
> org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:119)
> at
>
> org.apache.commons.imaging.formats.jpeg.iptc.IptcParser.parsePhotoshopSegment(IptcParser.java:112)
> at
>
> org.apache.commons.imaging.formats.jpeg.segments.App13Segment.parsePhotoshopSegment(App13Segment.java:71)
> at
>
> org.apache.commons.imaging.formats.jpeg.JpegImageParser.getPhotoshopMetadata(JpegImageParser.java:599)
> at
>
> org.apache.commons.imaging.formats.jpeg.JpegImageParser.getMetadata(JpegImageParser.java:318)
> at
>
> org.apache.commons.imaging.formats.jpeg.JpegImageParser.getImageInfo(JpegImageParser.java:739)
> at org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:701) at
> org.apache.commons.imaging.Imaging.getImageInfo(Imaging.java:635) at
> Main.getMetaData(Main.java:22) at Main.main(Main.java:17){noformat}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)