Anonymous avatar Anonymous committed 5684542

Review changes and pom change to get the XSL display module working.

Comments (0)

Files changed (11)

config/spring/module/display/jhove2-display-config.xml

 	</bean>
 
         <!-- XSL displayer bean -->
-        <bean id="XSL" class="org.jhove2.module.display.XSLDisplayer" scope="prototype" parent="AbstractXSLT">
+        <bean id="CMD" class="org.jhove2.module.display.XSLDisplayer" scope="prototype" parent="AbstractXSLT">
             <constructor-arg ref="BaseModuleAccessor"/>
             <property name="stylesheet" value="classpath:containerMD.xsl"/>
         </bean>
 
+        <!-- CDX displayer bean -->
+        <bean id="CDX" class="org.jhove2.module.display.XSLDisplayer" scope="prototype" parent="AbstractXSLT">
+            <constructor-arg ref="BaseModuleAccessor"/>
+            <property name="stylesheet" value="classpath:cdx.xsl"/>
+        </bean>
+
 	<!-- Displayer ConfigInfo bean -->
 	<bean id="ConfigInfo" class="org.jhove2.config.spring.SpringConfigInfo" scope="singleton" />
 </beans>
 			<artifactId>jna</artifactId>
 			<version>3.2.7</version>
 		</dependency>
-		<!-- arc, gzip, warc -->
+		<!-- arc, gzip, warc module support -->
 		<dependency>
 			<groupId>org.jwat</groupId>
 			<artifactId>jwat-gzip</artifactId>
 			<artifactId>jwat-warc</artifactId>
 			<version>1.0.0-SNAPSHOT</version>
 		</dependency>
+		<!-- XSL Display module support -->
+		<dependency>
+			<groupId>saxon</groupId>
+			<artifactId>saxon</artifactId>
+			<version>6.5.3</version>
+		</dependency>
 	</dependencies>
 	<licenses>
 		<license>

