You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/07/26 14:20:42 UTC

[GitHub] [maven-javadoc-plugin] eolivelli commented on a change in pull request #51: [MJAVADOC-623] - Fall back to downloading element-list

eolivelli commented on a change in pull request #51:
URL: https://github.com/apache/maven-javadoc-plugin/pull/51#discussion_r460533503



##########
File path: src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
##########
@@ -6407,20 +6410,41 @@ else if ( javaApiversion.asMajor().isAtLeast( "9" ) )
         link.setUrl( javaApiLink );
 
         InputStream in = this.getClass().getResourceAsStream( resourceName );
-        if ( in != null )
+        if ( in == null )
         {
-            try ( InputStream closableIS = in )
+            String elementListLink = javaApiLink + "element-list";
+            try
             {
-                // TODO only copy when changed
-                Files.copy( closableIS, javaApiListFile, StandardCopyOption.REPLACE_EXISTING );
+                URL elementListUrl = new URL( elementListLink );
+                String elementListContent = (String) elementListUrl.getContent( new Class<?>[] { String.class } );
+                if ( elementListContent != null )
+                {
+                    in = new ByteArrayInputStream( elementListContent.getBytes( UTF_8 ) );

Review comment:
       Why are you creating one String and one byte[] ?
   What about simply assigning `is` to `elementListUrl.getInputStream` ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org