Skip to content

Commit cb9e92f

Browse files
authored
Merge pull request #104 from killbill/copilot/migrate-killbill-commons-integration
migrate to jakarta namespace
2 parents 0b27a59 + 46c0d56 commit cb9e92f

8 files changed

Lines changed: 119 additions & 37 deletions

File tree

pom.xml

Lines changed: 83 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,74 @@
4343
<properties>
4444
<check.fail-spotbugs>true</check.fail-spotbugs>
4545
<check.spotbugs-exclude-filter-file>spotbugs-exclude.xml</check.spotbugs-exclude-filter-file>
46+
<extra-enforcer-rules.version>1.12.0</extra-enforcer-rules.version>
47+
<guice.version>7.0.0</guice.version>
48+
<jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>
49+
<jakarta.inject-api.version>2.0.1</jakarta.inject-api.version>
50+
<jakarta.servlet-api.version>5.0.0</jakarta.servlet-api.version>
51+
<jetty.version>11.0.24</jetty.version>
52+
<killbill-commons.version>0.27.0</killbill-commons.version>
4653
<killbill-platform.version>0.40.13</killbill-platform.version>
54+
<project.build.targetJdk>21</project.build.targetJdk>
4755
<!-- killbill-oss-parent still brings SpotBugs 4.7.2.1, whose ASM stack cannot parse
4856
Java 21 class files. Keep this local override until the parent moves to a
4957
Java-21-capable SpotBugs line. -->
5058
<spotbugs-maven-plugin.version>4.9.8.3</spotbugs-maven-plugin.version>
5159
</properties>
60+
<dependencyManagement>
61+
<dependencies>
62+
<dependency>
63+
<groupId>com.google.inject</groupId>
64+
<artifactId>guice</artifactId>
65+
<version>${guice.version}</version>
66+
</dependency>
67+
<dependency>
68+
<groupId>jakarta.annotation</groupId>
69+
<artifactId>jakarta.annotation-api</artifactId>
70+
<version>${jakarta.annotation-api.version}</version>
71+
</dependency>
72+
<dependency>
73+
<groupId>jakarta.inject</groupId>
74+
<artifactId>jakarta.inject-api</artifactId>
75+
<version>${jakarta.inject-api.version}</version>
76+
</dependency>
77+
<dependency>
78+
<groupId>jakarta.servlet</groupId>
79+
<artifactId>jakarta.servlet-api</artifactId>
80+
<version>${jakarta.servlet-api.version}</version>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.eclipse.jetty</groupId>
84+
<artifactId>jetty-alpn-server</artifactId>
85+
<version>${jetty.version}</version>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.eclipse.jetty</groupId>
89+
<artifactId>jetty-http</artifactId>
90+
<version>${jetty.version}</version>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.eclipse.jetty</groupId>
94+
<artifactId>jetty-io</artifactId>
95+
<version>${jetty.version}</version>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.eclipse.jetty</groupId>
99+
<artifactId>jetty-server</artifactId>
100+
<version>${jetty.version}</version>
101+
</dependency>
102+
<dependency>
103+
<groupId>org.eclipse.jetty</groupId>
104+
<artifactId>jetty-util</artifactId>
105+
<version>${jetty.version}</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>org.eclipse.jetty.http2</groupId>
109+
<artifactId>http2-server</artifactId>
110+
<version>${jetty.version}</version>
111+
</dependency>
112+
</dependencies>
113+
</dependencyManagement>
52114
<dependencies>
53115
<dependency>
54116
<groupId>com.fasterxml.jackson.core</groupId>
@@ -75,10 +137,6 @@
75137
<groupId>com.fasterxml.jackson.datatype</groupId>
76138
<artifactId>jackson-datatype-joda</artifactId>
77139
</dependency>
78-
<dependency>
79-
<groupId>com.github.spotbugs</groupId>
80-
<artifactId>spotbugs-annotations</artifactId>
81-
</dependency>
82140
<dependency>
83141
<groupId>com.google.code.findbugs</groupId>
84142
<artifactId>jsr305</artifactId>
@@ -131,18 +189,6 @@
131189
<groupId>org.joda</groupId>
132190
<artifactId>joda-money</artifactId>
133191
</dependency>
134-
<dependency>
135-
<groupId>org.jooby</groupId>
136-
<artifactId>jooby</artifactId>
137-
</dependency>
138-
<dependency>
139-
<groupId>org.jooby</groupId>
140-
<artifactId>jooby-jackson</artifactId>
141-
</dependency>
142-
<dependency>
143-
<groupId>org.jooby</groupId>
144-
<artifactId>jooby-servlet</artifactId>
145-
</dependency>
146192
<dependency>
147193
<groupId>org.jooq</groupId>
148194
<artifactId>jooq</artifactId>
@@ -228,26 +274,36 @@
228274
<dependency>
229275
<groupId>org.kill-bill.commons</groupId>
230276
<artifactId>killbill-clock</artifactId>
277+
<version>${killbill-commons.version}</version>
231278
<scope>provided</scope>
232279
</dependency>
233280
<dependency>
234281
<groupId>org.kill-bill.commons</groupId>
235282
<artifactId>killbill-embeddeddb-common</artifactId>
283+
<version>${killbill-commons.version}</version>
236284
<scope>test</scope>
237285
</dependency>
238286
<dependency>
239287
<groupId>org.kill-bill.commons</groupId>
240288
<artifactId>killbill-embeddeddb-mysql</artifactId>
289+
<version>${killbill-commons.version}</version>
241290
<scope>test</scope>
242291
</dependency>
243292
<dependency>
244293
<groupId>org.kill-bill.commons</groupId>
245294
<artifactId>killbill-embeddeddb-postgresql</artifactId>
295+
<version>${killbill-commons.version}</version>
246296
<scope>test</scope>
247297
</dependency>
298+
<dependency>
299+
<groupId>org.kill-bill.commons</groupId>
300+
<artifactId>killbill-jooby</artifactId>
301+
<version>${killbill-commons.version}</version>
302+
</dependency>
248303
<dependency>
249304
<groupId>org.kill-bill.commons</groupId>
250305
<artifactId>killbill-utils</artifactId>
306+
<version>${killbill-commons.version}</version>
251307
<scope>provided</scope>
252308
</dependency>
253309
<dependency>
@@ -292,6 +348,17 @@
292348
<artifactId>spotbugs-maven-plugin</artifactId>
293349
<version>${spotbugs-maven-plugin.version}</version>
294350
</plugin>
351+
<plugin>
352+
<groupId>org.apache.maven.plugins</groupId>
353+
<artifactId>maven-enforcer-plugin</artifactId>
354+
<dependencies>
355+
<dependency>
356+
<groupId>org.codehaus.mojo</groupId>
357+
<artifactId>extra-enforcer-rules</artifactId>
358+
<version>${extra-enforcer-rules.version}</version>
359+
</dependency>
360+
</dependencies>
361+
</plugin>
295362
<plugin>
296363
<groupId>org.apache.maven.plugins</groupId>
297364
<artifactId>maven-jar-plugin</artifactId>

