Skip to content

Commit bf3fcb9

Browse files
Add forbiddenAPIs Maven plugin to fail the build when
methods relying on default locale are charset are used. Also forbid usage of URL.equals and .hashCode which may resolve host named per DNS lookup.
1 parent 7e24a19 commit bf3fcb9

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,31 @@
173173
<artifactId>maven-surefire-plugin</artifactId>
174174
<version>3.2.5</version>
175175
</plugin>
176+
<plugin>
177+
<groupId>de.thetaphi</groupId>
178+
<artifactId>forbiddenapis</artifactId>
179+
<version>3.10</version>
180+
<configuration>
181+
<!-- if the used Java version is too new, don't fail, just do nothing: -->
182+
<failOnUnsupportedJava>false</failOnUnsupportedJava>
183+
<bundledSignatures>
184+
<bundledSignature>jdk-unsafe</bundledSignature>
185+
<bundledSignature>jdk-deprecated</bundledSignature>
186+
<bundledSignature>jdk-non-portable</bundledSignature>
187+
</bundledSignatures>
188+
<signaturesFiles>
189+
<signaturesFile>src/test/resources/forbidden-apis-signatures.txt</signaturesFile>
190+
</signaturesFiles>
191+
</configuration>
192+
<executions>
193+
<execution>
194+
<goals>
195+
<goal>check</goal>
196+
<goal>testCheck</goal>
197+
</goals>
198+
</execution>
199+
</executions>
200+
</plugin>
176201
</plugins>
177202

178203
<resources>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
java.net.URL#equals(java.lang.Object) @ may trigger a DNS lookup to resolve the host part
2+
java.net.URL#hashCode() @ may trigger a DNS lookup to resolve the host part

0 commit comments

Comments
 (0)