Author: bodewig
Date: Wed Aug 20 07:44:14 2008
New Revision: 687360

URL: http://svn.apache.org/viewvc?rev=687360&view=rev
Log:
Add a new attribute to javadoc to allow URLs for location of offline links.  PR 
28881.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/CoreTasks/javadoc.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java

Modified: ant/core/trunk/WHATSNEW
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=687360&r1=687359&r2=687360&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Aug 20 07:44:14 2008
@@ -274,6 +274,10 @@
    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
 =============================================
 

Modified: ant/core/trunk/docs/manual/CoreTasks/javadoc.html
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/javadoc.html?rev=687360&r1=687359&r2=687360&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/javadoc.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/javadoc.html Wed Aug 20 07:44:14 2008
@@ -613,7 +613,12 @@
     <td valign="top">packagelistLoc</td>
     <td valign="top">The location to the directory containing the package-list 
file for
                      the external documentation</td>
-    <td align="center" valign="top">Only if the offline attribute is true</td>
+    <td align="center" valign="top" rowspan="2">One of the two if the offline 
attribute is true</td>
+  </tr>
+  <tr>
+    <td valign="top">packagelistURL</td>
+    <td valign="top">The URL of the the directory containing the package-list 
file for
+                     the external documentation</td>
   </tr>
   <tr>
     <td valign="top">resolveLink</td>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: 
http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=687360&r1=687359&r2=687360&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java 
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Wed Aug 
20 07:44:14 2008
@@ -1181,6 +1181,7 @@
         private String href;
         private boolean offline = false;
         private File packagelistLoc;
+        private URL packagelistURL;
         private boolean resolveLink = false;
 
         /** Constructor for LinkArguement */
@@ -1221,6 +1222,22 @@
         }
 
         /**
+         * Set the packetlist location attribute.
+         * @param src an <code>URL</code> 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 <code>boolean</code> value
          */
@@ -1968,7 +1985,9 @@
 
                 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 @@
                                                  + "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 @@
                         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);


Reply via email to