httpcomponents-core/httpcomponents-core-java8compat.patch

547 lines
22 KiB
Diff
Raw Normal View History

--- httpcomponents-core-4.4.10/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java 2017-06-15 13:33:20.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java 2019-03-13 09:49:02.215922903 +0100
@@ -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;
@@ -366,7 +367,7 @@
}
final CoderResult result = this.decoder.flush(this.cbuf);
len += handleDecodingResult(result, charbuffer, bbuf);
- this.cbuf.clear();
+ ((Buffer)(this.cbuf)).clear();
return len;
}
@@ -377,7 +378,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.10/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java 2017-05-12 09:14:53.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore/src/main/java/org/apache/http/impl/io/SessionOutputBufferImpl.java 2019-03-13 09:46:50.107248277 +0100
@@ -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.10/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java 2017-05-12 09:14:53.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionInputBuffer.java 2019-03-13 09:44:05.490407553 +0100
@@ -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;
@@ -369,7 +370,7 @@
}
final CoderResult result = this.decoder.flush(this.cbuf);
len += handleDecodingResult(result, charbuffer, bbuf);
- this.cbuf.clear();
+ ((Buffer)(this.cbuf)).clear();
return len;
}
@@ -380,7 +381,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.10/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java 2017-05-12 09:14:53.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore/src/main/java-deprecated/org/apache/http/impl/io/AbstractSessionOutputBuffer.java 2019-03-13 09:44:13.614449039 +0100
@@ -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.10/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java 2017-09-03 13:21:05.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/examples/org/apache/http/examples/nio/ElementalEchoServer.java 2019-03-13 09:50:53.600493731 +0100
@@ -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.10/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java 2017-09-03 13:21:05.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/examples/org/apache/http/examples/nio/NHttpReverseProxy.java 2019-03-13 09:53:52.393418469 +0100
@@ -30,6 +30,7 @@
import java.io.InterruptedIOException;
import java.net.InetSocketAddress;
import java.net.URI;
+import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -343,8 +344,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;
@@ -555,7 +556,7 @@
this.httpExchange.setOriginIOControl(ioctrl);
// 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.10/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentDecoder.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentDecoder.java 2019-03-13 10:07:11.833553436 +0100
@@ -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;
@@ -120,9 +121,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.10/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/AbstractContentEncoder.java 2019-03-13 10:08:17.497898152 +0100
@@ -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.10/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java 2019-03-13 10:04:27.556703765 +0100
@@ -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.10/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionInputBufferImpl.java 2019-03-13 10:36:24.146708469 +0100
@@ -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;
@@ -221,9 +222,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;
} else {
dst.put(this.buffer);
@@ -249,9 +250,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);
}
@@ -302,7 +303,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
@@ -314,7 +315,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));
@@ -335,12 +336,12 @@
result.throwException();
}
if (result.isOverflow()) {
- this.charbuffer.flip();
+ ((Buffer)(this.buffer)).flip();
linebuffer.append(
this.charbuffer.array(),
this.charbuffer.position(),
this.charbuffer.remaining());
- this.charbuffer.clear();
+ ((Buffer)(this.charbuffer)).clear();
}
if (result.isUnderflow()) {
break;
@@ -349,7 +350,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(
@@ -359,7 +360,7 @@
}
}
- this.buffer.limit(origLimit);
+ ((Buffer)(this.buffer)).limit(origLimit);
// discard LF if found
int l = linebuffer.length();
--- httpcomponents-core-4.4.10/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionOutputBufferImpl.java 2019-03-13 10:30:57.585039770 +0100
@@ -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;
@@ -243,7 +244,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.10/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/entity/EntityAsyncContentProducer.java 2019-03-13 10:13:33.467573632 +0100
@@ -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.10/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/entity/NByteArrayEntity.java 2019-03-13 10:17:13.516740495 +0100
@@ -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.10/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/entity/NStringEntity.java 2019-03-13 10:18:25.637122928 +0100
@@ -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.10/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/protocol/NullRequestConsumer.java 2019-03-13 10:11:01.842769659 +0100
@@ -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 ioctrl) throws IOException {
int lastRead;
do {
- this.buffer.clear();
+ ((Buffer)(this.buffer)).clear();
lastRead = decoder.read(this.buffer);
} while (lastRead > 0);
}
--- httpcomponents-core-4.4.10/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java 2018-06-26 14:35:43.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/reactor/ssl/SSLIOSession.java 2019-03-13 10:23:52.638856850 +0100
@@ -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;
@@ -312,7 +313,7 @@
final ByteBuffer inPlainBuf = this.inPlain.acquire();
// Perform operations
- inEncryptedBuf.flip();
+ ((Buffer)inEncryptedBuf).flip();
result = doUnwrap(inEncryptedBuf, inPlainBuf);
inEncryptedBuf.compact();
@@ -421,7 +422,7 @@
final ByteBuffer outEncryptedBuf = this.outEncrypted.acquire();
// Perform operation
- outEncryptedBuf.flip();
+ ((Buffer)outEncryptedBuf).flip();
final int bytesWritten = this.session.channel().write(outEncryptedBuf);
outEncryptedBuf.compact();
@@ -458,7 +459,7 @@
final ByteBuffer inPlainBuf = this.inPlain.acquire();
// Perform operations
- inEncryptedBuf.flip();
+ ((Buffer)inEncryptedBuf).flip();
final SSLEngineResult result = doUnwrap(inEncryptedBuf, inPlainBuf);
inEncryptedBuf.compact();
@@ -579,7 +580,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.10/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java 2018-02-16 15:33:59.000000000 +0100
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java/org/apache/http/nio/util/ExpandableBuffer.java 2019-03-13 10:28:16.808218211 +0100
@@ -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.10/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/NHttpEntityWrapper.java 2019-03-13 10:01:50.723892601 +0100
@@ -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 ioctrl) 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.10/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/entity/SkipContentListener.java 2019-03-13 10:02:44.656171552 +0100
@@ -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 ioctrl) throws IOException {
int lastRead;
do {
- buffer.clear();
+ ((Buffer)buffer).clear();
lastRead = decoder.read(buffer);
} while (lastRead > 0);
}
--- httpcomponents-core-4.4.10/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java 2017-05-10 09:30:47.000000000 +0200
+++ httpcomponents-core-4.4.10.new/httpcore-nio/src/main/java-deprecated/org/apache/http/nio/protocol/NullNHttpEntity.java 2019-03-13 10:00:53.319595690 +0100
@@ -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 ioctrl) throws IOException {
int lastRead;
do {
- buffer.clear();
+ ((Buffer)buffer).clear();
lastRead = decoder.read(buffer);
} while (lastRead > 0);
}