hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1569328 - in /httpcomponents/httpclient/branches/4.3.x: RELEASE_NOTES.txt httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
Date Tue, 18 Feb 2014 14:00:53 GMT
Author: olegk
Date: Tue Feb 18 14:00:53 2014
New Revision: 1569328

URL: http://svn.apache.org/r1569328
Log:
HTTPCLIENT-1461: fixes performance degradation in gzip encoded content processing introduced
by HTTPCLIENT-1432

Modified:
    httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java

Modified: httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt?rev=1569328&r1=1569327&r2=1569328&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.3.x/RELEASE_NOTES.txt Tue Feb 18 14:00:53 2014
@@ -4,6 +4,10 @@ Changes since 4.3.2
 Changelog:
 -------------------
 
+* [HTTPCLIENT-1461] fixed performance degradation in gzip encoded content processing
+  introduced by HTTPCLIENT-1432.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by
   SystemDefaultCredentialsProvider.
   Contributed by Oleg Kalnichevski <olegk at apache.org>

Modified: httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java?rev=1569328&r1=1569327&r2=1569328&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
(original)
+++ httpcomponents/httpclient/branches/4.3.x/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
Tue Feb 18 14:00:53 2014
@@ -50,6 +50,12 @@ class LazyDecompressingInputStream exten
         this.decompressingEntity = decompressingEntity;
     }
 
+    private void initWrapper() throws IOException {
+        if (wrapperStream == null) {
+            wrapperStream = decompressingEntity.decorate(wrappedStream);
+        }
+    }
+
     @Override
     public int read() throws IOException {
         initWrapper();
@@ -57,23 +63,43 @@ class LazyDecompressingInputStream exten
     }
 
     @Override
-    public int available() throws IOException {
+    public int read(final byte[] b) throws IOException {
         initWrapper();
-        return wrapperStream.available();
+        return wrapperStream.read(b);
     }
 
-    private void initWrapper() throws IOException {
-        if (wrapperStream == null) {
-            wrapperStream = decompressingEntity.decorate(wrappedStream);
-        }
+    @Override
+    public int read(final byte[] b, final int off, final int len) throws IOException {
+        initWrapper();
+        return wrapperStream.read(b, off, len);
+    }
+
+    @Override
+    public long skip(final long n) throws IOException {
+        initWrapper();
+        return wrapperStream.skip(n);
+    }
+
+    @Override
+    public boolean markSupported() {
+        return false;
+    }
+
+    @Override
+    public int available() throws IOException {
+        initWrapper();
+        return wrapperStream.available();
     }
 
     @Override
     public void close() throws IOException {
-        if (wrapperStream != null) {
-            wrapperStream.close();
+        try {
+            if (wrapperStream != null) {
+                wrapperStream.close();
+            }
+        } finally {
+            wrappedStream.close();
         }
-        wrappedStream.close();
     }
 
 }



Mime
View raw message