src/main/java/org/jhove2/module/format/arc/ArcModule.java

 public class ArcModule extends BaseFormatModule implements Validator {
 
     /** Module version identifier. */
-    public static final String VERSION = "0.8.0";
+    public static final String VERSION = "2.1.0";
 
     /** Module release date. */
-    public static final String RELEASE = "2011-01-20";
-
-    /** Module rights statement. */
-    /*
-    public static final String RIGHTS =
-        "Copyright 2011 by The Royal Library in Denmark. " +
-        "Available under the terms of the BSD license.";
-    */
+    public static final String RELEASE = "2012-10-31";
 
     /** Module validation coverage. */
     public static final Coverage COVERAGE = Coverage.Selective;
     private String payloadDigestAlgorithm;
     private String payloadDigestEncoding;
 
-    //private static final String CHARACTERIZATION_ERROR = "characterizationError";
-
     /**
      * Stores a mapping of all Format aliases in the
      * {@link org.jhove2.core.I8R.Namespace.MIME MIME namespace}
     private Map<String, Integer> protocols =
                                 new HashMap<String, Integer>();
 
-    /** Validation errors. */
-    //private ConcurrentMap<String, AtomicInteger> errors =
-    //                            new ConcurrentHashMap<String,AtomicInteger>();
-
     /** The name of the ARC file. */
     private String arcFileName;
 
     /** The number or ARC records. */
     private int arcRecordNumber;
 
-    /** The amount of bytes consumed by the ArcReader- */
+    /** The amount of bytes consumed by the ArcReader. */
     private long arcReaderConsumedBytes;
 
     /** File version from version block. */
     // BaseFormatModule contract support
     //------------------------------------------------------------------------
 
-    /**
-     * Parses an ARC record source unit.
-     * @param  jhove2   the JHove2 characterization context.
-     * @param  source   ARC source unit
-     * @param  param    ARC source input
-     * @return number of consumed bytes parsed
-     * @throws IOException If an I/O exception is raised reading the source unit
-     * @throws JHOVE2Exception if a serious error hinders correct module execution
-     * @see org.jhove2.module.format.FormatModule#parse(org.jhove2.core.JHOVE2,
-     *      org.jhove2.core.source.Source, org.jhove2.core.io.Input)
+    /*
+     * Parse an ARC file/record.
+     * @see org.jhove2.module.format.BaseFormatModule#parse(org.jhove2.core.JHOVE2, org.jhove2.core.source.Source, org.jhove2.core.io.Input)
      */
     @Override
     public long parse(JHOVE2 jhove2,Source source, Input input)
         /*
          * SourceFactory for later use.
          */
-        //Invocation cfg = jhove2.getInvocation();
         SourceFactory sourceFactory = jhove2.getSourceFactory();
         if (sourceFactory == null) {
             throw new JHOVE2Exception("INTERNAL ERROR - JHOVE2 SourceFactory is null");
         recordSrc = parentSource.addChildSource(recordSrc);
         ++recordNumber;
         /*
-         * Version.
+         * Version. (The first ARC record should be a (filedesc) version block record)
          */
         if (recordNumber == 1) {
         	if (record.recordType == ArcRecordBase.RT_VERSION_BLOCK) {
                            jhove2.getConfigInfo());
     }
 
-    /**
-     * Increments the corresponding value of the key in the specified map.
-     * @param key the key in the map.
-     * @param map the map to update.
-     */
-    /*
-    private void updateMap(String key, ConcurrentMap<String,AtomicInteger> map) {
-        if ((key != null) && (key.length() != 0)) {
-            if (! map.containsKey(key)) {
-                map.putIfAbsent(key, new AtomicInteger());
-            }
-            map.get(key).incrementAndGet();
-        }
-    }
-    */
-
-    /**
-     * Handles generic exceptions
-     * @param e the exception
-     * @param jhove2 the JHove2 characterization context.
-     * @param source ARC file source unit.
-     * @throws JHOVE2Exception
-     */
-    /*
-    private void handleException(Exception e, JHOVE2 jhove2,Source source)
-            throws JHOVE2Exception {
-        this.isValid = Validity.False;
-        // TODO convert
-        source.addMessage(this.newValidityError(jhove2,Message.Severity.ERROR,
-                                                ArcErrorType.INVALID.toString(),
-                                                ArcRecordBase.ARC_FILE,e.toString()));
-    }
-    */
-
     //------------------------------------------------------------------------
     // Validator interface support
     //------------------------------------------------------------------------
     //------------------------------------------------------------------------
 
     /**
-     * arcFile getter
+     * arcFile getter.
      * @return the arcFile
      */
     @ReportableProperty(order=1, value="ARC file name")
     }
 
     /**
-     * arcFileSize getter
+     * arcFileSize getter.
      * @return the arcFileSize
      */
     @ReportableProperty(order=2, value="ARC file size, in bytes")
     }
 
     /**
-     * Returns ARC record number
+     * Returns ARC record number.
      * @return the number of arc record
      */
     @ReportableProperty(order=4, value="The number of ARC records")
     }
 
     /**
-     * arcReaderConsumedBytes getter
+     * arcReaderConsumedBytes getter.
      * @return the arcReaderConsumedBytes
      */
     @ReportableProperty(order=5, value="ARC reader consumed bytes, in bytes")
     }
 
     /**
-     * protocols getter
+     * protocols getter.
      * @return the protocols
      */
     @ReportableProperty(order=8, value="URL record protocols")
     }
 
      /**
-     * errors getter
+     * errors getter.
      * @return the errors
      */
     /*
 
     /**
      * Sets whether to recursively characterize ARC record objects.
-     * @param  recurse  whether to recursively characterize ARC record objects.
+     * @param recurse whether to recursively characterize ARC record objects
      */
     public void setRecurse(boolean recurse) {
         this.recurse = recurse;

src/main/java/org/jhove2/module/format/arc/properties/ArcRecordData.java

 @Persistent
 public class ArcRecordData {
 
+	/** Start offset of record in input stream. */
     protected long startOffset;
+    /** Number of bytes consumed validating record. */
     protected long consumed;
 
+    /** Version 1 or 2 record format. */
     protected Integer blockDescVersion;
 
+    /** URL read from header. */
     protected String url;
+    /** Protocol read from URL. */
     public String protocol;
+    /** IP-Address read from header. */
     protected String ipAddress;
+    /** IP-Address version identified. (4 or 6) */
     protected String ipVersion;
+    /** Archive-date from header, if valid. */
     protected String archiveDate;
+    /** Archive-date read from header. */
     protected String rawArchiveDate;
+    /** Content-type read from header. */
     protected String contentType;
+    /** Archive-length read from header. */
     protected String length;
+    /** Result-code read from header, if present. */
     protected String resultCode;
+    /** Checksum read from header, if present. */
     protected String checksum;
+    /** Location read from header, if present. */
     protected String location;
+    /** Offset read from header, if present. */
     protected String offset;
+    /** Filename read from header, if present. */
     protected String filename;
+
+    /* Does the record have a payload. */
     protected Boolean bHasPayload;
+    /** Payload length, without payload header (version block/HTTP header). */
     protected String payloadLength;
+    /** Boolean indicating whether this record is compliant or not. */
     protected boolean bIsNonCompliant;
 
+    /** Computed block digest. */
     protected String computedBlockDigest;
+    /** Computed block digest algorithm. */
     protected String computedBlockDigestAlgorithm;
+    /** Computed block digest encoding. */
     protected String computedBlockDigestEncoding;
+    /** Computed payload digest, if applicable. */
     protected String computedPayloadDigest;
+    /** Computed payload digest algorithm, if applicable. */
     protected String computedPayloadDigestAlgorithm;
+    /** Computed payload digest encoding, if applicable. */
     protected String computedPayloadDigestEncoding;
 
+    /** Version number field read from version block.*/
     protected String versionNumber;
+    /** Reserved field read from version block. */
     protected String reserved;
+    /** Origin-code field read from version block. */
     protected String originCode;
 
+    /** Result-code read from HTTP header, if present. */
     protected String protocolResultCode;
+    /** Protocol version read from HTTP header, if present. */
     protected String protocolVersion;
+    /** Content-type read from HTTP header, if present. */
     protected String protocolContentType;
+    /** Server header entry read from HTTP header, if present. */
     protected String protocolServer;
 
     /** ARC <code>DateFormat</code> as specified by the ARC specification. */
      * @param record parsed ARC record
      */
     public ArcRecordData(ArcRecordBase record) {
+    	if (record == null) {
+    		throw new IllegalArgumentException("'record' should never be null");
+    	}
         HeaderLine headerLine;
         switch (record.recordType) {
         case ArcRecordBase.RT_VERSION_BLOCK:

src/main/java/org/jhove2/module/format/gzip/GzipModule.java

 public class GzipModule extends BaseFormatModule implements Validator {
 
     /** Module version identifier. */
-    public final static String VERSION = "0.8.0";
+    public final static String VERSION = "2.1.0";
 
     /** Module release date. */
-    public final static String RELEASE = "2011-01-20";
-
-    /** Module rights statement. */
-    /*
-    public final static String RIGHTS =
-        "Copyright 2010 by The Royal Library in Denmark. " +
-        "Available under the terms of the BSD license.";
-    */
+    public final static String RELEASE = "2012-10-31";
 
     /** Module validation coverage. */
     public static final Coverage COVERAGE = Coverage.Selective;
     /** Validation status. */
     private Validity isValid;
 
-    /** The name of the ARC file. */
+    /** The name of the GZip file. */
     private String gzipFileName;
 
-    /** The size of the ARC file, in bytes. */
+    /** The size of the GZip file, in bytes. */
     private Long gzipFileSize;
 
     /** Last modified date of the GZip file. */
     /** Number of members compressed with the deflate compression method. */
     private long deflateMemberCount = 0;
 
-    /** The amount of bytes consumed by the GZipReader- */
+    /** The amount of bytes consumed by the GZipReader. */
     private long gzipReaderConsumedBytes;
 
     /** Number of non-valid members. */
     // BaseFormatModule contract support
     //------------------------------------------------------------------------
 
+    /*
+     * Parse a GZip file/entry.
+     * @see org.jhove2.module.format.BaseFormatModule#parse(org.jhove2.core.JHOVE2, org.jhove2.core.source.Source, org.jhove2.core.io.Input)
+     */
     @Override
     public long parse(final JHOVE2 jhove2, Source source, Input input)
-        throws EOFException, IOException, JHOVE2Exception
-    {
-        //Invocation cfg = jhove2.getInvocation();
+        throws EOFException, IOException, JHOVE2Exception {
         /*
         // Check for parallel characterization mode.
         ExecutorService threadPool = null;
                 src.addExtraProperties(gzipEntryData.getGzipEntryProperties());
                 // Check member compression method (always deflate).
                 if (gzipEntry.cm == GzipConstants.CM_DEFLATE) {
-                    //this.deflateMemberCount.incrementAndGet();
                     ++deflateMemberCount;
                 }
                 // Check member validity.
                 if (! gzipEntry.isCompliant()) {
-                    //this.invalidMembers.incrementAndGet();
                     ++invalidMembers;
                     isValid = Validity.False;
                     // Report errors on child source object.
     }
 
     /**
-     * Checks GZip record validity and reports validation errors.
+     * Checks GZip entry validity and reports validation errors.
      * @param src GZip source unit
-     * @param record the GZip record to characterize.
+     * @param entry the GZip entry to characterize.
      * @param jhove2 the JHove2 characterization context.
      * @throws IOException if an IO error occurs while processing
      * @throws JHOVE2Exception if a serious problem needs to be reported
            for (Diagnosis d : entry.diagnostics.getErrors()) {
                src.addMessage(newValidityError(jhove2, Message.Severity.ERROR,
                        d.type.toString().toLowerCase(), d.getMessageArgs()));
-               //updateMap(e.error.toString() + '-' + e.field, this.errors);
            }
         }
         if (entry.diagnostics.hasWarnings()) {
      * @param jhove2 the JHove2 characterization context.
      * @param severity message severity
      * @param id the configuration property relative name.
-     * @param params the values to add in the message
+     * @param messageArgs the values to add in the message
      * @return the new localized message
      * @throws JHOVE2Exception if a serious problem needs to be reported
      */
     // Validator interface support
     //------------------------------------------------------------------------
 
-    /** Validate the Gzip file.
+    /**
+     * Validate the Gzip file.
      * @param jhove2 JHOVE2 framework object
      * @param source Gzip file source unit
      * @param input  Gzip file source input
         return isValid();
     }
 
-    /** Get validation coverage.
+    /**
+     * Get validation coverage.
      * @return Validation coverage
      * @see org.jhove2.module.format.Validator#getCoverage()
      */
         return COVERAGE;
     }
 
-    /** Get validity.
+    /**
+     * Get validity.
      * @return Validity
      * @see org.jhove2.module.format.Validator#isValid()
      */
     //------------------------------------------------------------------------
 
     /**
-     * gzipFileName getter
+     * gzipFileName getter.
      * @return the gzipFileName
      */
     @ReportableProperty(order=1, value="GZip file name")
     }
 
     /**
-     * gzipFileSize getter
+     * gzipFileSize getter.
      * @return the gzipFileSize
      */
     @ReportableProperty(order=2, value="GZip file size, in bytes")
 
     /**
      * Returns the number of GZip entries found.
-     * @return the number of GZip entries found.
+     * @return the number of GZip entries found
      */
     @ReportableProperty(order = 4,
                         value = "Number of members compressed with the deflate compression method")
     public long getNumDeflateMembers() {
-        //return this.deflateMemberCount.get();
         return deflateMemberCount;
     }
 
     /**
-     * gzipReaderConsumedBytes getter
+     * gzipReaderConsumedBytes getter.
      * @return the gzipReaderConsumedBytes
      */
     @ReportableProperty(order=5, value="GZip reader consumed bytes, in bytes")
 
     /**
      * Returns the number of invalid GZip entries found.
-     * @return the number of invalid GZip entries found.
+     * @return the number of invalid GZip entries found
      */
     @ReportableProperty(order = 6, value = "Number of non-valid members")
     public long getNumInvalidMembers() {
-        //return this.invalidMembers.get();
         return invalidMembers;
     }
 
     /**
      * Returns the number of GZip entries marked as invalid.
-     * @return the number of invalid GZip entries found.
+     * @return the number of invalid GZip entries found
      */
     @ReportableProperty(order = 7, value = "Validation error messages")
     public Collection<Message> getValidationMessages() {
     /**
      * <i>Dependency injection<i/> Sets whether to recursively
      * characterize GZip members.
-     * @param  recurse   whether to recursively characterize GZip
-     *                   members.
+     * @param recurse whether to recursively characterize GZip members
      */
     public void setRecurse(boolean recurse) {
         this.recurse = recurse;
     }
 
-    /** Returns whether this module recursively characterizes the
+    /**
+     * Returns whether this module recursively characterizes the
      * found GZip members.
      * @return <code>true</code> if GZip members are recursively
      *         characterized; <code>false</code> otherwise.  Defaults
-     *         to <code>true</code>.
+     *         to <code>true</code>
      */
     public boolean getRecurse() {
         return recurse;

src/main/java/org/jhove2/module/format/gzip/properties/GzipEntryData.java

+/**
+ * JHOVE2 - Next-generation architecture for format-aware characterization
+ *
+ * Copyright (c) 2009 by The Regents of the University of California,
+ * Ithaka Harbors, Inc., and The Board of Trustees of the Leland Stanford
+ * Junior University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * o Redistributions of source code must retain the above copyright notice,
+ *   this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ *
+ * o Neither the name of the University of California/California Digital
+ *   Library, Ithaka Harbors/Portico, or Stanford University, nor the names of
+ *   its contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 package org.jhove2.module.format.gzip.properties;
 
 import java.util.Date;
 
 import com.sleepycat.persist.model.Persistent;
 
+/**
+ * This class is a wrapper for the information available in a GZip entry.
+ * Since the GZip reader is not persistent its data must be moved to a simpler
+ * data class which can be persisted instead.
+ *
+ * @author nicl
+ */
 @Persistent
 public class GzipEntryData {
 
+	/** Boolean indicating whether header is non compliant. */
 	protected boolean isNonCompliant;
+	/** TODO Unused. */
     protected int index;
+    /** Offset of entry in input stream. */
     protected long offset;
+    /** Compression methods read from header. */
     protected CompressionMethod method;
+    /** Compression type read from extra flags in heder. */
     protected CompressionType extraFlags;
+    /** Optional filename from header. */
     protected String fileName;
+    /** Operating System from header converted to a field. */
     protected OperatingSystem os;
+    /** Optional comment from header. */
     protected String comment;
+    /** Ascii bit set in header. */
     protected boolean asciiFlag;
+    /** Optional CRC16 read from header. */
     protected Integer readCrc16;
+    /** CRC16 computed as verification to optional value found in header. */
     protected int computedCrc16;
 
-    /* Non immutable fields: use defensive copy in getter method. */
+    /** Date read from header. */
     protected Date date;
+    /** TODO unused. */
     protected byte[] extraFields;
 
+    /** TODO Errors encountered validating entry and data. */
     protected int errors = 0;
+    /** Uncompressed size of entry data. */
     protected long size  = -1L;
+    /** Compressed size of entry data. */
     protected long csize = -1L;
+    /** ISIZE read from trailing header. */
     protected long readISize = -1L;
+    /** ISIZE computed as verification to value found in trailing header. */
     protected long computedISize = -1;
+    /** CRC32 read from trailing header. */
     protected int readCrc32;
+    /** CRC32 computed as verification to value found in trailing header. */
     protected int computedCrc32;
 
     /**
     public GzipEntryData() {
     }
 
+    /**
+     * Given a GZip entry, transfer the data to this object so it can be
+     * persisted.
+     * @param entry GZip entry data
+     */
     public GzipEntryData(GzipEntry entry) {
+    	if (entry == null) {
+    		throw new IllegalArgumentException("'entry' should never be null");
+    	}
     	this.isNonCompliant = !entry.isCompliant();
     	this.offset = entry.getStartOffset();
     	this.method = CompressionMethod.fromValue(entry.cm);

src/main/java/org/jhove2/module/format/gzip/properties/GzipEntryProperties.java

      *         <code>null</code> if none are present.
      */
     public byte[] getExtra() {
-        int l = entry.extraFields.length;
-        byte[] copy = new byte[l];
-        System.arraycopy(entry.extraFields, 0, copy, 0, l);
+        int len = entry.extraFields.length;
+        byte[] copy = new byte[len];
+        System.arraycopy(entry.extraFields, 0, copy, 0, len);
         return copy;
     }
 

src/main/java/org/jhove2/module/format/warc/WarcModule.java

 public class WarcModule extends BaseFormatModule implements Validator {
 
     /** Module version identifier. */
-    public static final String VERSION = "0.8.0";
+    public static final String VERSION = "2.1.0";
 
     /** Module release date. */
-    public static final String RELEASE = "2011-01-20";
-
-    /** Module rights statement. */
-    /*
-    public static final String RIGHTS =
-            "Copyright 2011 by The Royal Library in Denmark. "
-            + "Available under the terms of the BSD license.";
-    */
+    public static final String RELEASE = "2012-10-31";
 
     /** Module validation coverage. */
     public static final Coverage COVERAGE = Coverage.Selective;
     /** WARC file size, whole file. */
     private Long warcFileSize;
 
-    /** Last modified date of the ARC file. */
+    /** Last modified date of the WARC file. */
     private Date warcFileLastModified;
 
-    /** The amount of bytes consumed by the ArcReader- */
+    /** The amount of bytes consumed by the WarcReader. */
     private long warcReaderConsumedBytes;
 
     /** File version, null unless all records have the same version. */
         this(null, null);
     }
 
-    /**
-     * Parse a WARC source unit.
-     * @param jhove2 the JHove2 characterization context
-     * @param source WARC source unit
-     * @param input WARC source input
-     * @return number of consumed bytes parsed
-     * @throws EOFException If End-of-File is reached reading the source unit
-     * @throws IOException If an I/O exception is raised reading the source unit
-     * @throws JHOVE2Exception if a serious error hinders correct module execution
-     * @see org.jhove2.module.format.FormatModule#parse(org.jhove2.core.JHOVE2,
-     *      org.jhove2.core.source.Source, org.jhove2.core.io.Input)
+    //------------------------------------------------------------------------
+    // BaseFormatModule contract support
+    //------------------------------------------------------------------------
+
+    /*
+     * Parse a WARC file/record.
+     * @see org.jhove2.module.format.BaseFormatModule#parse(org.jhove2.core.JHOVE2, org.jhove2.core.source.Source, org.jhove2.core.io.Input)
      */
     @Override
     public long parse(JHOVE2 jhove2, Source source, Input input)
         /*
          * SourceFactory for later use.
          */
-        //Invocation cfg = jhove2.getInvocation();
         SourceFactory sourceFactory = jhove2.getSourceFactory();
         if (sourceFactory == null) {
             throw new JHOVE2Exception("INTERNAL ERROR - JHOVE2 SourceFactory is null");

src/main/java/org/jhove2/module/format/warc/properties/WarcRecordData.java

 @Persistent
 public class WarcRecordData {
 
-    protected Long startOffset;
+	/** Start offset of record in input stream. */
+	protected Long startOffset;
+    /** Number of bytes consumed validating record. */
     protected Long consumed;
 
+    /** WARC version read from header. */
     protected String warcVersionStr;
 
+    /** WARC-Type read from header. */
     protected String warcType;
+    /** WARC-Filename read from header. */
     protected String warcFilename;
+    /** WARC-Record-Id read from header. */
     protected String warcRecordId;
+    /** WARC-Date read from header. */
     protected String warcDate;
+    /** Content-Length read from header. */
     protected String contentLength;
+    /** Content-type read from header. */
     protected String contentType;
+    /** WARC-Truncated read from header. */
     protected String warcTruncated;
+    /** WARC-IP-Address read from header. */
     protected String warcIpAddress;
+    /** List of WARC-Concurrent-To read from header. */
     protected List<String> warcConcurrentToList;
+    /** WARC-Refers-To read from header. */
     protected String warcRefersTo;
+    /** WARC-Target-URI read from header. */
     protected String warcTargetUri;
+    /** WARC-Warcinfo-ID read from header. */
     protected String warcWarcinfoId;
+    /** WARC-Identified-Payload-Type read from header. */
     protected String warcIdentifiedPayloadType;
+    /** WARC-Profile read from header. */
     protected String warcProfile;
+    /** WARC-Segment-Number read from header. */
     protected String warcSegmentNumber;
+    /** WARC-Segment-Origin-ID read from header. */
     protected String warcSegmentOriginId;
+    /** WARC-Segment-Total-Length read from header. */
     protected String warcSegmentTotalLength;
 
+    /** Block digest read from header. */
     protected String warcBlockDigest;
+    /** Block digest algorithm read from header. */
     protected String warcBlockDigestAlgorithm;
+    /** Block digest encoding auto-detected from digest and algorithm. */
     protected String warcBlockDigestEncoding;
+    /** Payload digest read from header. */
     protected String warcPayloadDigest;
+    /** Payload digest algorithm read from header. */
     protected String warcPayloadDigestAlgorithm;
+    /** Payload digest encoding auto-detected from digest and algorithm. */
     protected String warcPayloadDigestEncoding;
 
+    /** Computed block digest. */
     protected String computedBlockDigest;
+    /** Computed block digest algorithm. */
     protected String computedBlockDigestAlgorithm;
+    /** Computed block digest encoding. */
     protected String computedBlockDigestEncoding;
+    /** Computed payload digest, if applicable. */
     protected String computedPayloadDigest;
+    /** Computed payload digest algorithm, if applicable. */
     protected String computedPayloadDigestAlgorithm;
+    /** Computed payload digest encoding, if applicable. */
     protected String computedPayloadDigestEncoding;
 
+    /** WARC-Record-Id scheme used. */
     protected String recordIdScheme;
 
+    /** Boolean indicating whether this record is compliant or not. */
     protected Boolean bIsNonCompliant;
+    /** Boolean indicating whether the block digest is valid or not. */
     protected Boolean isValidBlockDigest;
+    /** Boolean indicating whether the payload digest is valid or not. */
     protected Boolean isValidPayloadDigest;
 
+    /* Does the record have a payload. */
     protected Boolean bHasPayload;
+    /** Payload length, without payload header (version block/HTTP header). */
     protected String payloadLength;
 
+    /** IP vresion of WARC-IP-Address (4 or 6). */
     protected String ipVersion;
 
+    /** Result-code read from HTTP header, if present. */
     protected String resultCode;
+    /** Protocol version read from HTTP header, if present. */
     protected String protocolVersion;
+    /** Content-type read from HTTP header, if present. */
     protected String protocolContentType;
+    /** Server header entry read from HTTP header, if present. */
     protected String protocolServer;
+    /** User-Agent header entry read from HTTP header, if present. */
     protected String protocolUserAgent;
 
     /**
      * @param record parsed WARC record
      */
     public WarcRecordData(WarcRecord record) {
+    	if (record == null) {
+    		throw new IllegalArgumentException("'record' should never be null");
+    	}
     	WarcHeader header = record.header;
         startOffset = record.getStartOffset();
         consumed = record.getConsumed();
      * @return a persistent reportable property instance based on the warc-type
      */
     public AbstractReportable getWarcTypeProperties(WarcRecord record) {
+    	if (record == null) {
+    		throw new IllegalArgumentException("'record' should never be null");
+    	}
         AbstractReportable warcTypeProperties = null;
         if (record != null && record.header.warcTypeIdx != null) {
             switch (record.header.warcTypeIdx) {

src/main/java/org/jhove2/module/identify/file/LibmagicIdentifier.java

                                         throws IOException, JHOVE2Exception {
         // Extract MIME type and encoding using libmagic.
         String mimeType = null;
-        /*
+        /* The following code is not compatible with the current JHove2 core.
         if ((input != null) && (input.getSize() < input.getMaxBufferSize())) {
             // Memory buffer
             mimeType = libmagicWrapper.getMimeType(
                     source.getFile().getAbsolutePath());
         }
 
-        // debug
-        /*
-        System.out.println("#");
-        System.out.println("#");
-        System.out.println("# mime-type: " + mimeType);
-        System.out.println("#");
-        System.out.println("#");
-        */
-
         String typeWithEncoding = null;
         if (mimeType != null) {
             // Extract character encoding.
 
         String compiledMagicPath = null;
         if (this.magicFileDir != null) {
-        	// debug
-        	/*
-        	System.out.println("#");
-        	System.out.println("#");
-        	System.out.println("# MagicFile: " + magicFileDir.getAbsolutePath());
-        	System.out.println("#");
-        	System.out.println("#");
-        	*/
             // Magic source directory set. => Compile magic files.
         	if (libmagicWrapper.compile(
                                 magicFileDir.getAbsolutePath()) != 0) {

src/main/scripts/jhove2_debug.sh

 # usage and configuration information, see the JHOVE2 User's Guide at
 # http://jhove2.org.
 
-. ./env.sh
+ProgDir=`dirname "$0"`
+. "${ProgDir}/env.sh"
 
+if [ -z "${JAVA_OPTS}" ]; then
+  JAVA_OPTS="-Xms256m -Xmx1025m -XX:PermSize=64M -XX:MaxPermSize=256M"
+fi
 
-#${JAVA} -cp "$CP" org.jhove2.app.JHOVE2CommandLine $@
-
-${JAVA} -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 -Xms256m -Xmx1024m -XX:PermSize=64M -XX:MaxPermSize=256M -cp "$CP" org.jhove2.app.JHOVE2CommandLine $@
+"${JAVA}" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044 ${JAVA_OPTS} -cp "$CP" org.jhove2.app.JHOVE2CommandLine $@
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.