spotbugs-exclude.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,19 @@
1818
<FindBugsFilter>
1919
<Bug pattern="EI_EXPOSE_REP"/>
2020
<Bug pattern="EI_EXPOSE_REP2"/>
21+
<!-- Constructor validates and normalizes input URLs, and the checked exception is part of the public API. -->
22+
<Match>
23+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
24+
<Class name="org.killbill.billing.plugin.api.payment.PluginHostedPaymentPageFormDescriptor"/>
25+
</Match>
26+
<!-- Constructor performs DB metadata and schema resolution eagerly, and SQL failures are part of the public API. -->
27+
<Match>
28+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
29+
<Class name="org.killbill.billing.plugin.dao.PluginDao"/>
30+
</Match>
31+
<!-- Constructor builds SSL/HTTP client state eagerly, and security setup failures are part of the public API. -->
32+
<Match>
33+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
34+
<Class name="org.killbill.billing.plugin.util.http.HttpClient"/>
35+
</Match>
2136
</FindBugsFilter>

src/main/java/org/killbill/billing/plugin/api/PluginProperties.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import org.killbill.commons.utils.Strings;
3434
import org.killbill.commons.utils.collect.Iterables;
3535

36-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
37-
3836
public abstract class PluginProperties {
3937

4038
// Last one has precedence
@@ -122,7 +120,6 @@ public static Iterable<PluginProperty> findPluginProperties(final Pattern keyPat
122120
.collect(Collectors.toUnmodifiableSet());
123121
}
124122

125-
@SuppressFBWarnings("WMI_WRONG_MAP_ITERATOR")
126123
public static <K, V> List<PluginProperty> buildPluginProperties(@Nullable final Map<K, V> data) {
127124
if (data == null || data.isEmpty()) {
128125
return Collections.emptyList();

src/main/java/org/killbill/billing/plugin/core/JoobyServlet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
import java.io.IOException;
2222

23-
import javax.servlet.ServletException;
24-
import javax.servlet.ServletRequest;
25-
import javax.servlet.http.HttpServletRequest;
26-
import javax.servlet.http.HttpServletResponse;
23+
import jakarta.servlet.ServletException;
24+
import jakarta.servlet.ServletRequest;
25+
import jakarta.servlet.http.HttpServletRequest;
26+
import jakarta.servlet.http.HttpServletResponse;
2727

2828
import org.jooby.Sse;
2929
import org.jooby.servlet.ServletServletRequest;

src/main/java/org/killbill/billing/plugin/core/PluginServlet.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
import java.util.regex.Pattern;
2727

2828
import javax.annotation.Nullable;
29-
import javax.servlet.ServletRequest;
30-
import javax.servlet.ServletResponse;
31-
import javax.servlet.http.HttpServlet;
32-
import javax.servlet.http.HttpServletRequest;
33-
import javax.servlet.http.HttpServletResponse;
29+
30+
import jakarta.servlet.ServletRequest;
31+
import jakarta.servlet.ServletResponse;
32+
import jakarta.servlet.http.HttpServlet;
33+
import jakarta.servlet.http.HttpServletRequest;
34+
import jakarta.servlet.http.HttpServletResponse;
3435

3536
import org.joda.time.LocalDate;
3637
import org.joda.time.format.DateTimeFormat;

src/main/java/org/killbill/billing/plugin/core/resources/ServletSse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
import java.util.concurrent.CompletableFuture;
2424
import java.util.concurrent.atomic.AtomicBoolean;
2525

26-
import javax.servlet.AsyncContext;
27-
import javax.servlet.ServletRequest;
28-
import javax.servlet.ServletResponse;
29-
import javax.servlet.http.HttpServletResponse;
26+
import jakarta.servlet.AsyncContext;
27+
import jakarta.servlet.ServletRequest;
28+
import jakarta.servlet.ServletResponse;
29+
import jakarta.servlet.http.HttpServletResponse;
3030

3131
import org.jooby.Sse;
3232

src/main/java/org/killbill/billing/plugin/core/resources/jooby/PluginApp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package org.killbill.billing.plugin.core.resources.jooby;
2020

21-
import javax.servlet.http.HttpServlet;
21+
import jakarta.servlet.http.HttpServlet;
2222

2323
import org.jooby.Jooby;
2424
import org.jooby.json.Jackson;

src/main/java/org/killbill/billing/plugin/util/http/SslUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public void checkServerTrusted(final java.security.cert.X509Certificate[] certs,
4242
}
4343
}
4444

45-
private final SSLContext looseTrustManagerSSLContext = looseTrustManagerSSLContext();
46-
47-
private SSLContext looseTrustManagerSSLContext() {
45+
private static SSLContext buildLooseTrustManagerSSLContext() {
4846
try {
4947
final SSLContext sslContext = SSLContext.getInstance("TLS");
5048
sslContext.init(null, new TrustManager[]{new LooseTrustManager()}, new SecureRandom());
@@ -60,11 +58,15 @@ private static class SingletonHolder {
6058
public static final SslUtils instance = new SslUtils();
6159
}
6260

61+
private static class LooseTrustManagerSSLContextHolder {
62+
public static final SSLContext instance = buildLooseTrustManagerSSLContext();
63+
}
64+
6365
public static SslUtils getInstance() {
6466
return SingletonHolder.instance;
6567
}
6668

6769
public SSLContext getSSLContext(final boolean acceptAnyCertificate) throws GeneralSecurityException {
68-
return acceptAnyCertificate ? looseTrustManagerSSLContext : SSLContext.getDefault();
70+
return acceptAnyCertificate ? LooseTrustManagerSSLContextHolder.instance : SSLContext.getDefault();
6971
}
7072
}

0 commit comments

Comments
 (0)