diff --git a/.classpath b/.classpath
index f4e2833e..9b75266d 100644
--- a/.classpath
+++ b/.classpath
@@ -8,9 +8,8 @@
-
-
-
+
+
diff --git a/lib/jhove/jhove-core-1.16.5.jar b/lib/jhove/jhove-core-1.16.5.jar
new file mode 100644
index 00000000..cc131753
Binary files /dev/null and b/lib/jhove/jhove-core-1.16.5.jar differ
diff --git a/lib/jhove/jhove-handler.jar b/lib/jhove/jhove-handler.jar
deleted file mode 100644
index 967adc1b..00000000
Binary files a/lib/jhove/jhove-handler.jar and /dev/null differ
diff --git a/lib/jhove/jhove-module.jar b/lib/jhove/jhove-module.jar
deleted file mode 100644
index 3d2a1251..00000000
Binary files a/lib/jhove/jhove-module.jar and /dev/null differ
diff --git a/lib/jhove/jhove-modules-1.16.5.jar b/lib/jhove/jhove-modules-1.16.5.jar
new file mode 100644
index 00000000..8f55bc7e
Binary files /dev/null and b/lib/jhove/jhove-modules-1.16.5.jar differ
diff --git a/lib/jhove/jhove.jar b/lib/jhove/jhove.jar
deleted file mode 100644
index a9d0ed9d..00000000
Binary files a/lib/jhove/jhove.jar and /dev/null differ
diff --git a/src/edu/harvard/hul/ois/fits/exceptions/FitsException.java b/src/edu/harvard/hul/ois/fits/exceptions/FitsException.java
index f4c9f67d..10aed599 100644
--- a/src/edu/harvard/hul/ois/fits/exceptions/FitsException.java
+++ b/src/edu/harvard/hul/ois/fits/exceptions/FitsException.java
@@ -16,7 +16,7 @@ public class FitsException extends Exception {
* generated serial id
*/
private static final long serialVersionUID = 1266363844796336485L;
- private Exception embeddedException = null;
+ private Throwable embeddedException = null;
private String message;
public FitsException() {
@@ -26,7 +26,7 @@ public FitsException(String message) {
this();
this.message = message;
}
- public FitsException(String message, Exception e) {
+ public FitsException(String message, Throwable e) {
this();
this.embeddedException = e;
this.message = message;
@@ -39,7 +39,7 @@ public String getMessage() {
return message;
}
- public Exception getEmbeddedException() {
+ public Throwable getEmbeddedException() {
return embeddedException;
}
}
diff --git a/src/edu/harvard/hul/ois/fits/exceptions/FitsToolException.java b/src/edu/harvard/hul/ois/fits/exceptions/FitsToolException.java
index 2df998b5..7ef4c7cf 100644
--- a/src/edu/harvard/hul/ois/fits/exceptions/FitsToolException.java
+++ b/src/edu/harvard/hul/ois/fits/exceptions/FitsToolException.java
@@ -22,7 +22,7 @@ public FitsToolException() {
public FitsToolException(String message) {
super(message);
}
- public FitsToolException(String message, Exception e) {
+ public FitsToolException(String message, Throwable e) {
super(message,e);
}
diff --git a/src/edu/harvard/hul/ois/fits/tools/jhove/Jhove.java b/src/edu/harvard/hul/ois/fits/tools/jhove/Jhove.java
index 45131edb..d82a31d4 100644
--- a/src/edu/harvard/hul/ois/fits/tools/jhove/Jhove.java
+++ b/src/edu/harvard/hul/ois/fits/tools/jhove/Jhove.java
@@ -66,7 +66,7 @@ public Jhove() throws FitsException {
jhove.setSignatureFlag(false);
jhove.setShowRawFlag(false);
xh = new XmlHandler();
- jhoveApp = new App ("Jhove","1.11", new int[] {2015, 05, 25}, "","");
+ jhoveApp = new App ("Jhove","1.16", new int[] {2017, 03, 15}, "","");
xh.setApp(jhoveApp);
xh.setBase(jhove);
}
@@ -135,7 +135,7 @@ public ToolOutput extractInfo(File file) throws FitsToolException {
}
catch (OutOfMemoryError e) {
logger.error("Jhove OutOfMemoryError while processing "+file.getName());
- throw new FitsToolException("Jhove OutOfMemoryError while processing "+file.getName());
+ throw new FitsToolException("Jhove OutOfMemoryError while processing "+file.getName(), e);
}
String format = XmlUtils.getDomValue(dom,"format");
String xsltTransform = (String)transformMap.get(format.toUpperCase());
diff --git a/testfiles/32044020597662.zip b/testfiles/32044020597662.zip
new file mode 100644
index 00000000..7780359f
Binary files /dev/null and b/testfiles/32044020597662.zip differ
diff --git a/testfiles/output/32044020597662.zip_XmlUnitExpectedOutput.xml b/testfiles/output/32044020597662.zip_XmlUnitExpectedOutput.xml
new file mode 100644
index 00000000..6db2aea4
--- /dev/null
+++ b/testfiles/output/32044020597662.zip_XmlUnitExpectedOutput.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+ 1.0
+ x-fmt/263
+
+
+
+ /Users/dan179/git/git-daveneiman/fits/testfiles/32044020597662.zip
+ 32044020597662.zip
+ 95270
+ 7c64750915af83a39c35f0e836d3690f
+ 1490192287000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testfiles/output/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1_mp4_FITS_NO_MD5.xml b/testfiles/output/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1_mp4_FITS_NO_MD5.xml
index 797d651d..947a7489 100644
--- a/testfiles/output/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1_mp4_FITS_NO_MD5.xml
+++ b/testfiles/output/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1_mp4_FITS_NO_MD5.xml
@@ -72,7 +72,7 @@
-
+
diff --git a/testfiles/output/HasAnnotations.pdf_XmlUnitExpectedOutput.xml b/testfiles/output/HasAnnotations.pdf_XmlUnitExpectedOutput.xml
index d2e589ef..68595f09 100644
--- a/testfiles/output/HasAnnotations.pdf_XmlUnitExpectedOutput.xml
+++ b/testfiles/output/HasAnnotations.pdf_XmlUnitExpectedOutput.xml
@@ -1,9 +1,9 @@
-
+
-
+
-
+
@@ -14,20 +14,19 @@
- 103323
+ 103323
Adobe PDF Library 11.0/Acrobat PDFMaker 11 for Word
2015:08:19 17:12:03-04:00
2015-08-19T21:12:03Z
2015:08:19 17:10:14-04:00
- /Users/dan179/git/fits-daveneiman/fits/testfiles/HasAnnotations.pdf
+ /Users/dan179/git/git-daveneiman/fits/testfiles/HasAnnotations.pdf
HasAnnotations.pdf
4475c0c78050f41718837eb3f8069cbd
- 1456424437000
+ 1464898750000
- false
- false
- Invalid object number in cross-reference stream offset=103289
+ true
+ true
@@ -37,8 +36,8 @@
6
yes
no
- no
- no
+ no
+ no
no
@@ -49,20 +48,20 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
diff --git a/testfiles/output/HasChangeHistory.pdf_XmlUnitExpectedOutput.xml b/testfiles/output/HasChangeHistory.pdf_XmlUnitExpectedOutput.xml
index b1be6417..2e45f70b 100644
--- a/testfiles/output/HasChangeHistory.pdf_XmlUnitExpectedOutput.xml
+++ b/testfiles/output/HasChangeHistory.pdf_XmlUnitExpectedOutput.xml
@@ -1,9 +1,9 @@
-
+
-
+
-
+
@@ -14,20 +14,19 @@
- 101002
+ 101002
Adobe PDF Library 11.0/Acrobat PDFMaker 11 for Word
2015:08:19 17:10:57-04:00
2015-08-19T21:10:57Z
2015:08:19 17:10:14-04:00
- /Users/dan179/git/fits-daveneiman/fits/testfiles/HasChangeHistory.pdf
+ /Users/dan179/git/git-daveneiman/fits/testfiles/HasChangeHistory.pdf
HasChangeHistory.pdf
ad18d1a191b7ab53614f3d003fa60472
- 1456425107000
+ 1464898750000
- false
- false
- Invalid object number in cross-reference stream offset=100968
+ true
+ true
@@ -37,8 +36,8 @@
6
yes
no
- no
- no
+ no
+ no
no
@@ -49,20 +48,20 @@
-
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
diff --git a/testfiles/output/PDF_embedded_resources.pdf_XmlUnitExpectedOutput.xml b/testfiles/output/PDF_embedded_resources.pdf_XmlUnitExpectedOutput.xml
index 0a0e56f7..8e7fb215 100644
--- a/testfiles/output/PDF_embedded_resources.pdf_XmlUnitExpectedOutput.xml
+++ b/testfiles/output/PDF_embedded_resources.pdf_XmlUnitExpectedOutput.xml
@@ -1,9 +1,9 @@
-
+
-
+
-
+
@@ -14,55 +14,52 @@
- 1113979
+ 1113979
Acrobat Distiller 8.1.0 (Windows)/Adobe PageMaker 6.52
2015:08:19 16:17:32-04:00
2015-08-19T20:17:32Z
2008:09:24 15:27:24-04:00
- /Users/dan179/git/fits-daveneiman/fits/testfiles/PDF_embedded_resources.pdf
+ /Users/dan179/git/git-daveneiman/fits/testfiles/PDF_embedded_resources.pdf
PDF_embedded_resources.pdf
dbfbf8c633100f5d4301fed7b65ad698
- 1456177705000
+ 1464898750000
- false
- false
- Expected dictionary for font entry in page resource offset=3410
+ true
+ true
digibook
Harvard University Archives
- 52
+ 52
no
- no
- no
- 433
+ no
+ no
booklet10
booklet10
no
52
- 433
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
diff --git a/testfiles/output/PDFa_has_table_of_contents.pdf_XmlUnitExpectedOutput.xml b/testfiles/output/PDFa_has_table_of_contents.pdf_XmlUnitExpectedOutput.xml
index 8bf46ece..83fcd2d4 100644
--- a/testfiles/output/PDFa_has_table_of_contents.pdf_XmlUnitExpectedOutput.xml
+++ b/testfiles/output/PDFa_has_table_of_contents.pdf_XmlUnitExpectedOutput.xml
@@ -1,9 +1,8 @@
-
+
-
+
-
1b
@@ -11,92 +10,47 @@
- 357428
- Adobe PDF Library 11.0/Acrobat PDFMaker 11 for Word
+ 357428
+ Adobe PDF Library 11.0/Acrobat PDFMaker 11 for Word
2015:08:19 18:15:37-04:00
2015-08-19T22:15:37Z
2015:08:19 16:44:12-04:00
- /Users/dan179/git/fits-daveneiman/fits/testfiles/PDFa_has_table_of_contents.pdf
+ /Users/dan179/git/git-daveneiman/fits/testfiles/PDFa_has_table_of_contents.pdf
PDFa_has_table_of_contents.pdf
537d5a41d854b5c03f8bb33041faf1aa
1464898750000
-
- true
- true
-
+
- Digital Repository Services (DRS) User Manual for Data Loading
- viz765
- EN-US
- 5
- yes
- yes
- yes
- 1
-
- Arial
-
-
- Arial,Bold
-
-
- Calibri
-
-
- Cambria
-
-
- Cambria-Bold
-
-
- CourierNew
-
-
- SymbolMT
-
-
- TimesNewRoman
-
-
- TimesNewRoman,Bold
-
+ 5
+ Digital Repository Services (DRS) User Manual for Data Loading
+ viz765
+ EN-US
+ yes
5
- 1
EN-US
-
-
-
-
-
-
-
-
-
isTagged
- hasOutline
- hasAnnotations
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
diff --git a/testfiles/properties/fits-full-with-tool-output.xml b/testfiles/properties/fits-full-with-tool-output.xml
index cc67c6a2..3a3e612c 100644
--- a/testfiles/properties/fits-full-with-tool-output.xml
+++ b/testfiles/properties/fits-full-with-tool-output.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/testfiles/properties/fits_no_md5_audio.xml b/testfiles/properties/fits_no_md5_audio.xml
index 15e89e40..ad3a9aab 100644
--- a/testfiles/properties/fits_no_md5_audio.xml
+++ b/testfiles/properties/fits_no_md5_audio.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/testfiles/properties/fits_no_md5_video.xml b/testfiles/properties/fits_no_md5_video.xml
index 4d81d23f..9f40a447 100644
--- a/testfiles/properties/fits_no_md5_video.xml
+++ b/testfiles/properties/fits_no_md5_video.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/tests/edu/harvard/hul/ois/fits/junit/AudioStdSchemaTest.java b/tests/edu/harvard/hul/ois/fits/junit/AudioStdSchemaTest.java
index 02b14650..355a88a9 100644
--- a/tests/edu/harvard/hul/ois/fits/junit/AudioStdSchemaTest.java
+++ b/tests/edu/harvard/hul/ois/fits/junit/AudioStdSchemaTest.java
@@ -56,6 +56,9 @@ public static void beforeClass() throws Exception {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setNormalizeWhitespace(true);
fits = new Fits();
+ // Use the following two lines to turn on tool output
+// File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
+// fits = new Fits(null, fitsConfigFile);
}
@AfterClass
diff --git a/tests/edu/harvard/hul/ois/fits/junit/DocMDTest.java b/tests/edu/harvard/hul/ois/fits/junit/DocMDTest.java
index 1f5c1bf3..d5ef9e05 100644
--- a/tests/edu/harvard/hul/ois/fits/junit/DocMDTest.java
+++ b/tests/edu/harvard/hul/ois/fits/junit/DocMDTest.java
@@ -56,6 +56,9 @@ public static void beforeClass() throws Exception {
XMLUnit.setNormalizeWhitespace(true);
File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
fits = new Fits(null, fitsConfigFile);
+// Use the following two lines to turn on tool output
+// fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
+// fits = new Fits(null, fitsConfigFile);
}
@AfterClass
diff --git a/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTest.java b/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTest.java
index fc495243..e8bb6a66 100644
--- a/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTest.java
+++ b/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTest.java
@@ -49,6 +49,9 @@ public static void beforeClass() throws Exception {
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setNormalizeWhitespace(true);
fits = new Fits();
+// Use the following two lines to turn on tool output
+// File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
+// fits = new Fits(null, fitsConfigFile);
}
@AfterClass
diff --git a/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTestXmlUnit_NoMD5.java b/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTestXmlUnit_NoMD5.java
index 2ddab73b..cbe2a784 100644
--- a/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTestXmlUnit_NoMD5.java
+++ b/tests/edu/harvard/hul/ois/fits/junit/VideoStdSchemaTestXmlUnit_NoMD5.java
@@ -45,8 +45,10 @@ public void testVideoXmlUnitFitsOutput_AVC_NO_MD5() throws Exception {
Fits fits = new Fits(null, fitsConfigFile);
// First generate the FITS output
- File input = new File("testfiles/FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1.mp4");
+ String inputFilename = "FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1.mp4";
+ File input = new File("testfiles/" + inputFilename);
FitsOutput fitsOut = fits.examine(input);
+ fitsOut.saveToDisk("test-generated-output/" + "FITS-SAMPLE-44_1_1_4_4_4_6_1_1_2_3_1_mp4_FITS_NO_MD5_XmlUnitActualOutput.xml");
XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
String actualXmlStr = serializer.outputString(fitsOut.getFitsXml());
diff --git a/tests/edu/harvard/hul/ois/fits/junit/ZipXmlUnitTest.java b/tests/edu/harvard/hul/ois/fits/junit/ZipXmlUnitTest.java
new file mode 100644
index 00000000..bf059003
--- /dev/null
+++ b/tests/edu/harvard/hul/ois/fits/junit/ZipXmlUnitTest.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2016 Harvard University Library
+ *
+ * This file is part of FITS (File Information Tool Set).
+ *
+ * FITS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * FITS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with FITS. If not, see .
+ */
+package edu.harvard.hul.ois.fits.junit;
+
+import static org.custommonkey.xmlunit.XMLAssert.assertXMLIdentical;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Scanner;
+
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Difference;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import edu.harvard.hul.ois.fits.Fits;
+import edu.harvard.hul.ois.fits.FitsOutput;
+import edu.harvard.hul.ois.fits.tests.AbstractLoggingTest;
+
+/**
+ * These tests compare actual FITS output with expected output on ZIP files.
+ * These tests should be run with <display-tool-output>false</display-tool-output> in fits.xml.
+ *
+ * @author dan179
+ */
+public class ZipXmlUnitTest extends AbstractLoggingTest {
+
+ private static final String ACTUAL_OUTPUT_FILE_SUFFIX = "_XmlUnitActualOutput.xml";
+ private static final String EXPECTED_OUTPUT_FILE_SUFFIX = "_XmlUnitExpectedOutput.xml";
+ private static final String[] IGNORED_XML_ELEMENTS = {
+ "version",
+ "created",
+ "toolversion",
+ "dateModified",
+ "fslastmodified",
+ "startDate",
+ "startTime",
+ "timestamp",
+ "fitsExecutionTime",
+ "executionTime",
+ "filepath",
+ "location",
+ "lastmodified"};
+
+ /*
+ * Only one Fits instance is needed to run all tests.
+ * This also speeds up the tests.
+ */
+ private static Fits fits;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ // Set up XMLUnit and FITS for entire class.
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setNormalizeWhitespace(true);
+ fits = new Fits();
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ fits = null;
+ }
+
+ @Test
+ public void testZipFile() throws Exception {
+
+ String inputFilename = "32044020597662.zip";
+ File input = new File("testfiles/" + inputFilename);
+ FitsOutput fitsOut = fits.examine(input);
+ fitsOut.addStandardCombinedFormat();
+ fitsOut.saveToDisk("test-generated-output/" + inputFilename + ACTUAL_OUTPUT_FILE_SUFFIX);
+
+ XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
+ String actualXmlStr = serializer.outputString(fitsOut.getFitsXml());
+
+ // Read in the expected XML file
+ Scanner scan = new Scanner(new File(
+ "testfiles/output/" + inputFilename + EXPECTED_OUTPUT_FILE_SUFFIX));
+ String expectedXmlStr = scan.
+ useDelimiter("\\Z").next();
+ scan.close();
+
+ testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename);
+ }
+
+ /*
+ * This method performs the actual test of actual FITS output against expected.
+ */
+ private void testActualAgainstExpected(String actualXmlStr, String expectedXmlStr, String inputFilename)
+ throws SAXException, IOException {
+ Diff diff = new Diff(expectedXmlStr,actualXmlStr);
+
+ // Initialize attributes or elements to ignore for difference checking
+ diff.overrideDifferenceListener(new IgnoreNamedElementsDifferenceListener(IGNORED_XML_ELEMENTS));
+
+ DetailedDiff detailedDiff = new DetailedDiff(diff);
+
+ // Display any Differences
+ @SuppressWarnings("unchecked")
+ List diffs = detailedDiff.getAllDifferences();
+ if (!diff.identical()) {
+ StringBuffer differenceDescription = new StringBuffer();
+ differenceDescription.append(diffs.size()).append(" differences");
+
+ System.out.println(differenceDescription.toString());
+ for(Difference difference : diffs) {
+ System.out.println(difference.toString());
+ }
+
+ }
+ assertXMLIdentical("Differences in XML for file: " + inputFilename, diff, true);
+ }
+
+}
diff --git a/version.properties b/version.properties
index cd516a90..9057be19 100644
--- a/version.properties
+++ b/version.properties
@@ -1 +1 @@
-build.version=1.0.6
+build.version=1.0.7
diff --git a/xml/fits.xml b/xml/fits.xml
index f47e6c3d..89927d74 100644
--- a/xml/fits.xml
+++ b/xml/fits.xml
@@ -10,7 +10,7 @@
-
+