Skip to content

Commit fbb1de7

Browse files
Brennan StehlingbrennanMKE
authored andcommitted
WIP
1 parent efa5ef3 commit fbb1de7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

AWSS3/AWSS3TransferUtility.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ - (instancetype)initWithConfiguration:(AWSServiceConfiguration *)serviceConfigur
290290
delegateQueue:nil];
291291

292292
//If not able to create the session, call completion handler with error and return nil.
293-
if (!_session ) {
293+
if (!_session) {
294294
NSString* message = [NSString stringWithFormat:@"Failed to create a NSURLSession for [%@]", _sessionIdentifier];
295295
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:message
296296
forKey:@"Message"];
297297
NSError *error = [NSError errorWithDomain:AWSS3TransferUtilityErrorDomain
298298
code:AWSS3TransferUtilityErrorClientError
299299
userInfo:userInfo];
300-
if (completionHandler ) {
300+
if (completionHandler) {
301301
completionHandler(error);
302302
}
303303
return nil;
@@ -307,7 +307,7 @@ - (instancetype)initWithConfiguration:(AWSServiceConfiguration *)serviceConfigur
307307
_configuration = [serviceConfiguration copy];
308308
[_configuration addUserAgentProductToken:AWSS3TransferUtilityUserAgent];
309309

310-
if (transferUtilityConfiguration ) {
310+
if (transferUtilityConfiguration) {
311311
_transferUtilityConfiguration = [transferUtilityConfiguration copy];
312312
}
313313
else {
@@ -363,15 +363,15 @@ - (void) hydrateFromDB:(NSMutableDictionary *) tempMultiPartMasterTaskDictionary
363363
NSMutableArray *tasks = [AWSS3TransferUtilityDatabaseHelper getTransferTaskDataFromDB:_sessionIdentifier databaseQueue:_databaseQueue];
364364

365365
//Iterate through the tasks and populate transferRequests and Multipart dictionary.
366-
for( NSMutableDictionary *task in tasks ) {
366+
for( NSMutableDictionary *task in tasks) {
367367
NSString *transferType = [task objectForKey:@"transfer_type"];
368368
int sessionTaskID = [[task objectForKey:@"session_task_id"] intValue];
369369

370370
if ([transferType isEqualToString:@"UPLOAD"]) {
371371
AWSS3TransferUtilityUploadTask *transferUtilityUploadTask = [self hydrateUploadTask:task sessionIdentifier:self.sessionIdentifier databaseQueue:self.databaseQueue];
372372

373373
//If task is completed, no more processing is required.
374-
if (transferUtilityUploadTask.status == AWSS3TransferUtilityTransferStatusCompleted ) {
374+
if (transferUtilityUploadTask.status == AWSS3TransferUtilityTransferStatusCompleted) {
375375
[self.completedTaskDictionary setObject:transferUtilityUploadTask forKey:transferUtilityUploadTask.transferID];
376376
[AWSS3TransferUtilityDatabaseHelper deleteTransferRequestFromDB:transferUtilityUploadTask.transferID databaseQueue:self.databaseQueue];
377377
continue;
@@ -384,7 +384,7 @@ - (void) hydrateFromDB:(NSMutableDictionary *) tempMultiPartMasterTaskDictionary
384384
AWSS3TransferUtilityDownloadTask *transferUtilityDownloadTask = [self hydrateDownloadTask:task sessionIdentifier:self.sessionIdentifier databaseQueue:self.databaseQueue];
385385

386386
//If task is completed, no more processing is required.
387-
if (transferUtilityDownloadTask.status == AWSS3TransferUtilityTransferStatusCompleted ) {
387+
if (transferUtilityDownloadTask.status == AWSS3TransferUtilityTransferStatusCompleted) {
388388
[self.completedTaskDictionary setObject:transferUtilityDownloadTask forKey:transferUtilityDownloadTask.transferID];
389389
[AWSS3TransferUtilityDatabaseHelper deleteTransferRequestFromDB:transferUtilityDownloadTask.transferID databaseQueue:self.databaseQueue];
390390
continue;
@@ -416,7 +416,7 @@ - (void) hydrateFromDB:(NSMutableDictionary *) tempMultiPartMasterTaskDictionary
416416

417417
//Get the Master MultiPart record from the Dictionary.
418418
AWSS3TransferUtilityMultiPartUploadTask *multiPartUploadTask = [tempMultiPartMasterTaskDictionary objectForKey:subTask.uploadID];
419-
if ( !multiPartUploadTask ) {
419+
if ( !multiPartUploadTask) {
420420
//Couldn't find the multipart upload master record. Must be an orphan part record. Clean up the DB and continue.
421421
[AWSS3TransferUtilityDatabaseHelper deleteTransferRequestFromDB:subTask.transferID databaseQueue:self.databaseQueue];
422422
continue;
@@ -441,7 +441,7 @@ - (void) linkTransfersToNSURLSession:(NSMutableDictionary *) tempMultiPartMaster
441441
[self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) {
442442

443443
//Loop through all the upload Tasks.
444-
for( NSURLSessionUploadTask *task in uploadTasks ) {
444+
for( NSURLSessionUploadTask *task in uploadTasks) {
445445
AWSDDLogDebug(@"Iterating through task Identifier [%lu]", (unsigned long)task.taskIdentifier);
446446
NSError *taskError = [task error];
447447

@@ -495,7 +495,7 @@ - (void) linkTransfersToNSURLSession:(NSMutableDictionary *) tempMultiPartMaster
495495
}
496496

497497
//Loop through all the Download tasks
498-
for( NSURLSessionDownloadTask *task in downloadTasks ) {
498+
for( NSURLSessionDownloadTask *task in downloadTasks) {
499499
id obj = [tempTransferDictionary objectForKey:@(task.taskIdentifier)];
500500
NSError *taskError = [task error];
501501

@@ -594,7 +594,7 @@ - (void)handleUnlinkedTransfers:(NSMutableDictionary *)tempMultiPartMasterTaskDi
594594
{
595595
AWSS3TransferUtilityUploadTask *transferUtilityUploadTask = obj;
596596

597-
if (transferUtilityUploadTask.status == AWSS3TransferUtilityTransferStatusCompleted ) {
597+
if (transferUtilityUploadTask.status == AWSS3TransferUtilityTransferStatusCompleted) {
598598
[self.completedTaskDictionary setObject:transferUtilityUploadTask forKey:transferUtilityUploadTask.transferID];
599599

600600
//Delete the transfer record from the DB
@@ -626,7 +626,7 @@ - (void)handleUnlinkedTransfers:(NSMutableDictionary *)tempMultiPartMasterTaskDi
626626
else if ([obj isKindOfClass:[AWSS3TransferUtilityDownloadTask class]]) {
627627
AWSS3TransferUtilityDownloadTask *downloadTask = obj;
628628

629-
if (downloadTask.status == AWSS3TransferUtilityTransferStatusCompleted ) {
629+
if (downloadTask.status == AWSS3TransferUtilityTransferStatusCompleted) {
630630
[self.completedTaskDictionary setObject:downloadTask forKey:downloadTask.transferID];
631631
[AWSS3TransferUtilityDatabaseHelper deleteTransferRequestFromDB:downloadTask.transferID taskIdentifier:[taskIdentifier integerValue] databaseQueue:self.databaseQueue];
632632
AWSDDLogDebug(@"Deleted transfer request from DB");
@@ -929,7 +929,7 @@ - (NSURLSessionUploadTask *)getURLSessionUploadTaskWithRequest:(NSURLRequest *)
929929
return [[self.preSignedURLBuilder getPreSignedURL:getPreSignedURLRequest] continueWithBlock:^id(AWSTask *task) {
930930
NSURL *presignedURL = task.result;
931931
NSError *error = task.error;
932-
if ( error ) {
932+
if (error) {
933933
AWSDDLogError(@"Error: %@", error);
934934
return [AWSTask taskWithError:error];
935935
}
@@ -1173,7 +1173,7 @@ - (void) retryUpload: (AWSS3TransferUtilityUploadTask *) transferUtilityUploadTa
11731173
AWSS3CreateMultipartUploadOutput *output = task.result;
11741174

11751175
//Check if the uploadId is null to safeguard from crash reported in https://github.com/aws/aws-sdk-ios/issues/1060
1176-
if (output.uploadId == (id) [NSNull null] || output.uploadId.length == 0 ) {
1176+
if (output.uploadId == (id) [NSNull null] || output.uploadId.length == 0) {
11771177
AWSDDLogError(@"MultiPartUploadID is null - Failing Transfer");
11781178
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:@"MultiPartUploadID is null - Failing Transfer"
11791179
forKey:@"Message"];
@@ -1485,7 +1485,7 @@ - (void)completeMultiPartForUploadTask:(AWSS3TransferUtilityMultiPartUploadTask
14851485
transferUtilityMultiPartUploadTask.status = AWSS3TransferUtilityTransferStatusCompleted;
14861486

14871487
transferUtilityMultiPartUploadTask.progress.completedUnitCount = transferUtilityMultiPartUploadTask.progress.totalUnitCount;
1488-
if (transferUtilityMultiPartUploadTask.expression.progressBlock ) {
1488+
if (transferUtilityMultiPartUploadTask.expression.progressBlock) {
14891489
transferUtilityMultiPartUploadTask.expression.progressBlock(transferUtilityMultiPartUploadTask, transferUtilityMultiPartUploadTask.progress);
14901490
}
14911491
}
@@ -2125,7 +2125,7 @@ - (void)URLSession:(NSURLSession *)session
21252125
}
21262126

21272127
//Mark status as completed if there is no error.
2128-
if (! uploadTask.error ) {
2128+
if (!uploadTask.error) {
21292129
uploadTask.status = AWSS3TransferUtilityTransferStatusCompleted;
21302130
//Set progress to 100% and call the progress block
21312131
uploadTask.progress.completedUnitCount = uploadTask.progress.totalUnitCount;
@@ -2222,7 +2222,7 @@ - (void)URLSession:(NSURLSession *)session
22222222
downloadTask.error = error;
22232223
}
22242224

2225-
if (!downloadTask.error ) {
2225+
if (!downloadTask.error) {
22262226
downloadTask.status = AWSS3TransferUtilityTransferStatusCompleted;
22272227
}
22282228
else {
@@ -2354,7 +2354,7 @@ - (void)URLSession:(NSURLSession *)session
23542354
totalSentSoFar += aSubTask.totalBytesSent;
23552355
}
23562356

2357-
if (transferUtilityMultiPartUploadTask.progress.completedUnitCount != totalSentSoFar ) {
2357+
if (transferUtilityMultiPartUploadTask.progress.completedUnitCount != totalSentSoFar) {
23582358
transferUtilityMultiPartUploadTask.progress.totalUnitCount = [transferUtilityMultiPartUploadTask.contentLength longLongValue];
23592359
transferUtilityMultiPartUploadTask.progress.completedUnitCount = totalSentSoFar;
23602360

0 commit comments

Comments
 (0)