public boolean verify ( ) { this . errors = new LinkedList <> ( ) ; try ( BufferedReader reader = new BufferedReader ( new InputStreamReader ( generator . generate ( spaceId , ManifestFormat . TSV ) ) ) ) { WriteOnlyStringSet snapshotManifest = ManifestFileHelper . loadManifestSetFromFile ( this . md5Manifest ) ; log . info ( "loaded manifest set into memory." ) ; ManifestFormatter formatter = new TsvManifestFormatter ( ) ; // skip header if ( formatter . getHeader ( ) != null ) { reader . readLine ( ) ; } String line = null ; int stitchedManifestCount = 0 ; while ( ( line = reader . readLine ( ) ) != null ) { ManifestItem item = formatter . parseLine ( line ) ; String contentId = item . getContentId ( ) ; if ( ! contentId . equals ( Constants . SNAPSHOT_PROPS_FILENAME ) ) { if ( ! snapshotManifest . contains ( ManifestFileHelper . formatManifestSetString ( contentId , item . getContentChecksum ( ) ) ) ) { String message = "Snapshot manifest does not contain content id/checksum combination (" + contentId + ", " + item . getContentChecksum ( ) ; errors . add ( message ) ; } stitchedManifestCount ++ ; } } int snapshotCount = snapshotManifest . size ( ) ; if ( stitchedManifestCount != snapshotCount ) { String message = "Snapshot Manifest size (" + snapshotCount + ") does not equal DuraCloud Manifest (" + stitchedManifestCount + ")" ; errors . add ( message ) ; log . error ( message ) ; } } catch ( Exception e ) { String message = "Failed to verify space manifest against snapshot manifest:" + e . getMessage ( ) ; errors . add ( message ) ; log . error ( message , e ) ; } log . info ( "verification complete. error count = {}" , errors . size ( ) ) ; return getResult ( errors ) ; }
Performs the verification .