Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martijn00 committed Aug 3, 2023
1 parent 2b5f1e6 commit 00ba441
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Minio.Examples/Cases/RetryPolicyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static RetryPolicyHandler AsRetryDelegate(this AsyncPolicy<ResponseResult
{
return policy is null
? null
: async executeCallback => await policy.ExecuteAsync(executeCallback).ConfigureAwait(false);
: policy.ExecuteAsync;
}

public static MinioClient WithRetryPolicy(this MinioClient client, AsyncPolicy<ResponseResult> policy)
Expand Down
2 changes: 1 addition & 1 deletion Minio/Credentials/AssumeRoleProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public override async ValueTask<AccessCredentials> GetCredentialsAsync()
}
}

throw new ArgumentNullException(nameof(Client) + " should have been assigned for the operation to continue.");
throw new ArgumentNullException(nameof(Client), "Client should have been assigned for the operation to continue.");
}

internal override async Task<HttpRequestMessageBuilder> BuildRequest()
Expand Down
2 changes: 1 addition & 1 deletion Minio/Credentials/WebIdentityClientGrantsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ internal override AccessCredentials ParseResponse(HttpResponseMessage response)
protected void Validate()
{
if (JWTSupplier is null)
throw new ArgumentNullException(nameof(JWTSupplier) + " JWT Token supplier cannot be null.");
throw new ArgumentNullException(nameof(JWTSupplier), " JWT Token supplier cannot be null.");
if (STSEndpoint is null || string.IsNullOrWhiteSpace(STSEndpoint.AbsoluteUri))
throw new InvalidOperationException(nameof(STSEndpoint) + " value is invalid.");
}
Expand Down
2 changes: 1 addition & 1 deletion Minio/DataModel/Args/CompleteMultipartUploadArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal override void Validate()
{
base.Validate();
if (string.IsNullOrWhiteSpace(UploadId))
throw new ArgumentNullException(nameof(UploadId) + " cannot be empty.", nameof(UploadId));
throw new ArgumentNullException(nameof(UploadId), nameof(UploadId) + " cannot be empty.");
if (ETags is null || ETags.Count <= 0)
throw new InvalidOperationException(nameof(ETags) + " dictionary cannot be empty.");
}
Expand Down
3 changes: 1 addition & 2 deletions Minio/DataModel/Args/PutObjectPartArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ internal override void Validate()
{
base.Validate();
if (string.IsNullOrWhiteSpace(UploadId))
throw new ArgumentNullException(nameof(UploadId) + " not assigned for PutObjectPart operation.",
nameof(UploadId));
throw new ArgumentNullException(nameof(UploadId), nameof(UploadId) + " not assigned for PutObjectPart operation.");
}

public new PutObjectPartArgs WithBucket(string bkt)
Expand Down
2 changes: 1 addition & 1 deletion Minio/DataModel/Select/SelectResponseStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public SelectResponseStream(Stream stream)
Start();
}

public Stream Payload { get; set; }
public Stream Payload { get; private set; }

[XmlElement("Stats", IsNullable = false)]
public StatsMessage Stats { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions Minio/DataModel/Tags/Tagging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public Tagging(IDictionary<string, string> tags, bool isObjects)

foreach (var tag in tags)
{
if (!ValidateTagKey(tag.Key)) throw new ArgumentException("Invalid Tagging key " + tag.Key);
if (!ValidateTagValue(tag.Value)) throw new ArgumentException("Invalid Tagging value " + tag.Value);
if (!ValidateTagKey(tag.Key)) throw new ArgumentException("Invalid Tagging key " + tag.Key, nameof(tag.Key));
if (!ValidateTagValue(tag.Value)) throw new ArgumentException("Invalid Tagging value " + tag.Value, nameof(tag.Value));
}

TaggingSet = new TagSet(tags);
Expand Down
2 changes: 1 addition & 1 deletion Minio/Helper/S3utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal static string GetPath(string p1, string p2)
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
throw new ArgumentException(ex.Message, nameof(ex));
}
}

Expand Down
34 changes: 13 additions & 21 deletions Minio/ResponseResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@

namespace Minio;

public class ResponseResult : IDisposable
public sealed class ResponseResult : IDisposable
{
private readonly Dictionary<string, string> headers = new(StringComparer.Ordinal);
private string content;
private ReadOnlyMemory<byte> contentBytes;
private bool disposedValue;

private Stream stream;
private bool disposed;

public ResponseResult(HttpRequestMessage request, HttpResponseMessage response)
{
Expand Down Expand Up @@ -125,26 +124,19 @@ public IDictionary<string, string> Headers

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
if (disposed)
{
if (disposing)
{
stream?.Dispose();
Request?.Dispose();
Response?.Dispose();
return;
}

content = null;
contentBytes = null;
stream = null;
}
stream?.Dispose();
Request?.Dispose();
Response?.Dispose();

disposedValue = true;
}
content = null;
contentBytes = null;
stream = null;

disposed = true;
}
}

0 comments on commit 00ba441

Please sign in to comment.