Skip to content

Commit

Permalink
Merge branch '3.x' into 2968
Browse files Browse the repository at this point in the history
  • Loading branch information
jknack committed Jun 6, 2024
2 parents 8528680 + 4aba526 commit 2e6a619
Show file tree
Hide file tree
Showing 62 changed files with 127 additions and 73 deletions.
2 changes: 1 addition & 1 deletion jooby/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>jooby-project</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-apt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-avaje-inject/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-avaje-jsonb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-awssdk-v1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions modules/jooby-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<groupId>io.jooby</groupId>
<artifactId>jooby-bom</artifactId>
<packaging>pom</packaging>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
<description>Jooby (Bill of Materials)</description>
<url>https://jooby.io</url>

Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-caffeine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-camel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-commons-email/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-conscrypt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-ebean/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-flyway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-freemarker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-gradle-setup/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-graphiql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-graphql-playground/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-graphql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-guice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-handlebars/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-hibernate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-hikari/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-jasypt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-jdbi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
8 changes: 7 additions & 1 deletion modules/jooby-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -52,6 +52,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ private Context sendStreamInternal(@NonNull InputStream in) {

@NonNull @Override
public Context send(@NonNull FileChannel file) {
try (FileChannel channel = file) {
response.getHeaders().put(CONTENT_LENGTH, channel.size());
try {
response.getHeaders().put(CONTENT_LENGTH, file.size());
return sendStreamInternal(Channels.newInputStream(file));
} catch (IOException x) {
throw SneakyThrows.propagate(x);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby.internal.jetty;

import static org.eclipse.jetty.http.HttpHeader.CONTENT_LENGTH;
import static org.mockito.Mockito.*;

import java.io.IOException;
import java.nio.channels.FileChannel;

import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.util.Callback;
import org.junit.jupiter.api.Test;

import io.jooby.Router;

public class Issue34737 {

@Test
public void shouldNotCloseFileChannel() throws IOException {
var fileSize = 871L;
var uri = mock(HttpURI.class);
var request = mock(Request.class);
when(request.getMethod()).thenReturn("GET");
when(request.getHttpURI()).thenReturn(uri);

var headers = mock(HttpFields.Mutable.class);

var response = mock(Response.class);
when(response.getHeaders()).thenReturn(headers);
var callback = mock(Callback.class);
var router = mock(Router.class);
var channel = mock(FileChannel.class);
when(channel.size()).thenReturn(fileSize);

var context = new JettyContext(request, response, callback, router, 4000, 4000);

context.send(channel);
verify(headers).put(CONTENT_LENGTH, fileSize);
verify(channel, never()).close();
}
}
2 changes: 1 addition & 1 deletion modules/jooby-jstachio/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-jte/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-jwt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-kafka/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-log4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion modules/jooby-logback/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.jooby</groupId>
<artifactId>modules</artifactId>
<version>3.1.3-SNAPSHOT</version>
<version>3.1.4-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit 2e6a619

Please sign in to comment.