GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [MJAVADOC-680] JDK 16+: Error fetching link: ...\target\javadoc-bundl… · apache/maven-javadoc-plugin@d770460

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • it/projects/MJAVADOC-580_detectLinks
      • verify.groovy
    • main/java/org/apache/maven/plugins/javadoc
      • AbstractJavadocMojo.java
    • test/java/org/apache/maven/plugins/javadoc
      • JavadocReportTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/it/projects/MJAVADOC-580_detectLinks/verify.groovy‎

Copy file name to clipboardExpand all lines: src/it/projects/MJAVADOC-580_detectLinks/verify.groovy
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,15 @@
1717
* under the License.
1818
*/
1919

20-
def buildLog = new File(basedir,'build.log')
21-
assert buildLog.readLines().any{ it ==~ /\[DEBUG\] Found Java API link: .*\/javase\/\d+\/docs\/api\// }
20+
def javaVersion = System.getProperty( 'java.specification.version' )
21+
22+
if ( javaVersion.startsWith('1.') || Integer.parseInt(javaVersion) < 16 )
23+
{
24+
def buildLog = new File(basedir,'build.log')
25+
assert buildLog.readLines().any{ it ==~ /\[DEBUG\] Found Java API link: .*\/javase\/\d+\/docs\/api\// }
26+
}
27+
else
28+
{
29+
def barHtml = new File(basedir,'target/site/apidocs/foo/Bar.html')
30+
assert barHtml.text =~ /<a href="https:[^"]+Object.html"/
31+
}
Collapse file

‎src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6596,6 +6596,10 @@ else if ( source != null && !source.isEmpty() )
65966596
{
65976597
javaApiLink = javaApiLinks.getProperty( javaApiKey );
65986598
}
6599+
else if ( javaApiversion.isAtLeast( "16" ) )
6600+
{
6601+
javaApiLink = null; // JDK-8216497
6602+
}
65996603
else if ( javaApiversion.isAtLeast( "11" ) )
66006604
{
66016605
javaApiLink =
Collapse file

‎src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java‎

Copy file name to clipboardExpand all lines: src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java
+29-22Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -257,35 +257,42 @@ public void testDefaultConfiguration()
257257
Path generatedFile = apidocs.resolve( appHtml );
258258
assertThat( generatedFile ).exists();
259259

260-
// only test when URL can be reached
261-
262-
String url = Objects.requireNonNull( mojo.getDefaultJavadocApiLink() ).getUrl();
263-
HttpURLConnection connection = (HttpURLConnection) new URL( url ).openConnection();
264-
connection.setRequestMethod( "HEAD" );
265-
try
260+
if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "16" ) )
266261
{
267-
if ( connection.getResponseCode() == HttpURLConnection.HTTP_OK )
262+
String url = Objects.requireNonNull( mojo.getDefaultJavadocApiLink() ).getUrl();
263+
HttpURLConnection connection = (HttpURLConnection) new URL( url ).openConnection();
264+
connection.setRequestMethod( "HEAD" );
265+
try
268266
{
269-
try
267+
// only test when URL can be reached
268+
if ( connection.getResponseCode() == HttpURLConnection.HTTP_OK )
270269
{
271-
assumeThat( connection.getURL().toString(), is( url ) );
272-
273-
// https://bugs.openjdk.java.net/browse/JDK-8216497
274-
MatcherAssert.assertThat( url + " available, but " + appHtml + " is missing link to java.lang.Object",
275-
new String( Files.readAllBytes(generatedFile), StandardCharsets.UTF_8 ),
276-
anyOf( containsString( "/docs/api/java/lang/Object.html" ),
277-
containsString( "/docs/api/java.base/java/lang/Object.html" ) ) );
278-
}
279-
catch ( AssumptionViolatedException e )
280-
{
281-
LOGGER.warn( "ignoring defaultAPI check: {}", e.getMessage() );
270+
try
271+
{
272+
assumeThat( connection.getURL().toString(), is( url ) );
273+
274+
// https://bugs.openjdk.java.net/browse/JDK-8216497
275+
MatcherAssert.assertThat( url + " available, but " + appHtml + " is missing link to java.lang.Object",
276+
new String( Files.readAllBytes(generatedFile), StandardCharsets.UTF_8 ),
277+
anyOf( containsString( "/docs/api/java/lang/Object.html" ),
278+
containsString( "/docs/api/java.base/java/lang/Object.html" ) ) );
279+
}
280+
catch ( AssumptionViolatedException e )
281+
{
282+
LOGGER.warn( "ignoring defaultAPI check: {}", e.getMessage() );
283+
}
282284
}
283285
}
286+
catch (Exception e)
287+
{
288+
LOGGER.error("error connecting to javadoc URL: {}", url);
289+
throw e;
290+
}
284291
}
285-
catch (Exception e)
292+
else
286293
{
287-
LOGGER.error("error connecting to javadoc URL: {}", url);
288-
throw e;
294+
MatcherAssert.assertThat( new String( Files.readAllBytes(generatedFile), StandardCharsets.UTF_8 ),
295+
containsString( "/docs/api/java.base/java/lang/Object.html" ) );
289296
}
290297

291298
assertThat( apidocs.resolve( "def/configuration/AppSample.html" )).exists();

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.