hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1773438 - in /httpcomponents/httpcore/trunk/httpcore5-h2/src: main/java/org/apache/hc/core5/http2/frame/RawFrame.java test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
Date Fri, 09 Dec 2016 16:48:38 GMT
Author: olegk
Date: Fri Dec  9 16:48:38 2016
New Revision: 1773438

URL: http://svn.apache.org/viewvc?rev=1773438&view=rev
Log:
Do not use read-only heap ByteBuffer as it does not allow for direct access to the underlying
byte array

Modified:
    httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
    httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java?rev=1773438&r1=1773437&r2=1773438&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/frame/RawFrame.java
Fri Dec  9 16:48:38 2016
@@ -64,9 +64,9 @@ public final class RawFrame extends Fram
                     return null;
                 }
                 dup.limit(dup.limit() - padding);
-                return dup.asReadOnlyBuffer();
+                return dup;
             } else {
-                return payload.asReadOnlyBuffer();
+                return payload.duplicate();
             }
         } else {
             return null;
@@ -75,7 +75,7 @@ public final class RawFrame extends Fram
 
     @Override
     public ByteBuffer getPayload() {
-        return payload != null ? payload.asReadOnlyBuffer() : null;
+        return payload != null ? payload.duplicate() : null;
     }
 
 }

Modified: httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java?rev=1773438&r1=1773437&r2=1773438&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/WritableByteChannelMock.java
Fri Dec  9 16:48:38 2016
@@ -106,12 +106,6 @@ public class WritableByteChannelMock imp
         this.buf.clear();
     }
 
-    public ByteBuffer asReadOnly() {
-        final ByteBuffer dup = this.buf.duplicate();
-        dup.flip();
-        return dup.asReadOnlyBuffer();
-    }
-
     public byte[] toByteArray() {
         final ByteBuffer dup = this.buf.duplicate();
         dup.flip();



Mime
View raw message