ok2c commented on code in PR #453:
URL: 
https://github.com/apache/httpcomponents-client/pull/453#discussion_r1225286591


##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/HttpByteArrayCacheEntrySerializer.java:
##########
@@ -230,316 +233,174 @@ public HttpCacheStorageEntry deserialize(final byte[] 
serializedObject) throws R
         if (serializedObject == null || serializedObject.length == 0) {
             throw new ResourceIOException("Serialized object is null or 
empty");
         }
-        try (final InputStream in = new ByteArrayInputStream(serializedObject);
-             final ByteArrayOutputStream bytesOut = new 
ByteArrayOutputStream(serializedObject.length) // this is bigger than necessary 
but will save us from reallocating
-        ) {
+        try (final InputStream in = new 
ByteArrayInputStream(serializedObject)) {
             final SessionInputBufferImpl inputBuffer = new 
SessionInputBufferImpl(bufferSize);
-            final SimpleHttpResponse response = 
responseParser.parse(inputBuffer, in);
-
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Deserializing cache entry with headers: {}", 
response.getHeaders());
+            final CharArrayBuffer line = new 
CharArrayBuffer(DEFAULT_BUFFER_SIZE);
+            checkReadResult(inputBuffer.readLine(line, in));
+            final String versionLine = line.toString();
+            if (!versionLine.equals(HC_CACHE_VERSION_LINE)) {
+                throw new ResourceIOException("Unexpected cache entry version 
line");
+            }
+            final List<Header> cacheHeaders = new ArrayList<>();
+            while (true) {

Review Comment:
   @arturobernalg Corrected.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to