Skip to content

Commit

Permalink
Merge branch 'integration' into issue887-javax.json_to_jakarta.json
Browse files Browse the repository at this point in the history
  • Loading branch information
carlwilson authored Mar 4, 2024
2 parents 21de10e + 44060dc commit 1fbf947
Show file tree
Hide file tree
Showing 21 changed files with 213 additions and 99 deletions.
5 changes: 0 additions & 5 deletions jhove-apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
<artifactId>jhove-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ private DefaultMutableTreeNode nisoToNode(NisoImageMetadata niso) {
"NisoImageMetadata", true);
String s = niso.getMimeType();
if (s != null) {
val.add(new DefaultMutableTreeNode("MIMEType: " + s, false));
val.add(new DefaultMutableTreeNode("FormatName: " + s, false));
}
s = niso.getByteOrder();
if (s != null) {
Expand Down Expand Up @@ -1274,6 +1274,10 @@ private DefaultMutableTreeNode nisoToNode(NisoImageMetadata niso) {
for (int i = 0; i < iarray.length; i++) {
nod.add(new DefaultMutableTreeNode(Integer.toString(iarray[i]),
false));
//BitsPerSampleUnit Integer is assumed, because of BitsPerSample
// According to the specification, it can also be float.
// This is currently not supported by jHove
nod.add(new DefaultMutableTreeNode("Integer"));
}
}
if ((n = niso.getSamplesPerPixel()) != NisoImageMetadata.NULL) {
Expand Down
2 changes: 1 addition & 1 deletion jhove-bbt/scripts/bbt-jhove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ showHelp() {
checkParams "$@"
candidate="${paramOutputLoc:?}/${MAJOR_MINOR_VER}"
tempInstallLoc="/tmp/to-test"
sed -i 's/^java.*/java -javaagent:${HOME}\/\.m2\/repository\/org\/jacoco\/org\.jacoco\.agent\/0.8.10\/org\.jacoco.agent-0\.8\.10-runtime\.jar=destfile=jhove-apps\/target\/jacoco\.exec -Xss2048k -classpath "$CP" edu.harvard.hul.ois.jhove.Jhove -c "${CONFIG}" "${@}"/g' "${tempInstallLoc}/jhove"
sed -i 's/^java.*/java -javaagent:${HOME}\/\.m2\/repository\/org\/jacoco\/org\.jacoco\.agent\/0.8.11\/org\.jacoco.agent-0\.8\.11-runtime\.jar=destfile=jhove-apps\/target\/jacoco\.exec -Xss2048k -classpath "$CP" edu.harvard.hul.ois.jhove.Jhove -c "${CONFIG}" "${@}"/g' "${tempInstallLoc}/jhove"
bash "$SCRIPT_DIR/baseline-jhove.sh" -j "${tempInstallLoc}" -c "${paramCorpusLoc}" -o "${candidate}"

if [[ -f "${SCRIPT_DIR}/create-${MAJOR_MINOR_VER}-target.sh" ]]
Expand Down
3 changes: 3 additions & 0 deletions jhove-bbt/scripts/create-1.29-target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ echo "TEST BASELINE: Creating baseline"
# Simply copy baseline for now we're not making any changes
echo " - copying ${baselineRoot} baseline to ${targetRoot}"
cp -R "${baselineRoot}" "${targetRoot}"

# Update release details for ePub module
find "${targetRoot}" -type f -name "audit.jhove.xml" -exec sed -i 's/^ <module release="1.2">EPUB-ptc<\/module>$/ <module release="1.3">EPUB-ptc<\/module>/' {} \;
10 changes: 7 additions & 3 deletions jhove-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.14</version>
<version>3.15.8</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions jhove-ext-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<properties>
<jwat.version>1.0.3</jwat.version>
<epubcheck.version>4.2.6</epubcheck.version>
<epubcheck.version>5.1.0</epubcheck.version>
</properties>

<build>
Expand Down Expand Up @@ -58,8 +58,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<!-- JWAT for WARC, ARC and GZIP -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ public class EpubModule extends ModuleBase {
private static final String FORMATNAME = "EPUB";

private static final String NAME = "EPUB-ptc";
private static final String RELEASE = "1.2";
private static final int[] DATE = { 2023, 03, 16 };
private static final String RIGHTS_YEAR = "2019";
private static final String RELEASE = "1.3";
private static final int[] DATE = { 2023, 06, 12 };
private static final String RIGHTS_YEAR = "2023";
private static final String[] FORMAT = { FORMATNAME };
private static final String COVERAGE = FORMATNAME;
private static final String[] MIMETYPE = { EPUB_MEDIATYPE };
Expand All @@ -94,18 +94,18 @@ public class EpubModule extends ModuleBase {
private static final String NOTE = "This module uses EPUBCheck for testing of EPUB files.";

// EPUB agent information
private static final String EPUB_AGENTNAME = "International Digital Publishing Forum";
private static final String EPUB_AGENTNAME = "International Digital Publishing Forum and World Wide Web Consortium";
private static final AgentType EPUB_AGENTTYPE = AgentType.STANDARD;
private static final String EPUB_AGENTADDRESS = "International Digital Publishing Forum (IDPF), "
+ "113 Cherry Street, Suite 70-719, Seattle, WA 98104";
private static final String EPUB_AGENTWEBSITE = "http://idpf.org";
private static final String EPUB_AGENTEMAIL = "membership@idpf.org";
private static final String EPUB_AGENTPHONE = "+1-206-451-7250";
private static final String EPUB_AGENTADDRESS = "W3C Inc, "
+ "401 Edgewater Place, Suite 600, Wakefield, MA 01880, USA";
private static final String EPUB_AGENTWEBSITE = "https://www.w3.org/";
private static final String EPUB_AGENTEMAIL = "membership@w3.org";
private static final String EPUB_AGENTPHONE = "+1-339-273-2711";

// EPUB format doc information
private static final String EPUB_FORMATDOCTITLE = FORMATNAME;
private static final String EPUB_FORMATDOCDATE = "2019-05-15";
private static final String EPUB_FORMATDOCURL = "http://www.idpf.org/epub/dir/";
private static final String EPUB_FORMATDOCDATE = "2023-05-25";
private static final String EPUB_FORMATDOCURL = "https://www.w3.org/TR/epub/";

// Signatures
private static final String EPUB_EXTENSION = ".epub";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public class JhoveRepInfoReport extends MasterReport {
protected static final String ISO_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";
protected static final String FALLBACK_FORMAT = "application/octet-stream";

protected static final String FRAGMENT_START = "#";

public JhoveRepInfoReport(String ePubName) {
this.setEpubFileName(PathUtil.removeWorkingDirectory(ePubName));

Expand Down Expand Up @@ -146,7 +148,8 @@ public void info(String resource, FeatureEnum feature, String value) {
this.references.add(value);
break;
case RESOURCE:
this.resources.add(value);
String no_fragment = value.split(FRAGMENT_START)[0];
this.resources.add(no_fragment);
break;
case DC_LANGUAGE:
this.language = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class EpubModuleTest {
private static final String EPUB3_TITLE_ENCODING = "src/test/resources/epub/epub3-multiple-renditions.epub";

private static final String EXPECTED_MEDIATYPE = "application/epub+zip";
private static final String EXPECTED_VERSION_3_2 = "3.2";
private static final String EXPECTED_VERSION_3_3 = "3.3";
private static final String PNG_MIMETYPE = "image/png";
private static final String XHTML_MIMETYPE = "application/xhtml+xml";
private static final String NCX_MIMETYPE = "application/x-dtbncx+xml";
Expand All @@ -99,9 +99,11 @@ public void parseValidEpub3PropertiesTest() throws Exception {
assertEquals(0, info.getMessage().size()); // no errors
assertEquals("EPUB", info.getFormat());
assertEquals(EXPECTED_MEDIATYPE, info.getMimeType());
assertEquals(EXPECTED_VERSION_3_2, info.getVersion());
assertEquals(EXPECTED_VERSION_3_3, info.getVersion());
// these may change, so just check they aren't null
assertNotNull(info.getCreated());
// note: this property is missing in 5.1.0 of epubcheck but
// due for fix in next maintence release, uncomment when fixed.
//assertNotNull(info.getCreated());
assertNotNull(info.getLastModified());

Property metadata = info.getProperty(EPUBMETADATA_KEY);
Expand Down Expand Up @@ -248,7 +250,9 @@ public void parseValidEpub2PropertiesTest() throws Exception {
assertEquals(EXPECTED_MEDIATYPE, info.getMimeType());
assertEquals("2.0.1", info.getVersion());
// may change, so just check it isn't null
assertNotNull(info.getCreated());
// note: this property is missing in 5.1.0 of epubcheck but
// due for fix in next maintence release, uncomment when fixed.
//assertNotNull(info.getCreated());

Property metadata = info.getProperty(EPUBMETADATA_KEY);
Map<String, Object> props = toMap(metadata);
Expand Down Expand Up @@ -397,7 +401,7 @@ public void parseImproperlyCompressedEpubTest() throws Exception {
File epubFile = new File(ZIPPED_EPUB_FILEPATH);
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.FALSE, RepInfo.FALSE);
assertEquals(EXPECTED_MEDIATYPE, info.getMimeType());
assertEquals(EXPECTED_VERSION_3_2, info.getVersion());
assertEquals(EXPECTED_VERSION_3_3, info.getVersion());
assertEquals(1, info.getMessage().size());
assertEquals("PKG-006", info.getMessage().get(0).getId());
}
Expand Down Expand Up @@ -425,7 +429,7 @@ public void parseNonEpubTest() throws Exception {
File epubFile = new File(WRONG_EXT_NOT_AN_EPUB_FILEPATH);
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.FALSE, RepInfo.FALSE);
List<Message> msgs = info.getMessage();
final int expectedNumMessages = 3;
final int expectedNumMessages = 2;
assertEquals(expectedNumMessages, msgs.size());
}

Expand All @@ -451,7 +455,7 @@ public void parseNonEpubWithEpubExtensionTest() throws Exception {
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.FALSE, RepInfo.FALSE);
assertEquals(OCTET_MIMETYPE, info.getMimeType());
List<Message> msgs = info.getMessage();
final int expectedNumMessages = 3;
final int expectedNumMessages = 2;
assertEquals(expectedNumMessages, msgs.size());
}

Expand Down Expand Up @@ -508,7 +512,7 @@ public void parseEpubWithMissingFontsTest() throws Exception {
Map<String, Object> fontinfo = new HashMap<String, Object>();
font.forEach(f -> fontinfo.put(f.getName(), f.getValue()));

// only one font in this file, listed but missing.
// a single font file is listed - it is supposed to be embedded but is missing.
assertEquals("Courier", fontinfo.get(PROPNAME_FONTNAME));
assertEquals(true, fontinfo.get(PROPNAME_FONTFILE));

Expand Down Expand Up @@ -579,18 +583,12 @@ public void parseEpubMissingOpfTest() throws Exception {
File epubFile = new File(EPUB2_MISSING_OPF_FILEPATH);
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.FALSE, RepInfo.FALSE);

assertEquals(OCTET_MIMETYPE, info.getMimeType());

Set<String> msgCodes = new HashSet<String>();
assertEquals(2, info.getMessage().size());
Message msg1 = info.getMessage().get(0);
Message msg2 = info.getMessage().get(1);
assertTrue(msg1 instanceof ErrorMessage);
msgCodes.add(msg1.getId());
assertTrue(msg2 instanceof ErrorMessage);
msgCodes.add(msg2.getId());
assertEquals(1, info.getMessage().size());
Message msg = info.getMessage().get(0);
assertTrue(msg instanceof ErrorMessage);
msgCodes.add(msg.getId());
assertTrue(msgCodes.contains("OPF-002"));
assertTrue(msgCodes.contains("RSC-001"));
}

/**
Expand Down Expand Up @@ -665,8 +663,8 @@ public void checkSignaturesEpub2WithEncryptionTest() throws Exception {
public void parseEpub3TitleEncodingTest() throws Exception {
File epubFile = new File(EPUB3_TITLE_ENCODING);
String expectedTitle = "महाभारत";
// well formed and valid
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.TRUE, RepInfo.TRUE);
// well formed but not valid (this is inconsequential to the test, we're just checking title)
RepInfo info = parseAndCheckValidity(epubFile, RepInfo.TRUE, RepInfo.FALSE);

Property metadata = info.getProperty(PROPNAME_EPUB_METADATA);
Map<String, Object> props = toMap(metadata);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
Expand Down Expand Up @@ -45,9 +46,10 @@ public class JhoveRepInfoReportTest {
private static final MessageId WARN_MSG_ID = MessageId.CHK_001;
private static final String WARN_MSG = "Consider yourself warned";
private static final String WARN_MSG_SUGGEST = "Don't do it again!";

private EPUBLocation messageLoc = EPUBLocation.create("epub.opf");
private EPUBLocation messageLoc2 = EPUBLocation.create("content.xhtml");

private EPUBLocation messageLoc = EPUBLocation.of(new File("epub.opf"));
private EPUBLocation messageLoc2 = EPUBLocation.of(new File("content.xhtml"));

private String messageArg = "fakearg";


Expand Down
2 changes: 1 addition & 1 deletion jhove-installer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<properties>
<installer.output.filename>jhove-xplt-installer-${project.version}.jar</installer.output.filename>
<izpack.version>5.1.3</izpack.version>
<izpack.version>5.2.0</izpack.version>
<izpack.staging>${project.build.directory}/staging</izpack.staging>
<izpack.target>${project.build.directory}</izpack.target>
<izpack.scripts>${project.build.scriptSourceDirectory}</izpack.scripts>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ASCII-HUL-1 = Ungültiges Zeichen
ASCII-HUL-1-SUB = "Zeichen = %c (0x%2X)";
ASCII-HUL-2 = Leere Datei
ASCII-HUL-3 = Nicht druckbare Zeichen
ASCII-HUL-3 = Nicht druckbare Zeichen
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
JPEG-HUL-1 = DDT Segment ohne vorhergehendes DTI
JPEG-HUL-2 = Unerwartetes Dateiende
JPEG-HUL-3 = I/O Ausnahme bei der Bearbeitung von Exif Metadaten:
JPEG-HUL-4 = Ungültiger JPEG Header
JPEG-HUL-5 = JFIF APP0 Marker nicht am Anfang der Datei
JPEG-HUL-6 = Marker nicht valide in diesem Kontext
JPEG-HUL-7 = Erwartetes Marker-Byte 255
JPEG-HUL-7-SUB = Lese Marker-Byte Wert %d
JPEG-HUL-8 = SPIFF Marker nicht am Anfang der Datei
JPEG-HUL-9 = Datei beginnt nicht mit SPIFF, Exif oder JFIF Segment
JPEG-HUL-10 = Nichterkannte Kacheldaten
JPEG-HUL-11 = Nicht zulässiges ICCProfil in APP2 Segment; Meldung
JPEG-HUL-12 = Adobe Marker Segment, unzulässiger transformFlag Wert %d
JPEG-HUL-13 = Unbekannter Farbraum mit Komponentenanzahl: %d
JPEG-HUL-14 = TIFF-HUL module benötigt, um Exif-Daten auszuwerten

JHOVE-SYS-1 = Fehler beim Erstellen einer temporären Datei. Kontrolliere die Konfiguration:
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ JPEG-HUL-8 = SPIFF marker not at beginning of file
JPEG-HUL-9 = File does not begin with SPIFF, Exif or JFIF segment
JPEG-HUL-10 = Unrecognized tiling data
JPEG-HUL-11 = Invalid ICCProfile in APP2 segment; message
JPEG-HUL-12=Adobe marker segment, bad transformFlag value %d
JPEG-HUL-13=Unknown colorspace with number of components of %d
JPEG-HUL-12 = Adobe marker segment, bad transformFlag value %d
JPEG-HUL-13 = Unknown colorspace with number of components of %d
JPEG-HUL-14 = TIFF-HUL module required to report Exif data

JHOVE-1 = Error creating temporary file. Check your configuration:
JHOVE-SYS-1 = Error creating temporary file. Check your configuration:
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,10 @@ protected boolean readXRefTables(RepInfo info) throws IOException {
// (Most likely we've hit the keyword "trailer".
break;
}
_objCount = ((Numeric) _parser.getNext()).getIntegerValue();
token = _parser.getNext();
if (token instanceof Numeric) {
_objCount = ((Numeric) token).getIntegerValue();
}
if (_xref == null) {
_xref = new long[_objCount];
}
Expand Down Expand Up @@ -2367,13 +2370,20 @@ protected void findImages(RepInfo info) throws IOException {
.get(DICT_KEY_WIDTH);
PdfSimpleObject widObj = (PdfSimpleObject) resolveIndirectObject(
widthBase);
niso.setImageWidth(widObj.getIntValue());
PdfObject heightBase = xobdict
.get(DICT_KEY_HEIGHT);
PdfSimpleObject htObj = (PdfSimpleObject) resolveIndirectObject(
heightBase);
niso.setImageLength(htObj.getIntValue());

if(widObj != null || htObj != null ) {
niso.setImageWidth(widObj.getIntValue());
niso.setImageLength(htObj.getIntValue());
} else {
info.setWellFormed(false);
JhoveMessage message = JhoveMessages.getMessageInstance(
MessageConstants.PDF_HUL_159.getId(),
MessageConstants.PDF_HUL_159.getMessage());
info.setMessage(new ErrorMessage(message)); // PDF-HUL-159
}
// Check for filters to add to the filter
// list
Filter[] filters = ((PdfStream) xob)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public enum MessageConstants {
public static final JhoveMessage PDF_HUL_156 = messageFactory.getMessage("PDF-HUL-156");
public static final JhoveMessage PDF_HUL_157 = messageFactory.getMessage("PDF-HUL-157");
public static final JhoveMessage PDF_HUL_158 = messageFactory.getMessage("PDF-HUL-158");
public static final JhoveMessage PDF_HUL_159 = messageFactory.getMessage("PDF-HUL-159");

/**
* Logger Messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,4 @@ PDF-HUL-155 = Error parsing mandatory version number from PDF header.
PDF-HUL-156 = Extension can't be defined as an indirect reference
PDF-HUL-157 = Unexpected exception {0}
PDF-HUL-158 = Unexpected exception {0}
PDF-HUL-159 = Image height and width are manditory properties
4 changes: 2 additions & 2 deletions jhove-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<version>1.29.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand Down
Loading

0 comments on commit 1fbf947

Please sign in to comment.