diff --git a/WHATSNEW b/WHATSNEW index d5479e389..049b039b6 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -274,6 +274,10 @@ Other changes: expression. Bugzilla Report 45284 + * The package list location for offline links can now be specified as + an URL. + Bugzilla Report 28881 + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/docs/manual/CoreTasks/javadoc.html b/docs/manual/CoreTasks/javadoc.html index 0ee705dfa..99151ba25 100644 --- a/docs/manual/CoreTasks/javadoc.html +++ b/docs/manual/CoreTasks/javadoc.html @@ -613,7 +613,12 @@ specify multiple occurrences of the arguments.

packagelistLoc The location to the directory containing the package-list file for the external documentation - Only if the offline attribute is true + One of the two if the offline attribute is true + + + packagelistURL + The URL of the the directory containing the package-list file for + the external documentation resolveLink diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 783b56021..15187ea62 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -1181,6 +1181,7 @@ public class Javadoc extends Task { private String href; private boolean offline = false; private File packagelistLoc; + private URL packagelistURL; private boolean resolveLink = false; /** Constructor for LinkArguement */ @@ -1220,6 +1221,22 @@ public class Javadoc extends Task { return packagelistLoc; } + /** + * Set the packetlist location attribute. + * @param src an URL value + */ + public void setPackagelistURL(URL src) { + packagelistURL = src; + } + + /** + * Get the packetList location attribute. + * @return the packetList location attribute. + */ + public URL getPackagelistURL() { + return packagelistURL; + } + /** * Set the offline attribute. * @param offline a boolean value @@ -1968,7 +1985,9 @@ public class Javadoc extends Task { if (la.isLinkOffline()) { File packageListLocation = la.getPackagelistLoc(); - if (packageListLocation == null) { + URL packageListURL = la.getPackagelistURL(); + if (packageListLocation == null + && packageListURL == null) { throw new BuildException("The package list" + " location for link " + la.getHref() @@ -1976,19 +1995,13 @@ public class Javadoc extends Task { + "because the link is " + "offline"); } + if (packageListLocation != null) { File packageListFile = new File(packageListLocation, "package-list"); if (packageListFile.exists()) { try { - String packageListURL = - FILE_UTILS.getFileURL(packageListLocation) - .toExternalForm(); - toExecute.createArgument() - .setValue("-linkoffline"); - toExecute.createArgument() - .setValue(link); - toExecute.createArgument() - .setValue(packageListURL); + packageListURL = + FILE_UTILS.getFileURL(packageListLocation); } catch (MalformedURLException ex) { log("Warning: Package list location was " + "invalid " + packageListLocation, @@ -1998,6 +2011,13 @@ public class Javadoc extends Task { log("Warning: No package list was found at " + packageListLocation, Project.MSG_VERBOSE); } + } + if (packageListURL != null) { + toExecute.createArgument().setValue("-linkoffline"); + toExecute.createArgument().setValue(link); + toExecute.createArgument() + .setValue(packageListURL.toExternalForm()); + } } else { toExecute.createArgument().setValue("-link"); toExecute.createArgument().setValue(link);