langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java
changeset 46079 059faa5e1267
parent 45417 f7479ee8de69
equal deleted inserted replaced
46078:35994b07ed5e 46079:059faa5e1267
   168 
   168 
   169         return new DocLink(p, "is-external=true", memberName);
   169         return new DocLink(p, "is-external=true", memberName);
   170     }
   170     }
   171 
   171 
   172     /**
   172     /**
       
   173      * Build the extern package list from given URL or the directory path,
       
   174      * as specified with the "-link" flag.
       
   175      * Flag error if the "-link" or "-linkoffline" option is already used.
       
   176      *
       
   177      * @param url        URL or Directory path.
       
   178      * @param reporter   The <code>DocErrorReporter</code> used to report errors.
       
   179      * @return true if successful, false otherwise
       
   180      * @throws DocFileIOException if there is a problem reading a package list file
       
   181      */
       
   182     public boolean link(String url, Reporter reporter) throws DocFileIOException {
       
   183         return link(url, url, reporter, false);
       
   184     }
       
   185 
       
   186     /**
       
   187      * Build the extern package list from given URL or the directory path,
       
   188      * as specified with the "-linkoffline" flag.
       
   189      * Flag error if the "-link" or "-linkoffline" option is already used.
       
   190      *
       
   191      * @param url        URL or Directory path.
       
   192      * @param pkglisturl This can be another URL for "package-list" or ordinary
       
   193      *                   file.
       
   194      * @param reporter   The <code>DocErrorReporter</code> used to report errors.
       
   195      * @return true if successful, false otherwise
       
   196      * @throws DocFileIOException if there is a problem reading a package list file
       
   197      */
       
   198     public boolean link(String url, String pkglisturl, Reporter reporter) throws DocFileIOException {
       
   199         return link(url, pkglisturl, reporter, true);
       
   200     }
       
   201 
       
   202     /*
   173      * Build the extern package list from given URL or the directory path.
   203      * Build the extern package list from given URL or the directory path.
   174      * Flag error if the "-link" or "-linkoffline" option is already used.
   204      * Flag error if the "-link" or "-linkoffline" option is already used.
   175      *
   205      *
   176      * @param url        URL or Directory path.
   206      * @param url        URL or Directory path.
   177      * @param pkglisturl This can be another URL for "package-list" or ordinary
   207      * @param pkglisturl This can be another URL for "package-list" or ordinary
   179      * @param reporter   The <code>DocErrorReporter</code> used to report errors.
   209      * @param reporter   The <code>DocErrorReporter</code> used to report errors.
   180      * @param linkoffline True if -linkoffline is used and false if -link is used.
   210      * @param linkoffline True if -linkoffline is used and false if -link is used.
   181      * @return true if successful, false otherwise
   211      * @return true if successful, false otherwise
   182      * @throws DocFileIOException if there is a problem reading a package list file
   212      * @throws DocFileIOException if there is a problem reading a package list file
   183      */
   213      */
   184     public boolean link(String url, String pkglisturl, Reporter reporter, boolean linkoffline)
   214     private boolean link(String url, String pkglisturl, Reporter reporter, boolean linkoffline)
   185                 throws DocFileIOException {
   215                 throws DocFileIOException {
   186         this.linkoffline = linkoffline;
   216         this.linkoffline = linkoffline;
   187         try {
   217         try {
   188             url = adjustEndFileSeparator(url);
   218             url = adjustEndFileSeparator(url);
   189             if (isUrl(pkglisturl)) {
   219             if (isUrl(pkglisturl)) {
   243         try {
   273         try {
   244             URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
   274             URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
   245             readPackageList(link.openStream(), urlpath, false);
   275             readPackageList(link.openStream(), urlpath, false);
   246         } catch (URISyntaxException | MalformedURLException exc) {
   276         } catch (URISyntaxException | MalformedURLException exc) {
   247             throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
   277             throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
   248         }
   278         } catch (IOException exc) {
   249         catch (IOException exc) {
       
   250             throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
   279             throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
   251         }
   280         }
   252     }
   281     }
   253 
   282 
   254     /**
   283     /**