Project

General

Profile

« Previous | Next » 

Revision 5854

Added by berkley almost 14 years ago

bug fixes

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
705 705
            //get the doc from the remote host
706 706
            InputStream docStream = mnode.get(new AuthToken("public"), sm.getIdentifier());
707 707
            File outputTmpFile = getTempFile();
708
            System.out.println("wrote xml file to " + outputTmpFile.getAbsolutePath());
708 709
            FileOutputStream outputTmpFileStream = new FileOutputStream(outputTmpFile);
709 710
            IOUtils.copy(docStream, outputTmpFileStream);
710 711
            
711 712
            //verify checksum
712 713
            System.out.println("verifying checksum");
713
            String docChecksumStr = CrudService.checksum(
714
                    new FileInputStream(outputTmpFile), 
715
                    sm.getChecksum().getAlgorithm().toString());
716
            System.out.println("original checksum: " + sm.getChecksum().getValue());
717
            System.out.println(" created checksum: " + docChecksumStr);
714
            Checksum sourceFileChecksum = ServiceTypeUtil.checksum(new FileInputStream(outputTmpFile), 
715
                    sm.getChecksum().getAlgorithm());
718 716
            
717
            String cs1 = sm.getChecksum().getValue();
718
            String cs2 = sourceFileChecksum.getValue();
719
            System.out.println("original checksum: " + cs1);
720
            System.out.println(" created checksum: " + cs2);
719 721
            
722
            if(!cs1.equals(cs2))
723
            {
724
                System.out.println("ERROR: Checksums do not match!");
725
            }
726
            
720 727
            //insert the document in local db
721
            System.out.println("creating new doc");
722
            CrudService.getInstance().create(token, 
723
                    sm.getIdentifier(), new FileInputStream(outputTmpFile), sm);
728
            //System.out.println("creating new doc");
729
            //CrudService.getInstance().create(token, 
730
            //        sm.getIdentifier(), new FileInputStream(outputTmpFile), sm);
724 731
            //call cn.setReplicationStatus(guid, COMPLETE)
725 732
            
726 733
        }

Also available in: Unified diff