Read in the full IPTC block before trying to ignore it,
so we don't lose our position in the stream.
Also added a test image that shows the problem.

Submitted by: Alex Vigdor <Alex dot Vigdor at abc dot com>
Jira issue key: SANSELAN-35



git-svn-id: https://svn.apache.org/repos/asf/commons/proper/sanselan/trunk@1224687 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
index 653d072..2517259 100644
--- a/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
+++ b/src/main/java/org/apache/commons/sanselan/formats/jpeg/iptc/IptcParser.java
@@ -156,9 +156,6 @@
                 Debug.debug("recordNumber", recordNumber + " (0x"
                         + Integer.toHexString(recordNumber) + ")");
 
-            if (recordNumber != IPTC_APPLICATION_2_RECORD_NUMBER)
-                continue;
-
             // int recordPrefix = convertByteArrayToShort("recordPrefix", index,
             // bytes);
             // if (verbose)
@@ -201,6 +198,9 @@
 
             // Debug.debug("recordSize", recordSize + " (0x"
             // + Integer.toHexString(recordSize) + ")");
+            
+            if (recordNumber != IPTC_APPLICATION_2_RECORD_NUMBER)
+                continue;
 
             if (recordType == 0)
             {
diff --git a/src/test/data/images/jpg/5/2010-01-04T052300Z_01_BTRE6021PS000_RTROPTP_3_BUSINESS-US-TSE.JPG b/src/test/data/images/jpg/5/2010-01-04T052300Z_01_BTRE6021PS000_RTROPTP_3_BUSINESS-US-TSE.JPG
new file mode 100644
index 0000000..3070f42
--- /dev/null
+++ b/src/test/data/images/jpg/5/2010-01-04T052300Z_01_BTRE6021PS000_RTROPTP_3_BUSINESS-US-TSE.JPG
Binary files differ
diff --git a/src/test/data/images/jpg/5/info.txt b/src/test/data/images/jpg/5/info.txt
new file mode 100644
index 0000000..f3e023e
--- /dev/null
+++ b/src/test/data/images/jpg/5/info.txt
@@ -0,0 +1,2 @@
+2010-01-04T052300Z_01_BTRE6021PS000_RTROPTP_3_BUSINESS-US-TSE.JPG
+Submitted by Alex Vigdor on SANSELAN-35. Demonstrates an IPTC parsing bug in Sanselan.