Skip to content

Commit c74b8df

Browse files
Bump org.apache.maven.plugins:maven-plugins from 43 to 44 (#361)
* Bump org.apache.maven.plugins:maven-plugins from 43 to 44 Bumps [org.apache.maven.plugins:maven-plugins](https://github.com/apache/maven-parent) from 43 to 44. - [Release notes](https://github.com/apache/maven-parent/releases) - [Commits](https://github.com/apache/maven-parent/commits/v44) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-plugins dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> * fix parent upgrade Signed-off-by: Olivier Lamy <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Olivier Lamy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Olivier Lamy <[email protected]>
1 parent d3fbbda commit c74b8df

File tree

7 files changed

+45
-61
lines changed

7 files changed

+45
-61
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ under the License.
2323
<parent>
2424
<groupId>org.apache.maven.plugins</groupId>
2525
<artifactId>maven-plugins</artifactId>
26-
<version>43</version>
26+
<version>44</version>
2727
<relativePath />
2828
</parent>
2929

@@ -173,6 +173,7 @@ under the License.
173173
<dependency>
174174
<groupId>org.apache.maven.plugin-tools</groupId>
175175
<artifactId>maven-plugin-annotations</artifactId>
176+
<version>3.15.1</version>
176177
<scope>provided</scope>
177178
</dependency>
178179
<dependency>

src/test/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojoTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private JavaSource getJavaSource(String source) {
3333
}
3434

3535
@Test
36-
public void testReplaceLinkTags_noLinkTag() {
36+
public void testReplaceLinkTagsNoLinkTag() {
3737
String comment = "/** @see ConnectException */";
3838
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class NoLinkTag {}";
3939

@@ -45,7 +45,7 @@ public void testReplaceLinkTags_noLinkTag() {
4545
}
4646

4747
@Test
48-
public void testReplaceLinkTags_oneLinkTag() {
48+
public void testReplaceLinkTagsOneLinkTag() {
4949
String comment = "/** {@link ConnectException} */";
5050
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class OneLinkTag {}";
5151

@@ -56,7 +56,7 @@ public void testReplaceLinkTags_oneLinkTag() {
5656
}
5757

5858
@Test
59-
public void testReplaceLinkTags_missingEndBrace() {
59+
public void testReplaceLinkTagsMissingEndBrace() {
6060
String comment = "/** {@link ConnectException */";
6161
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class MissingEndBrace {}";
6262

@@ -67,7 +67,7 @@ public void testReplaceLinkTags_missingEndBrace() {
6767
}
6868

6969
@Test
70-
public void testReplaceLinkTags_spacesAfterLinkTag() {
70+
public void testReplaceLinkTagsSpacesAfterLinkTag() {
7171
String comment = "/** {@link ConnectException} */";
7272
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class SpacesAfterLinkTag {}";
7373

@@ -78,7 +78,7 @@ public void testReplaceLinkTags_spacesAfterLinkTag() {
7878
}
7979

8080
@Test
81-
public void testReplaceLinkTags_spacesAfterClassName() {
81+
public void testReplaceLinkTagsSpacesAfterClassName() {
8282
String comment = "/** {@link ConnectException } */";
8383
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class SpacesAfterClassName {}";
8484

@@ -89,7 +89,7 @@ public void testReplaceLinkTags_spacesAfterClassName() {
8989
}
9090

9191
@Test
92-
public void testReplaceLinkTags_spacesAfterMethod() {
92+
public void testReplaceLinkTagsSpacesAfterMethod() {
9393
String comment = "/** {@link ConnectException#getMessage() } */";
9494
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class SpacesAfterMethod {}";
9595

@@ -100,7 +100,7 @@ public void testReplaceLinkTags_spacesAfterMethod() {
100100
}
101101

102102
@Test
103-
public void testReplaceLinkTags_containingHash() {
103+
public void testReplaceLinkTagsContainingHash() {
104104
String comment = "/** {@link ConnectException#getMessage()} */";
105105
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class ContainingHashes {}";
106106

@@ -111,7 +111,7 @@ public void testReplaceLinkTags_containingHash() {
111111
}
112112

113113
@Test
114-
public void testReplaceLinkTags_followedByHash() {
114+
public void testReplaceLinkTagsFollowedByHash() {
115115
String comment = "/** {@link ConnectException} ##important## */";
116116
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class FollowedByHash {}";
117117

@@ -122,7 +122,7 @@ public void testReplaceLinkTags_followedByHash() {
122122
}
123123

124124
@Test
125-
public void testReplaceLinkTags_twoLinks() {
125+
public void testReplaceLinkTagsTwoLinks() {
126126
String comment = "/** Use {@link ConnectException} instead of {@link Exception} */";
127127
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class TwoLinks {}";
128128

@@ -134,7 +134,7 @@ public void testReplaceLinkTags_twoLinks() {
134134
}
135135

136136
@Test
137-
public void testReplaceLinkTags_OnlyAnchor() {
137+
public void testReplaceLinkTagsOnlyAnchor() {
138138
String comment = "/** There's a {@link #getClass()} but no setClass() */";
139139
String source = "import java.net.ConnectException;\n" + comment + "\n" + "public class OnlyAnchor {}";
140140

src/test/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojoTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void doExecute() {}
4444
}
4545

4646
@Test
47-
public void testMJAVADOC432_DetectLinksMessages() {
47+
public void testMJAVADOC432DetectLinksMessages() {
4848
Log log = mock(Log.class);
4949
when(log.isErrorEnabled()).thenReturn(true);
5050
mojo.setLog(log);
@@ -69,7 +69,7 @@ public void testMJAVADOC432_DetectLinksMessages() {
6969
}
7070

7171
@Test
72-
public void testMJAVADOC527_DetectLinksRecursion() {
72+
public void testMJAVADOC527DetectLinksRecursion() {
7373
Log log = mock(Log.class);
7474
when(log.isErrorEnabled()).thenReturn(true);
7575
mojo.setLog(log);

src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class AggregatorJavadocReportTest extends AbstractMojoTestCase {
4141
private static final char LINE_SEPARATOR = ' ';
4242

4343
/** flag to copy repo only one time */
44-
private static boolean TEST_REPO_CREATED = false;
44+
private static boolean testRepoCreated = false;
4545

4646
private File unit;
4747

@@ -88,7 +88,7 @@ private JavadocReport lookupMojo(File testPom) throws Exception {
8888
* @throws IOException if any
8989
*/
9090
private void createTestRepo() throws IOException {
91-
if (TEST_REPO_CREATED) {
91+
if (testRepoCreated) {
9292
return;
9393
}
9494

@@ -148,7 +148,7 @@ private void createTestRepo() throws IOException {
148148
}
149149
}
150150

151-
TEST_REPO_CREATED = true;
151+
testRepoCreated = true;
152152
}
153153

154154
/**

src/test/java/org/apache/maven/plugins/javadoc/FixJavadocMojoTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class FixJavadocMojoTest extends AbstractMojoTestCase {
5353
private static final String EOL = System.getProperty("line.separator");
5454

5555
/** flag to copy repo only one time */
56-
private static boolean TEST_REPO_CREATED = false;
56+
private static boolean testRepoCreated = false;
5757

5858
/** {@inheritDoc} */
5959
@Override
@@ -69,7 +69,7 @@ protected void setUp() throws Exception {
6969
* @throws IOException if any
7070
*/
7171
private void createTestRepo() throws Exception {
72-
if (TEST_REPO_CREATED) {
72+
if (testRepoCreated) {
7373
return;
7474
}
7575

@@ -97,7 +97,7 @@ private void createTestRepo() throws Exception {
9797
}
9898
}
9999

100-
TEST_REPO_CREATED = true;
100+
testRepoCreated = true;
101101
}
102102

103103
/**

src/test/java/org/apache/maven/plugins/javadoc/JavadocUtilTest.java

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
*/
6262
public class JavadocUtilTest extends PlexusTestCase {
6363

64-
public void testParseJavadocVersion_Null() {
64+
public void testParseJavadocVersionNull() {
6565
try {
6666
JavadocUtil.extractJavadocVersion(null);
6767
fail("Not catch null");
@@ -70,7 +70,7 @@ public void testParseJavadocVersion_Null() {
7070
}
7171
}
7272

73-
public void testParseJavadocVersion_EmptyString() {
73+
public void testParseJavadocVersionEmptyString() {
7474
try {
7575
JavadocUtil.extractJavadocVersion("");
7676
fail("Not catch empty version");
@@ -163,7 +163,7 @@ public void testParseJavadocVersion() {
163163
assertEquals("10.0.1", JavadocUtil.extractJavadocVersion(version));
164164
}
165165

166-
public void testParseJavadocMemory_null() {
166+
public void testParseJavadocMemoryNull() {
167167
try {
168168
JavadocUtil.parseJavadocMemory(null);
169169
fail("Not catch null");
@@ -172,7 +172,7 @@ public void testParseJavadocMemory_null() {
172172
}
173173
}
174174

175-
public void testParseJavadocMemory_empty() {
175+
public void testParseJavadocMemoryEmpty() {
176176
try {
177177
JavadocUtil.parseJavadocMemory("");
178178
fail("Not catch null");
@@ -291,35 +291,24 @@ public void testIsValidPackageList() throws Exception {
291291
}
292292

293293
// real proxy
294-
ProxyServer proxyServer = null;
295-
AuthAsyncProxyServlet proxyServlet;
296-
try {
297-
proxyServlet = new AuthAsyncProxyServlet();
298-
proxyServer = new ProxyServer(proxyServlet);
294+
AuthAsyncProxyServlet proxyServlet = new AuthAsyncProxyServlet();
295+
try (ProxyServer proxyServer = new ProxyServer(proxyServlet)) {
299296
proxyServer.start();
300-
301297
settings = new Settings();
302-
303298
assertTrue(JavadocUtil.isValidPackageList(url, settings, true));
304-
305299
try {
306300
JavadocUtil.isValidPackageList(wrongUrl, settings, false);
307301
fail();
308302
} catch (IOException e) {
309303
assertTrue(true);
310304
}
311-
} finally {
312-
if (proxyServer != null) {
313-
proxyServer.stop();
314-
}
315305
}
316306

317307
Map<String, String> authentications = new HashMap<>();
318308
authentications.put("foo", "bar");
319309
// wrong auth
320-
try {
321-
proxyServlet = new AuthAsyncProxyServlet(authentications);
322-
proxyServer = new ProxyServer(proxyServlet);
310+
proxyServlet = new AuthAsyncProxyServlet(authentications);
311+
try (ProxyServer proxyServer = new ProxyServer(proxyServlet)) {
323312
proxyServer.start();
324313

325314
settings = new Settings();
@@ -334,14 +323,11 @@ public void testIsValidPackageList() throws Exception {
334323
fail();
335324
} catch (FileNotFoundException e) {
336325
assertTrue(true);
337-
} finally {
338-
proxyServer.stop();
339326
}
340327

341328
// auth proxy
342-
try {
343-
proxyServlet = new AuthAsyncProxyServlet(authentications);
344-
proxyServer = new ProxyServer(proxyServlet);
329+
proxyServlet = new AuthAsyncProxyServlet(authentications);
330+
try (ProxyServer proxyServer = new ProxyServer(proxyServlet)) {
345331
proxyServer.start();
346332

347333
settings = new Settings();
@@ -362,14 +348,11 @@ public void testIsValidPackageList() throws Exception {
362348
} catch (IOException e) {
363349
assertTrue(true);
364350
}
365-
} finally {
366-
proxyServer.stop();
367351
}
368352

369353
// timeout
370-
try {
371-
proxyServlet = new AuthAsyncProxyServlet(authentications, 3000); // more than 2000, see fetchURL
372-
proxyServer = new ProxyServer(proxyServlet);
354+
proxyServlet = new AuthAsyncProxyServlet(authentications, 3000); // more than 2000, see fetchURL
355+
try (ProxyServer proxyServer = new ProxyServer(proxyServlet)) {
373356
proxyServer.start();
374357

375358
settings = new Settings();
@@ -386,14 +369,11 @@ public void testIsValidPackageList() throws Exception {
386369
fail();
387370
} catch (SocketTimeoutException e) {
388371
assertTrue(true);
389-
} finally {
390-
proxyServer.stop();
391372
}
392373

393374
// nonProxyHosts
394-
try {
395-
proxyServlet = new AuthAsyncProxyServlet(authentications);
396-
proxyServer = new ProxyServer(proxyServlet);
375+
proxyServlet = new AuthAsyncProxyServlet(authentications);
376+
try (ProxyServer proxyServer = new ProxyServer(proxyServlet)) {
397377
proxyServer.start();
398378

399379
settings = new Settings();
@@ -408,8 +388,6 @@ public void testIsValidPackageList() throws Exception {
408388
settings.addProxy(proxy);
409389

410390
assertTrue(JavadocUtil.isValidPackageList(url, settings, true));
411-
} finally {
412-
proxyServer.stop();
413391
}
414392
}
415393

src/test/java/org/apache/maven/plugins/javadoc/ProxyServer.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@
4343
* @author <a href="mailto:[email protected]">Vincent Siveton</a>
4444
* @since 2.6
4545
*/
46-
class ProxyServer {
46+
class ProxyServer implements AutoCloseable {
4747
private Server proxyServer;
4848

4949
private ServerConnector serverConnector;
5050

5151
/**
5252
* @param proxyServlet the wanted auth proxy servlet
5353
*/
54-
public ProxyServer(AuthAsyncProxyServlet proxyServlet) {
54+
ProxyServer(AuthAsyncProxyServlet proxyServlet) {
5555
this(null, 0, proxyServlet);
5656
}
5757

@@ -60,7 +60,7 @@ public ProxyServer(AuthAsyncProxyServlet proxyServlet) {
6060
* @param port the server port
6161
* @param proxyServlet the wanted auth proxy servlet
6262
*/
63-
public ProxyServer(String hostName, int port, AuthAsyncProxyServlet proxyServlet) {
63+
ProxyServer(String hostName, int port, AuthAsyncProxyServlet proxyServlet) {
6464
proxyServer = new Server();
6565

6666
serverConnector = new ServerConnector(proxyServer);
@@ -105,6 +105,11 @@ public void start() throws Exception {
105105
}
106106
}
107107

108+
@Override
109+
public void close() throws Exception {
110+
this.stop();
111+
}
112+
108113
/**
109114
* @throws Exception if any
110115
*/
@@ -126,7 +131,7 @@ static class AuthAsyncProxyServlet extends AsyncProxyServlet {
126131
/**
127132
* Constructor for non authentication servlet.
128133
*/
129-
public AuthAsyncProxyServlet() {
134+
AuthAsyncProxyServlet() {
130135
super();
131136
}
132137

@@ -135,7 +140,7 @@ public AuthAsyncProxyServlet() {
135140
*
136141
* @param authentications a map of user/password
137142
*/
138-
public AuthAsyncProxyServlet(Map<String, String> authentications) {
143+
AuthAsyncProxyServlet(Map<String, String> authentications) {
139144
this();
140145

141146
this.authentications = authentications;
@@ -147,7 +152,7 @@ public AuthAsyncProxyServlet(Map<String, String> authentications) {
147152
* @param authentications a map of user/password
148153
* @param sleepTime a positive time to sleep the service thread (for timeout)
149154
*/
150-
public AuthAsyncProxyServlet(Map<String, String> authentications, long sleepTime) {
155+
AuthAsyncProxyServlet(Map<String, String> authentications, long sleepTime) {
151156
this();
152157
this.authentications = authentications;
153158
this.sleepTime = sleepTime;

0 commit comments

Comments
 (0)