Skip to content

Commit bcb4386

Browse files
authored
DRILL-8540: Update Jetty to Version 12 (#3031)
1 parent 8b22702 commit bcb4386

84 files changed

Lines changed: 2027 additions & 914 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
timeout-minutes: 150
3434
strategy:
3535
matrix:
36-
# Java versions to run unit tests
37-
java: [ '11', '17', '21' ]
36+
# Java versions to run unit tests (Jetty 12 requires Java 17+)
37+
java: [ '17', '21' ]
3838
profile: ['default-hadoop']
3939
fail-fast: false
4040
steps:
@@ -79,7 +79,7 @@ jobs:
7979
uses: actions/setup-java@v4
8080
with:
8181
distribution: 'temurin'
82-
java-version: '11'
82+
java-version: '17'
8383
cache: 'maven'
8484
# Caches built protobuf library
8585
- name: Cache protobufs

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ jobs:
5959
- name: Checkout repository
6060
uses: actions/checkout@v4
6161

62+
- name: Setup java
63+
uses: actions/setup-java@v4
64+
with:
65+
distribution: 'temurin'
66+
java-version: '17'
67+
cache: 'maven'
68+
6269
# Initializes the CodeQL tools for scanning.
6370
- name: Initialize CodeQL
6471
uses: github/codeql-action/init@v2

.github/workflows/publish-snapshot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131
steps:
3232
- name: Checkout
3333
uses: actions/checkout@v4
34+
- name: Setup java
35+
uses: actions/setup-java@v4
36+
with:
37+
distribution: 'temurin'
38+
java-version: '17'
39+
cache: 'maven'
3440
- name: Cache Maven Repository
3541
uses: actions/cache@v4
3642
with:

contrib/storage-hbase/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@
149149
<includes>
150150
<!-- Needed by HBase test cluster -->
151151
<include>commons-logging:commons-logging:*:jar:provided</include>
152+
<!-- Needed by HBase mini cluster (test scope) for embedded Jetty/web server -->
153+
<include>javax.servlet:*</include>
154+
<include>javax.servlet.jsp:*</include>
155+
<include>javax.websocket:*</include>
156+
<include>org.eclipse.jetty:*</include>
157+
<include>org.eclipse.jetty.websocket:*</include>
152158
</includes>
153159
</bannedDependencies>
154160
</rules>
@@ -254,6 +260,14 @@
254260
<groupId>commons-codec</groupId>
255261
<artifactId>commons-codec</artifactId>
256262
</exclusion>
263+
<exclusion>
264+
<groupId>javax.servlet</groupId>
265+
<artifactId>javax.servlet-api</artifactId>
266+
</exclusion>
267+
<exclusion>
268+
<groupId>javax.servlet.jsp</groupId>
269+
<artifactId>jsp-api</artifactId>
270+
</exclusion>
257271
</exclusions>
258272
</dependency>
259273
</dependencies>

contrib/storage-hive/core/pom.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@
126126
<groupId>commons-httpclient</groupId>
127127
<artifactId>commons-httpclient</artifactId>
128128
</exclusion>
129+
<exclusion>
130+
<groupId>javax.servlet</groupId>
131+
<artifactId>javax.servlet-api</artifactId>
132+
</exclusion>
133+
<exclusion>
134+
<groupId>javax.servlet.jsp</groupId>
135+
<artifactId>jsp-api</artifactId>
136+
</exclusion>
137+
<exclusion>
138+
<groupId>javax.servlet.jsp</groupId>
139+
<artifactId>javax.servlet.jsp-api</artifactId>
140+
</exclusion>
129141
</exclusions>
130142
</dependency>
131143
<dependency>
@@ -184,6 +196,14 @@
184196
<groupId>ch.qos.reload4j</groupId>
185197
<artifactId>reload4j</artifactId>
186198
</exclusion>
199+
<exclusion>
200+
<groupId>javax.servlet</groupId>
201+
<artifactId>javax.servlet-api</artifactId>
202+
</exclusion>
203+
<exclusion>
204+
<groupId>javax.servlet.jsp</groupId>
205+
<artifactId>jsp-api</artifactId>
206+
</exclusion>
187207
</exclusions>
188208
</dependency>
189209
<dependency>
@@ -200,6 +220,14 @@
200220
<artifactId>reload4j</artifactId>
201221
<groupId>ch.qos.reload4j</groupId>
202222
</exclusion>
223+
<exclusion>
224+
<groupId>javax.servlet</groupId>
225+
<artifactId>javax.servlet-api</artifactId>
226+
</exclusion>
227+
<exclusion>
228+
<groupId>javax.servlet.jsp</groupId>
229+
<artifactId>jsp-api</artifactId>
230+
</exclusion>
203231
</exclusions>
204232
</dependency>
205233
<!-- Used by complex types tests for loading nested data -->
@@ -293,6 +321,18 @@
293321
<groupId>com.zaxxer</groupId>
294322
<artifactId>HikariCP-java7</artifactId>
295323
</exclusion>
324+
<exclusion>
325+
<groupId>javax.servlet</groupId>
326+
<artifactId>javax.servlet-api</artifactId>
327+
</exclusion>
328+
<exclusion>
329+
<groupId>javax.servlet.jsp</groupId>
330+
<artifactId>jsp-api</artifactId>
331+
</exclusion>
332+
<exclusion>
333+
<groupId>javax.servlet.jsp</groupId>
334+
<artifactId>javax.servlet.jsp-api</artifactId>
335+
</exclusion>
296336
</exclusions>
297337
</dependency>
298338

contrib/storage-hive/hive-exec-shade/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
<groupId>org.codehaus.jackson</groupId>
121121
<artifactId>jackson-xc</artifactId>
122122
</exclusion>
123+
<exclusion>
124+
<groupId>javax.servlet</groupId>
125+
<artifactId>javax.servlet-api</artifactId>
126+
</exclusion>
127+
<exclusion>
128+
<groupId>javax.servlet.jsp</groupId>
129+
<artifactId>jsp-api</artifactId>
130+
</exclusion>
123131
</exclusions>
124132
</dependency>
125133
</dependencies>

contrib/storage-http/src/test/java/org/apache/drill/exec/store/http/TestHttpUDFWithAliases.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import org.junit.BeforeClass;
4343
import org.junit.Test;
4444

45-
import java.io.IOException;
4645
import java.nio.charset.StandardCharsets;
4746
import java.util.HashMap;
4847
import java.util.Map;
@@ -62,16 +61,21 @@ public class TestHttpUDFWithAliases extends ClusterTest {
6261

6362
private static AliasRegistry storageAliasesRegistry;
6463
private static AliasRegistry tableAliasesRegistry;
65-
private static final int MOCK_SERVER_PORT = 47778;
6664
private static String TEST_JSON_PAGE1;
67-
private static final String DUMMY_URL = "http://localhost:" + MOCK_SERVER_PORT;
65+
private static MockWebServer server;
66+
private static String mockServerUrl;
6867

6968
@BeforeClass
7069
public static void setUpBeforeClass() throws Exception {
7170

7271
TEST_JSON_PAGE1 = Files.asCharSource(DrillFileUtils.getResourceAsFile("/data/p1.json"),
7372
StandardCharsets.UTF_8).read();
7473

74+
// Start MockWebServer with dynamic port allocation
75+
server = new MockWebServer();
76+
server.start(0); // Use port 0 for dynamic allocation
77+
mockServerUrl = server.url("/").toString().replaceAll("/$", "");
78+
7579
cluster = ClusterFixture.bareBuilder(dirTestWatcher)
7680
.configProperty(ExecConstants.USER_AUTHENTICATION_ENABLED, true)
7781
.configProperty(ExecConstants.IMPERSONATION_ENABLED, true)
@@ -106,7 +110,7 @@ public static void setUpBeforeClass() throws Exception {
106110
.build();
107111

108112
HttpApiConfig basicJson = HttpApiConfig.builder()
109-
.url(String.format("%s/json", DUMMY_URL))
113+
.url(String.format("%s/json", mockServerUrl))
110114
.method("get")
111115
.jsonOptions(jsonOptions)
112116
.requireTail(false)
@@ -131,7 +135,7 @@ public void testSeveralRowsAndRequestsAndPublicStorageAlias() throws Exception {
131135
storageAliasesRegistry.getPublicAliases().put("`foobar`", "`local`", false);
132136

133137
String sql = "SELECT http_request('foobar.basicJson', `col1`) as data FROM cp.`/data/p4.json`";
134-
try (MockWebServer server = startServer()) {
138+
try {
135139
server.enqueue(new MockResponse().setResponseCode(200).setBody(TEST_JSON_PAGE1));
136140
server.enqueue(new MockResponse().setResponseCode(200).setBody(TEST_JSON_PAGE1));
137141

@@ -161,8 +165,7 @@ public void testSeveralRowsAndRequestsAndPublicStorageAlias() throws Exception {
161165
@Test
162166
public void testSeveralRowsAndRequestsAndUserStorageAlias() throws Exception {
163167
String sql = "SELECT http_request('foobar.basicJson', `col1`) as data FROM cp.`/data/p4.json`";
164-
try (MockWebServer server = startServer()) {
165-
168+
try {
166169
ClientFixture client = cluster.clientBuilder()
167170
.property(DrillProperties.USER, TEST_USER_2)
168171
.property(DrillProperties.PASSWORD, TEST_USER_2_PASSWORD)
@@ -203,7 +206,7 @@ public void testSeveralRowsAndRequestsAndPublicTableAlias() throws Exception {
203206
tableAliasesRegistry.getPublicAliases().put("`foobar`", "`basicJson`", false);
204207

205208
String sql = "SELECT http_request('local.foobar', `col1`) as data FROM cp.`/data/p4.json`";
206-
try (MockWebServer server = startServer()) {
209+
try {
207210
server.enqueue(new MockResponse().setResponseCode(200).setBody(TEST_JSON_PAGE1));
208211
server.enqueue(new MockResponse().setResponseCode(200).setBody(TEST_JSON_PAGE1));
209212

@@ -233,8 +236,7 @@ public void testSeveralRowsAndRequestsAndPublicTableAlias() throws Exception {
233236
@Test
234237
public void testSeveralRowsAndRequestsAndUserTableAlias() throws Exception {
235238
String sql = "SELECT http_request('local.foobar', `col1`) as data FROM cp.`/data/p4.json`";
236-
try (MockWebServer server = startServer()) {
237-
239+
try {
238240
ClientFixture client = cluster.clientBuilder()
239241
.property(DrillProperties.USER, TEST_USER_2)
240242
.property(DrillProperties.PASSWORD, TEST_USER_2_PASSWORD)
@@ -268,10 +270,4 @@ public void testSeveralRowsAndRequestsAndUserTableAlias() throws Exception {
268270
tableAliasesRegistry.deleteUserAliases(TEST_USER_2);
269271
}
270272
}
271-
272-
public static MockWebServer startServer() throws IOException {
273-
MockWebServer server = new MockWebServer();
274-
server.start(MOCK_SERVER_PORT);
275-
return server;
276-
}
277273
}

0 commit comments

Comments
 (0)