Skip to content

Commit 6c8f770

Browse files
authored
Merge pull request #5769 from senivam/31_merged
merge of the actual 3.0 into the 3.1
2 parents 3963e66 + a564200 commit 6c8f770

File tree

38 files changed

+669
-91
lines changed

38 files changed

+669
-91
lines changed

NOTICE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Javassist Version 3.30.2-GA
7070
* Project: http://www.javassist.org/
7171
* Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
7272

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

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

connectors/netty-connector/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@
101101
</plugins>
102102
</build>
103103
</profile>
104+
<profile>
105+
<id>InaccessibleObjectException</id>
106+
<activation><jdk>[12,)</jdk></activation>
107+
<build>
108+
<plugins>
109+
<plugin>
110+
<groupId>org.apache.maven.plugins</groupId>
111+
<artifactId>maven-surefire-plugin</artifactId>
112+
<configuration>
113+
<argLine>
114+
--add-opens java.base/java.lang=ALL-UNNAMED
115+
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
116+
</argLine>
117+
</configuration>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
</profile>
104122
</profiles>
105123

106124
</project>

connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public void operationComplete(io.netty.util.concurrent.Future<? super Void> futu
436436
};
437437
ch.closeFuture().addListener(closeListener);
438438

439-
final NettyEntityWriter entityWriter = NettyEntityWriter.getInstance(jerseyRequest, ch);
439+
final NettyEntityWriter entityWriter = nettyEntityWriter(jerseyRequest, ch);
440440
switch (entityWriter.getType()) {
441441
case CHUNKED:
442442
HttpUtil.setTransferEncodingChunked(nettyRequest, true);
@@ -524,6 +524,10 @@ public void run() {
524524
}
525525
}
526526

527+
/* package */ NettyEntityWriter nettyEntityWriter(ClientRequest clientRequest, Channel channel) {
528+
return NettyEntityWriter.getInstance(clientRequest, channel);
529+
}
530+
527531
private SSLContext getSslContext(Client client, ClientRequest request) {
528532
Supplier<SSLContext> supplier = request.resolveProperty(ClientProperties.SSL_CONTEXT_SUPPLIER, Supplier.class);
529533
return supplier == null ? client.getSslContext() : supplier.get();

connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/internal/JerseyChunkedInput.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -101,7 +101,15 @@ public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception {
101101

102102
@Override
103103
public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception {
104+
try {
105+
return readChunk0(allocator);
106+
} catch (Exception e) {
107+
closeOnThrowable();
108+
throw e;
109+
}
110+
}
104111

112+
private ByteBuf readChunk0(ByteBufAllocator allocator) throws Exception {
105113
if (!open) {
106114
return null;
107115
}
@@ -143,6 +151,14 @@ public long progress() {
143151
return offset;
144152
}
145153

154+
private void closeOnThrowable() {
155+
try {
156+
close();
157+
} catch (Throwable t) {
158+
// do not throw other throwable
159+
}
160+
}
161+
146162
@Override
147163
public void close() throws IOException {
148164

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

214231
} catch (InterruptedException e) {
232+
closeOnThrowable();
215233
throw new IOException(e);
216234
}
217235
}

0 commit comments

Comments
 (0)