Skip to content

Commit

Permalink
merge of the actual 2.x into the 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
senivam authored Oct 14, 2024
2 parents 25a3cb4 + 62ba351 commit 8f6636c
Show file tree
Hide file tree
Showing 38 changed files with 669 additions and 112 deletions.
4 changes: 2 additions & 2 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Javassist Version 3.30.2-GA
* Project: http://www.javassist.org/
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.

Jackson JAX-RS Providers Version 2.17.2
Jackson JAX-RS Providers Version 2.18.0
* License: Apache License, 2.0
* Project: https://github.com/FasterXML/jackson-jaxrs-providers
* Copyright: (c) 2009-2024 FasterXML, LLC. All rights reserved unless otherwise indicated.
Expand All @@ -95,7 +95,7 @@ KineticJS, v4.7.1
* Project: http://www.kineticjs.com, https://github.com/ericdrowell/KineticJS
* Copyright: Eric Rowell

org.objectweb.asm Version 9.7
org.objectweb.asm Version 9.7.1
* License: Modified BSD (https://asm.ow2.io/license.html)
* Copyright (c) 2000-2011 INRIA, France Telecom. All rights reserved.

Expand Down
18 changes: 18 additions & 0 deletions connectors/netty-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,24 @@
</plugins>
</build>
</profile>
<profile>
<id>InaccessibleObjectException</id>
<activation><jdk>[12,)</jdk></activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public void operationComplete(io.netty.util.concurrent.Future<? super Void> futu
};
ch.closeFuture().addListener(closeListener);

final NettyEntityWriter entityWriter = NettyEntityWriter.getInstance(jerseyRequest, ch);
final NettyEntityWriter entityWriter = nettyEntityWriter(jerseyRequest, ch);
switch (entityWriter.getType()) {
case CHUNKED:
HttpUtil.setTransferEncodingChunked(nettyRequest, true);
Expand Down Expand Up @@ -524,6 +524,10 @@ public void run() {
}
}

/* package */ NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel) {
return NettyEntityWriter.getInstance(clientRequest, channel);
}

private SSLContext getSslContext(Client client, ClientRequest request) {
Supplier<SSLContext> supplier = request.resolveProperty(ClientProperties.SSL_CONTEXT_SUPPLIER, Supplier.class);
return supplier == null ? client.getSslContext() : supplier.get();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -101,7 +101,15 @@ public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception {

@Override
public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception {
try {
return readChunk0(allocator);
} catch (Exception e) {
closeOnThrowable();
throw e;
}
}

private ByteBuf readChunk0(ByteBufAllocator allocator) throws Exception {
if (!open) {
return null;
}
Expand Down Expand Up @@ -143,6 +151,14 @@ public long progress() {
return offset;
}

private void closeOnThrowable() {
try {
close();
} catch (Throwable t) {
// do not throw other throwable
}
}

@Override
public void close() throws IOException {

Expand Down Expand Up @@ -208,10 +224,12 @@ private void write(Provider<ByteBuffer> bufferSupplier) throws IOException {
try {
boolean queued = queue.offer(bufferSupplier.get(), WRITE_TIMEOUT, TimeUnit.MILLISECONDS);
if (!queued) {
closeOnThrowable();
throw new IOException("Buffer overflow.");
}

} catch (InterruptedException e) {
closeOnThrowable();
throw new IOException(e);
}
}
Expand Down
Loading

0 comments on commit 8f6636c

Please sign in to comment.