Skip to content

Commit 751497c

Browse files
author
justin
committed
Fixes deffect in FileSystemWriter.
1 parent 22cd94f commit 751497c

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ a bad thing.
3131

3232
RELEASE NOTES:
3333

34+
Changes in 4.8.1:
35+
1. Bug fix to FileSystemWriter to handle files that did do not already exist.
36+
3437
Changes in 4.8:
3538
1. Added additional convenience method to FileHelper.
3639

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
66
<artifactId>bagit</artifactId>
77
<packaging>jar</packaging>
88
<name>BagIt Implementation</name>
9-
<version>4.9-SNAPSHOT</version>
9+
<version>4.8.1-SNAPSHOT</version>
1010
<description>A software library that supports the creation,
1111
manipulation, and validation of bags according to the BagIt
1212
specification.</description>

src/main/java/gov/loc/repository/bagit/transformer/impl/CompleterHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public Map<String,String> call() {
216216
}
217217
if (in == null) in = bag.getBagFile(filepath).newInputStream();
218218
checksum = MessageDigestHelper.generateFixity(in, manifest.getAlgorithm());
219+
log.trace(MessageFormat.format("Fixity for {0} is {1}.", filepath, checksum));
219220
}
220221
manifestEntries.put(filepath, checksum);
221222

src/main/java/gov/loc/repository/bagit/writer/impl/FileSystemWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private void removeExtraFiles(File dir, boolean recurse) {
260260
private boolean fileMatchesManifest(BagFile bagFile, File file) {
261261
Map<Algorithm, String> checksumMap = this.origBag.getChecksums(bagFile.getFilepath());
262262
boolean res = false;
263-
if (! checksumMap.isEmpty()) {
263+
if (file.exists() && ! checksumMap.isEmpty()) {
264264
//Pick an algorithm and check
265265
java.util.Map.Entry<Algorithm, String> entry = checksumMap.entrySet().iterator().next();
266266
try {

0 commit comments

Comments
 (0)