Skip to content

Commit 46c0d56

Browse files
Copilotxsalefter
andauthored
fix: address spotbugs migration feedback
Agent-Logs-Url: https://github.com/killbill/killbill-plugin-framework-java/sessions/e93f35fb-7445-444e-8336-2f231ac81095 Co-authored-by: xsalefter <510438+xsalefter@users.noreply.github.com>
1 parent 0084951 commit 46c0d56

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

pom.xml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@
137137
<groupId>com.fasterxml.jackson.datatype</groupId>
138138
<artifactId>jackson-datatype-joda</artifactId>
139139
</dependency>
140-
<dependency>
141-
<groupId>com.github.spotbugs</groupId>
142-
<artifactId>spotbugs-annotations</artifactId>
143-
</dependency>
144140
<dependency>
145141
<groupId>com.google.code.findbugs</groupId>
146142
<artifactId>jsr305</artifactId>
@@ -193,11 +189,6 @@
193189
<groupId>org.joda</groupId>
194190
<artifactId>joda-money</artifactId>
195191
</dependency>
196-
<dependency>
197-
<groupId>org.kill-bill.commons</groupId>
198-
<artifactId>killbill-jooby</artifactId>
199-
<version>${killbill-commons.version}</version>
200-
</dependency>
201192
<dependency>
202193
<groupId>org.jooq</groupId>
203194
<artifactId>jooq</artifactId>
@@ -304,6 +295,11 @@
304295
<version>${killbill-commons.version}</version>
305296
<scope>test</scope>
306297
</dependency>
298+
<dependency>
299+
<groupId>org.kill-bill.commons</groupId>
300+
<artifactId>killbill-jooby</artifactId>
301+
<version>${killbill-commons.version}</version>
302+
</dependency>
307303
<dependency>
308304
<groupId>org.kill-bill.commons</groupId>
309305
<artifactId>killbill-utils</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/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)