private static void populateArtifactMetadataFromFile( ArtifactMetadata metadata, File file )
{
metadata.setWhenGathered( new Date() );
metadata.setFileLastModified( file.lastModified() );
ChecksummedFile checksummedFile = new ChecksummedFile( file );
try
{
metadata.setMd5( checksummedFile.calculateChecksum( ChecksumAlgorithm.MD5 ) );
}
catch ( IOException e )
{
log.error( "Unable to checksum file {}: {},MD5", file, e.getMessage() );
}
try
{
metadata.setSha1( checksummedFile.calculateChecksum( ChecksumAlgorithm.SHA1 ) );
}
catch ( IOException e )
{
log.error( "Unable to checksum file {}: {},SHA1", file, e.getMessage() );
}