Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/dependency_enforcement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# Reach out on Teams at 'Corp DevOps / Github Community' to get help.

name: "Dependency Review"
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
fail-on-scopes: runtime, development
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ public class TIFFImageMetadata extends IIOMetadata {

// package scope

public static final String SUN_EXIFParentTIFFTagSetClassName =
"com.sun.media.imageio.plugins.tiff.EXIFParentTIFFTagSet" ;

public static final String THISJAI_EXIFParentTIFFTagSetClassName =
"com.github.jaiimageio.plugins.tiff.EXIFParentTIFFTagSet";

public static final String SUN_FaxTIFFTagSetClassName =
"com.sun.media.imageio.plugins.tiff.FaxTIFFTagSet" ;

public static final String THISJAI_FaxTIFFTagSetClassName =
"com.github.jaiimageio.plugins.tiff.FaxTIFFTagSet";

public static final String SUN_BaselineTIFFTagSetClassName =
"com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet" ;

Expand Down Expand Up @@ -1512,6 +1524,8 @@ public static TIFFIFD parseIFD(Node node) throws IIOInvalidTreeException {

if(className != null) {
className = className.replace(SUN_BaselineTIFFTagSetClassName, THISJAI_BaselineTIFFTagSetClassName);
className = className.replace(SUN_FaxTIFFTagSetClassName, THISJAI_FaxTIFFTagSetClassName);
className = className.replace(SUN_EXIFParentTIFFTagSetClassName, THISJAI_EXIFParentTIFFTagSetClassName);
}

Object o = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.github.jaiimageio.impl.plugins.tiff;


import com.github.jaiimageio.plugins.tiff.BaselineTIFFTagSet;
import com.github.jaiimageio.plugins.tiff.EXIFParentTIFFTagSet;
import com.github.jaiimageio.plugins.tiff.FaxTIFFTagSet;
import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
import org.junit.Test;

import com.github.jaiimageio.impl.plugins.tiff.TIFFImageMetadata;
import org.w3c.dom.*;

import javax.imageio.metadata.IIOInvalidTreeException;

import static junit.framework.TestCase.assertEquals;

public class TIFFImageMetadataTest {

@Test
public void test_parseIFD_SUN_EXIFParentTIFFTagSetClassName() throws IIOInvalidTreeException {
Document xmlDoc = new DocumentImpl();
Element ifd = xmlDoc.createElement("TIFFIFD");
ifd.setAttribute("tagSets", TIFFImageMetadata.SUN_EXIFParentTIFFTagSetClassName);

TIFFIFD tiffIfd = TIFFImageMetadata.parseIFD(ifd);

assertEquals(1, tiffIfd.getTagSetList().size());
assertEquals(EXIFParentTIFFTagSet.class.getName(), tiffIfd.getTagSetList().get(0).getClass().getName());
}

@Test
public void test_parseIFD_SUN_FaxTIFFTagSetClassName() throws IIOInvalidTreeException {
Document xmlDoc = new DocumentImpl();
Element ifd = xmlDoc.createElement("TIFFIFD");
ifd.setAttribute("tagSets", TIFFImageMetadata.SUN_FaxTIFFTagSetClassName);

TIFFIFD tiffIfd = TIFFImageMetadata.parseIFD(ifd);

assertEquals(1, tiffIfd.getTagSetList().size());
assertEquals(FaxTIFFTagSet.class.getName(), tiffIfd.getTagSetList().get(0).getClass().getName());
}

@Test
public void test_parseIFD_SUN_BaselineTIFFTagSetClassName() throws IIOInvalidTreeException {
Document xmlDoc = new DocumentImpl();
Element ifd = xmlDoc.createElement("TIFFIFD");
ifd.setAttribute("tagSets", TIFFImageMetadata.SUN_BaselineTIFFTagSetClassName);

TIFFIFD tiffIfd = TIFFImageMetadata.parseIFD(ifd);

assertEquals(1, tiffIfd.getTagSetList().size());
assertEquals(BaselineTIFFTagSet.class.getName(), tiffIfd.getTagSetList().get(0).getClass().getName());
}

}