#368 related clean-up

This commit is contained in:
Harald Kuhr 2018-01-17 18:27:33 +01:00
parent 3f06bbee99
commit 2b29c14593
3 changed files with 15 additions and 14 deletions

View File

@ -120,7 +120,6 @@ public final class TIFFReader extends MetadataReader {
List<Entry> entries = new ArrayList<>();
pInput.seek(pOffset);
long nextOffset = -1;
long entryCount = readEntryCount(pInput);
@ -138,7 +137,8 @@ public final class TIFFReader extends MetadataReader {
}
if (readLinked) {
if (nextOffset == -1) {
long nextOffset;
try {
nextOffset = readOffset(pInput);
}
@ -146,16 +146,17 @@ public final class TIFFReader extends MetadataReader {
// catch EOF here as missing EOF marker
nextOffset = 0;
}
}
// Read linked IFDs
if (nextOffset != 0) {
CompoundDirectory next = (CompoundDirectory) readDirectory(pInput, nextOffset, true);
for (int i = 0; i < next.directoryCount(); i++) {
if(next.getDirectory(i).size() > 0) {
// Linked directories might be empty if nextOffset is after EOF, so skip them
ifds.add((IFD) next.getDirectory(i));
Directory directory = next.getDirectory(i);
// Linked directories might be empty if nextOffset is after EOF (skip these)
if (directory.size() > 0) {
ifds.add((IFD) directory);
}
}
}

View File

@ -192,7 +192,7 @@ public class EXIFReaderTest extends MetadataReaderAbstractTest {
assertNotNull(exif);
assertEquals(23, exif.size());
// The interop IFD is empty (entry count is 0)
// The interop IFD with two values
Directory interop = (Directory) exif.getEntryById(TIFF.TAG_INTEROP_IFD).getValue();
assertNotNull(interop);
assertEquals(2, interop.size());

View File

@ -206,7 +206,7 @@ public class TIFFReaderTest extends MetadataReaderAbstractTest {
assertNotNull(exif);
assertEquals(23, exif.size());
// The interop IFD is empty (entry count is 0)
// The interop IFD with two values
Directory interop = (Directory) exif.getEntryById(TIFF.TAG_INTEROP_IFD).getValue();
assertNotNull(interop);
assertEquals(2, interop.size());