Skip to content

Commit 9c6e851

Browse files
committed
add logs for publishing file validation
1 parent 9ca568d commit 9c6e851

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,8 @@ public static S3AccessIO getS3AccessForDirectUpload(Dataset dataset) {
17071707

17081708
public static void validateDataFileChecksum(DataFile dataFile) throws IOException {
17091709
DataFile.ChecksumType checksumType = dataFile.getChecksumType();
1710+
1711+
logger.info(checksumType.toString());
17101712
if (checksumType == null) {
17111713
String info = BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.noChecksumType", Arrays.asList(dataFile.getId().toString()));
17121714
logger.log(Level.INFO, info);
@@ -1720,6 +1722,7 @@ public static void validateDataFileChecksum(DataFile dataFile) throws IOExceptio
17201722
storage.open(DataAccessOption.READ_ACCESS);
17211723

17221724
if (!dataFile.isTabularData()) {
1725+
logger.info("It is not tabular");
17231726
in = storage.getInputStream();
17241727
} else {
17251728
// if this is a tabular file, read the preserved original "auxiliary file"
@@ -1738,7 +1741,9 @@ public static void validateDataFileChecksum(DataFile dataFile) throws IOExceptio
17381741

17391742
String recalculatedChecksum = null;
17401743
try {
1744+
logger.info("Before calculating checksum");
17411745
recalculatedChecksum = FileUtil.calculateChecksum(in, checksumType);
1746+
logger.info("Checksum:" + recalculatedChecksum);
17421747
} catch (RuntimeException rte) {
17431748
recalculatedChecksum = null;
17441749
} finally {
@@ -1757,6 +1762,9 @@ public static void validateDataFileChecksum(DataFile dataFile) throws IOExceptio
17571762
if (!recalculatedChecksum.equals(dataFile.getChecksumValue())) {
17581763
// There's one possible condition that is 100% recoverable and can
17591764
// be automatically fixed (issue #6660):
1765+
logger.info(dataFile.getChecksumValue());
1766+
logger.info(recalculatedChecksum);
1767+
logger.info("Checksums are not equal");
17601768
boolean fixed = false;
17611769
if (!dataFile.isTabularData() && dataFile.getIngestReport() != null) {
17621770
// try again, see if the .orig file happens to be there:
@@ -1786,6 +1794,7 @@ public static void validateDataFileChecksum(DataFile dataFile) throws IOExceptio
17861794
}
17871795

17881796
if (!fixed) {
1797+
logger.info("checksum cannot be fixed");
17891798
String info = BundleUtil.getStringFromBundle("dataset.publish.file.validation.error.wrongChecksumValue", Arrays.asList(dataFile.getId().toString()));
17901799
logger.log(Level.INFO, info);
17911800
throw new IOException(info);

0 commit comments

Comments
 (0)