~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: james.westby@ubuntu.com-20091201210928-o2dvg0ubljhb0ft6
Tags: upstream-1.6.1~bzr1083
ImportĀ upstreamĀ versionĀ 1.6.1~bzr1083

Show diffs side-by-side

added added

removed removed

Lines of Context:
608
608
                                                } else if(WalrusDataMessage.isEOF(dataMessage)) {
609
609
                                                        //commit object
610
610
                                                        try {
611
 
                                                                fileIO.finish();
 
611
                                                                if(fileIO != null)
 
612
                                                                        fileIO.finish();
612
613
                                                                storageManager.renameObject(bucketName, tempObjectName, objectName);
613
614
                                                        } catch (IOException ex) {
614
615
                                                                LOG.error(ex);
615
616
                                                                messenger.removeQueue(key, randomKey);
616
617
                                                                throw new EucalyptusCloudException(objectKey);
617
618
                                                        }
618
 
                                                        md5 = Hashes.bytesToHex(digest.digest());
 
619
                                                        if(digest != null)
 
620
                                                                md5 = Hashes.bytesToHex(digest.digest());
619
621
                                                        lastModified = new Date();
620
622
                                                        dbObject = WalrusControl.getEntityWrapper();
621
623
                                                        objectInfos = dbObject.query(new ObjectInfo(bucketName, objectKey));
670
672
                                                                md5 = monitor.getMd5();
671
673
                                                        }
672
674
                                                        //ok we are done here
673
 
                                                        fileIO.finish();
 
675
                                                        if(fileIO != null)
 
676
                                                                fileIO.finish();
674
677
                                                        ObjectDeleter objectDeleter = new ObjectDeleter(bucketName, tempObjectName, -1L);
675
678
                                                        objectDeleter.start();
676
679
                                                        LOG.info("Transfer interrupted: "+ key);
680
683
                                                        byte[] data = dataMessage.getPayload();
681
684
                                                        //start writing object (but do not commit yet)
682
685
                                                        try {
683
 
                                                                fileIO.write(data);
 
686
                                                                if(fileIO != null)
 
687
                                                                        fileIO.write(data);
684
688
                                                        } catch (IOException ex) {
685
689
                                                                LOG.error(ex);
686
690
                                                        }
687
691
                                                        //calculate md5 on the fly
688
692
                                                        size += data.length;
689
 
                                                        digest.update(data);
 
693
                                                        if(digest != null)
 
694
                                                                digest.update(data);
690
695
                                                }
691
696
                                        }
692
697
                                } catch (InterruptedException ex) {
840
845
                                        foundObject.setObjectName(objectName);
841
846
                                        try {
842
847
                                                FileIO fileIO = storageManager.prepareForWrite(bucketName, objectName);
843
 
                                                fileIO.write(base64Data);
844
 
                                                fileIO.finish();
 
848
                                                if(fileIO != null) {
 
849
                                                        fileIO.write(base64Data);
 
850
                                                        fileIO.finish();
 
851
                                                }
845
852
                                        } catch(Exception ex) {
846
853
                                                throw new EucalyptusCloudException(ex);
847
854
                                        }
1089
1096
                                                                                if(!foundPrefix) {
1090
1097
                                                                                        prefixes.add(new PrefixEntry(prefixString));
1091
1098
                                                                                        if(maxKeys >= 0) {
1092
 
                                                                                                if(howManyProcessed++ > maxKeys) {
 
1099
                                                                                                if(howManyProcessed++ >= maxKeys) {
1093
1100
                                                                                                        reply.setIsTruncated(true);
1094
1101
                                                                                                        break;
1095
1102
                                                                                                }
1101
1108
                                                        }
1102
1109
                                                }
1103
1110
                                                if(maxKeys >= 0) {
1104
 
                                                        if(howManyProcessed++ > maxKeys) {
 
1111
                                                        if(howManyProcessed++ >= maxKeys) {
1105
1112
                                                                reply.setIsTruncated(true);
1106
1113
                                                                break;
1107
1114
                                                        }