You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/11/07 02:57:35 UTC

[lucenenet] 08/09: BREAKING: Lucene.Net.Replicator.Http:HttpClientBase: Renamed ResponseInputStream() overloads GetResponseStream() per .NET conventions.

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit be44d86a3acfb6dd4605d0a10f8506d55d357a7a
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sat Nov 6 17:43:32 2021 +0700

    BREAKING: Lucene.Net.Replicator.Http:HttpClientBase: Renamed ResponseInputStream() overloads GetResponseStream() per .NET conventions.
---
 src/Lucene.Net.Replicator/Http/HttpClientBase.cs | 24 +++++++++++++++++++++++-
 src/Lucene.Net.Replicator/Http/HttpReplicator.cs |  4 ++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Replicator/Http/HttpClientBase.cs b/src/Lucene.Net.Replicator/Http/HttpClientBase.cs
index 9621fe9..ecf0754 100644
--- a/src/Lucene.Net.Replicator/Http/HttpClientBase.cs
+++ b/src/Lucene.Net.Replicator/Http/HttpClientBase.cs
@@ -264,9 +264,10 @@ namespace Lucene.Net.Replicator.Http
         /// Internal utility: input stream of the provided response.
         /// </summary>
         /// <exception cref="IOException"></exception>
+        [Obsolete("Use GetResponseStream(HttpResponseMessage) instead.  This extension method will be removed in 4.8.0 release candidate.")]
         public virtual Stream ResponseInputStream(HttpResponseMessage response)
         {
-            return ResponseInputStream(response, false);
+            return GetResponseStream(response, false);
         }
 
         // TODO: can we simplify this Consuming !?!?!?
@@ -275,8 +276,29 @@ namespace Lucene.Net.Replicator.Http
         /// consumes the response's resources when the input stream is exhausted.
         /// </summary>
         /// <exception cref="IOException"></exception>
+        [Obsolete("Use GetResponseStream(HttpResponseMessage, bool) instead.  This extension method will be removed in 4.8.0 release candidate.")]
         public virtual Stream ResponseInputStream(HttpResponseMessage response, bool consume)
         {
+            return GetResponseStream(response, consume);
+        }
+
+        /// <summary>
+        /// Internal utility: input stream of the provided response.
+        /// </summary>
+        /// <exception cref="IOException"></exception>
+        public virtual Stream GetResponseStream(HttpResponseMessage response) // LUCENENET: This was ResponseInputStream in Lucene
+        {
+            return GetResponseStream(response, false);
+        }
+
+        // TODO: can we simplify this Consuming !?!?!?
+        /// <summary>
+        /// Internal utility: input stream of the provided response, which optionally 
+        /// consumes the response's resources when the input stream is exhausted.
+        /// </summary>
+        /// <exception cref="IOException"></exception>
+        public virtual Stream GetResponseStream(HttpResponseMessage response, bool consume) // LUCENENET: This was ResponseInputStream in Lucene
+        {
             Stream result = response.Content.ReadAsStreamAsync().ConfigureAwait(false).GetAwaiter().GetResult();
             if (consume)
                 result = new ConsumingStream(result);
diff --git a/src/Lucene.Net.Replicator/Http/HttpReplicator.cs b/src/Lucene.Net.Replicator/Http/HttpReplicator.cs
index 23a0447..72f547b 100644
--- a/src/Lucene.Net.Replicator/Http/HttpReplicator.cs
+++ b/src/Lucene.Net.Replicator/Http/HttpReplicator.cs
@@ -71,7 +71,7 @@ namespace Lucene.Net.Replicator.Http
             HttpResponseMessage response = base.ExecuteGet(ReplicationService.ReplicationAction.UPDATE.ToString(), parameters);
             return DoAction(response, () =>
             {
-                using DataInputStream inputStream = new DataInputStream(ResponseInputStream(response));
+                using DataInputStream inputStream = new DataInputStream(GetResponseStream(response));
                 return inputStream.ReadByte() == 0 ? null : new SessionToken(inputStream);
             });
         }
@@ -85,7 +85,7 @@ namespace Lucene.Net.Replicator.Http
                 ReplicationService.REPLICATE_SESSION_ID_PARAM, sessionId,
                 ReplicationService.REPLICATE_SOURCE_PARAM, source,
                 ReplicationService.REPLICATE_FILENAME_PARAM, fileName);
-            return DoAction(response, false, () => ResponseInputStream(response));
+            return DoAction(response, false, () => GetResponseStream(response));
         }
 
         /// <summary>