httpcomponents-core/httpcomponents-core-java8compat.patch

547 lines
22 KiB
Diff

--- httpcomponents-core-4.4.13/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java 2020-04-01 11:34:15.820448452 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetDecoder;
@@ -364,7 +365,7 @@
}
final CoderResult result = this.decoder.flush(this.cbuf);
len += handleDecodingResult(result, charbuffer, bbuf);
- this.cbuf.clear();
+ ((Buffer)(this.cbuf)).clear();
return len;
}
@@ -375,7 +376,7 @@
if (result.isError()) {
result.throwException();
}
- this.cbuf.flip();
+ ((Buffer)(this.cbuf)).flip();
final int len = this.cbuf.remaining();
while (this.cbuf.hasRemaining()) {
charbuffer.append(this.cbuf.get());
--- httpcomponents-core-4.4.13/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java 2020-04-01 11:34:15.820448452 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharsetEncoder;
@@ -269,7 +270,7 @@
}
final CoderResult result = this.encoder.flush(this.bbuf);
handleEncodingResult(result);
- this.bbuf.clear();
+ ((Buffer)(this.bbuf)).clear();
}
private void handleEncodingResult(final CoderResult result) throws IOException {
--- httpcomponents-core-4.4.13/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java 2020-04-01 11:34:15.820448452 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -367,7 +368,7 @@
}
final CoderResult result = this.decoder.flush(this.cbuf);
len += handleDecodingResult(result, charbuffer, bbuf);
- this.cbuf.clear();
+ ((Buffer)(this.cbuf)).clear();
return len;
}
@@ -378,7 +379,7 @@
if (result.isError()) {
result.throwException();
}
- this.cbuf.flip();
+ ((Buffer)(this.cbuf)).flip();
final int len = this.cbuf.remaining();
while (this.cbuf.hasRemaining()) {
charbuffer.append(this.cbuf.get());
--- httpcomponents-core-4.4.13/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java 2020-04-01 11:34:15.824448473 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@@ -293,14 +294,14 @@
}
final CoderResult result = this.encoder.flush(this.bbuf);
handleEncodingResult(result);
- this.bbuf.clear();
+ ((Buffer)(this.bbuf)).clear();
}
private void handleEncodingResult(final CoderResult result) throws IOException {
if (result.isError()) {
result.throwException();
}
- this.bbuf.flip();
+ ((Buffer)(this.bbuf)).flip();
while (this.bbuf.hasRemaining()) {
write(this.bbuf.get());
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java 2020-04-01 11:34:15.824448473 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.InetSocketAddress;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.apache.http.impl.nio.reactor.DefaultListeningIOReactor;
@@ -83,7 +84,7 @@
public void outputReady(final IOSession session) {
System.out.println("writeable");
try {
- this.buffer.flip();
+ ((Buffer)(this.buffer)).flip();
final int bytesWritten = session.channel().write(this.buffer);
if (!this.buffer.hasRemaining()) {
session.setEventMask(EventMask.READ);
--- httpcomponents-core-4.4.13/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java 2020-04-01 11:34:15.824448473 +0200
@@ -31,6 +31,7 @@
import java.net.InetSocketAddress;
import java.net.SocketTimeoutException;
import java.net.URI;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -341,8 +342,8 @@
}
public void reset() {
- this.inBuffer.clear();
- this.outBuffer.clear();
+ ((Buffer)(this.inBuffer)).clear();
+ ((Buffer)(this.outBuffer)).clear();
this.target = null;
this.id = null;
this.responseTrigger = null;
@@ -553,7 +554,7 @@
this.httpExchange.setOriginIOControl(ioControl);
// Send data to the origin server
final ByteBuffer buf = this.httpExchange.getInBuffer();
- buf.flip();
+ ((Buffer)buf).flip();
final int n = encoder.write(buf);
buf.compact();
System.out.println("[proxy->origin] " + this.httpExchange.getId() + " " + n + " bytes written");
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentDecoder.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentDecoder.java 2020-04-01 11:34:15.824448473 +0200
@@ -28,6 +28,7 @@
package org.apache.http.impl.nio.codecs;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
@@ -147,9 +148,9 @@
if (dst.remaining() > limit) {
final int oldLimit = dst.limit();
final int newLimit = oldLimit - (dst.remaining() - limit);
- dst.limit(newLimit);
+ ((Buffer)dst).limit(newLimit);
bytesRead = this.channel.read(dst);
- dst.limit(oldLimit);
+ ((Buffer)dst).limit(oldLimit);
} else {
bytesRead = this.channel.read(dst);
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java 2020-04-01 11:34:15.824448473 +0200
@@ -28,6 +28,7 @@
package org.apache.http.impl.nio.codecs;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
@@ -157,9 +158,9 @@
if (src.remaining() > chunk) {
final int oldLimit = src.limit();
final int newLimit = oldLimit - (src.remaining() - chunk);
- src.limit(newLimit);
+ ((Buffer)src).limit(newLimit);
bytesWritten = doWriteChunk(src, direct);
- src.limit(oldLimit);
+ ((Buffer)src).limit(oldLimit);
} else {
bytesWritten = doWriteChunk(src, direct);
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java 2020-04-01 11:34:15.824448473 +0200
@@ -28,6 +28,7 @@
package org.apache.http.impl.nio.codecs;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.WritableByteChannel;
@@ -110,9 +111,9 @@
this.lineBuffer.append(Integer.toHexString(chunk));
this.buffer.writeLine(this.lineBuffer);
final int oldlimit = src.limit();
- src.limit(src.position() + chunk);
+ ((Buffer)src).limit(src.position() + chunk);
this.buffer.write(src);
- src.limit(oldlimit);
+ ((Buffer)src).limit(oldlimit);
} else {
// write all
this.lineBuffer.clear();
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java 2020-04-01 11:41:03.098682887 +0200
@@ -28,6 +28,7 @@
package org.apache.http.impl.nio.reactor;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ReadableByteChannel;
@@ -248,9 +249,9 @@
if (this.buffer.remaining() > chunk) {
final int oldLimit = this.buffer.limit();
final int newLimit = this.buffer.position() + chunk;
- this.buffer.limit(newLimit);
+ ((Buffer)(this.buffer)).limit(newLimit);
dst.put(this.buffer);
- this.buffer.limit(oldLimit);
+ ((Buffer)(this.buffer)).limit(oldLimit);
return len;
}
dst.put(this.buffer);
@@ -275,9 +276,9 @@
if (this.buffer.remaining() > maxLen) {
final int oldLimit = this.buffer.limit();
final int newLimit = oldLimit - (this.buffer.remaining() - maxLen);
- this.buffer.limit(newLimit);
+ ((Buffer)(this.buffer)).limit(newLimit);
bytesRead = dst.write(this.buffer);
- this.buffer.limit(oldLimit);
+ ((Buffer)(this.buffer)).limit(oldLimit);
} else {
bytesRead = dst.write(this.buffer);
}
@@ -328,7 +329,7 @@
}
}
final int origLimit = this.buffer.limit();
- this.buffer.limit(pos);
+ ((Buffer)(this.buffer)).limit(pos);
final int requiredCapacity = this.buffer.limit() - this.buffer.position();
// Ensure capacity of len assuming ASCII as the most likely charset
@@ -340,7 +341,7 @@
final int off = this.buffer.position();
final int len = this.buffer.remaining();
lineBuffer.append(b, off, len);
- this.buffer.position(off + len);
+ ((Buffer)this.buffer).position(off + len);
} else {
while (this.buffer.hasRemaining()) {
lineBuffer.append((char) (this.buffer.get() & 0xff));
@@ -361,12 +362,12 @@
result.throwException();
}
if (result.isOverflow()) {
- this.charBuffer.flip();
+ ((Buffer)this.charBuffer).flip();
lineBuffer.append(
this.charBuffer.array(),
this.charBuffer.position(),
this.charBuffer.remaining());
- this.charBuffer.clear();
+ ((Buffer)this.charBuffer).clear();
}
if (result.isUnderflow()) {
break;
@@ -375,7 +376,7 @@
// flush the decoder
this.charDecoder.flush(this.charBuffer);
- this.charBuffer.flip();
+ ((Buffer)this.charBuffer).flip();
// append the decoded content to the line buffer
if (this.charBuffer.hasRemaining()) {
lineBuffer.append(
@@ -385,7 +386,7 @@
}
}
- this.buffer.limit(origLimit);
+ ((Buffer)(this.buffer)).limit(origLimit);
// discard LF if found
int len = lineBuffer.length();
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java 2020-04-01 11:42:00.798999509 +0200
@@ -28,6 +28,7 @@
package org.apache.http.impl.nio.reactor;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ReadableByteChannel;
@@ -259,7 +260,7 @@
eol = true;
}
this.charBuffer.put(lineBuffer.buffer(), offset, l);
- this.charBuffer.flip();
+ ((Buffer)this.charBuffer).flip();
boolean retry = true;
while (retry) {
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java 2020-04-01 11:34:15.828448495 +0200
@@ -29,6 +29,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
@@ -65,7 +66,7 @@
this.channel = Channels.newChannel(this.entity.getContent());
}
final int i = this.channel.read(this.buffer);
- this.buffer.flip();
+ ((Buffer)(this.buffer)).flip();
encoder.write(this.buffer);
final boolean buffering = this.buffer.hasRemaining();
this.buffer.compact();
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java 2020-04-01 11:34:15.828448495 +0200
@@ -31,6 +31,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.apache.http.entity.AbstractHttpEntity;
@@ -116,7 +117,7 @@
*/
@Override
public void close() {
- this.buf.rewind();
+ ((Buffer)(this.buf)).rewind();
}
/**
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java 2020-04-01 11:34:15.828448495 +0200
@@ -32,6 +32,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
@@ -155,7 +156,7 @@
*/
@Override
public void close() {
- this.buf.rewind();
+ ((Buffer)(this.buf)).rewind();
}
/**
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java 2020-04-01 11:34:15.828448495 +0200
@@ -28,6 +28,7 @@
package org.apache.http.nio.protocol;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.apache.http.HttpRequest;
@@ -54,7 +55,7 @@
final ContentDecoder decoder, final IOControl ioControl) throws IOException {
int lastRead;
do {
- this.buffer.clear();
+ ((Buffer)(this.buffer)).clear();
lastRead = decoder.read(this.buffer);
} while (lastRead > 0);
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java 2019-12-07 14:35:57.000000000 +0100
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java 2020-04-01 11:36:25.309158888 +0200
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.ByteChannel;
import java.nio.channels.CancelledKeyException;
@@ -327,7 +328,7 @@
final ByteBuffer inPlainBuf = this.inPlain.acquire();
// Perform operations
- inEncryptedBuf.flip();
+ ((Buffer)inEncryptedBuf).flip();
try {
result = doUnwrap(inEncryptedBuf, inPlainBuf);
} finally {
@@ -448,7 +449,7 @@
final int bytesWritten;
// Perform operation
- outEncryptedBuf.flip();
+ ((Buffer)outEncryptedBuf).flip();
try {
bytesWritten = this.session.channel().write(outEncryptedBuf);
} finally {
@@ -492,7 +493,7 @@
final SSLEngineResult result;
// Perform operations
- inEncryptedBuf.flip();
+ ((Buffer)inEncryptedBuf).flip();
try {
result = doUnwrap(inEncryptedBuf, inPlainBuf);
} finally {
@@ -613,7 +614,7 @@
final ByteBuffer inPlainBuf = this.inPlain.acquire();
// Perform opertaions
- inPlainBuf.flip();
+ ((Buffer)inPlainBuf).flip();
final int n = Math.min(inPlainBuf.remaining(), dst.remaining());
for (int i = 0; i < n; i++) {
dst.put(inPlainBuf.get());
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java 2020-04-01 11:34:15.828448495 +0200
@@ -27,6 +27,7 @@
package org.apache.http.nio.util;
+import java.nio.Buffer;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
@@ -85,7 +86,7 @@
*/
protected void setOutputMode() {
if (this.mode != OUTPUT_MODE) {
- this.buffer.flip();
+ ((Buffer)(this.buffer)).flip();
this.mode = OUTPUT_MODE;
}
}
@@ -98,7 +99,7 @@
if (this.buffer.hasRemaining()) {
this.buffer.compact();
} else {
- this.buffer.clear();
+ ((Buffer)(this.buffer)).clear();
}
this.mode = INPUT_MODE;
}
@@ -107,7 +108,7 @@
private void expandCapacity(final int capacity) {
final ByteBuffer oldbuffer = this.buffer;
this.buffer = allocator.allocate(capacity);
- oldbuffer.flip();
+ ((Buffer)oldbuffer).flip();
this.buffer.put(oldbuffer);
}
@@ -196,7 +197,7 @@
* Clears buffer.
*/
protected void clear() {
- this.buffer.clear();
+ ((Buffer)(this.buffer)).clear();
this.mode = INPUT_MODE;
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java 2020-04-01 11:34:15.828448495 +0200
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
@@ -86,7 +87,7 @@
final ContentEncoder encoder,
final IOControl ioControl) throws IOException {
final int i = this.channel.read(this.buffer);
- this.buffer.flip();
+ ((Buffer)(this.buffer)).flip();
encoder.write(this.buffer);
final boolean buffering = this.buffer.hasRemaining();
this.buffer.compact();
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java 2020-04-01 11:34:15.828448495 +0200
@@ -28,6 +28,7 @@
package org.apache.http.nio.entity;
import java.io.IOException;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.apache.http.nio.ContentDecoder;
@@ -59,7 +60,7 @@
final IOControl ioControl) throws IOException {
int lastRead;
do {
- buffer.clear();
+ ((Buffer)buffer).clear();
lastRead = decoder.read(buffer);
} while (lastRead > 0);
}
--- httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java 2019-10-23 15:36:25.000000000 +0200
+++ httpcomponents-core-4.4.13/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java 2020-04-01 11:34:15.828448495 +0200
@@ -30,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import org.apache.http.HttpEntity;
@@ -72,7 +73,7 @@
final IOControl ioControl) throws IOException {
int lastRead;
do {
- buffer.clear();
+ ((Buffer)buffer).clear();
lastRead = decoder.read(buffer);
} while (lastRead > 0);
}