conor 02/05/01 05:21:35
Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Javadoc.java
Log:
Handle javadoc links which are not valid by skipping the link
This allows links to be conditional on definition of a property
PR: 1304
Revision Changes Path
No revision
No revision
1.96.2.1 +23 -10
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.96
retrieving revision 1.96.2.1
diff -u -w -u -r1.96 -r1.96.2.1
--- Javadoc.java 30 Apr 2002 11:36:03 -0000 1.96
+++ Javadoc.java 1 May 2002 12:21:35 -0000 1.96.2.1
@@ -58,6 +58,8 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.FilenameFilter;
+import java.net.URL;
+import java.net.MalformedURLException;
import java.util.Locale;
import java.util.Vector;
import java.util.Enumeration;
@@ -1550,20 +1552,31 @@
for (Enumeration e = links.elements(); e.hasMoreElements();)
{
LinkArgument la = (LinkArgument) e.nextElement();
- if (la.getHref() == null) {
- throw new BuildException("Links must provide the URL
"
- + "to the external class "
- + "documentation.");
+ if (la.getHref() == null || la.getHref().length() == 0) {
+ log("No href was given for the link - skipping",
+ Project.MSG_VERBOSE);
+ continue;
+ } else {
+ // is the href a valid URL
+ try {
+ URL base = new URL("file://.");
+ URL testHref = new URL(base, la.getHref());
+ } catch (MalformedURLException mue) {
+ // ok - just skip
+ log("Link href \"" + la.getHref()
+ + "\" is not a valid url - skipping link",
+ Project.MSG_WARN);
+ continue;
}
+ }
+
if (la.isLinkOffline()) {
File packageListLocation = la.getPackagelistLoc();
if (packageListLocation == null) {
throw new BuildException("The package list "
- + " location for link "
- + la.getHref()
- + " must be provided "
- + "because the link is "
+ + " location for link " + la.getHref()
+ + " must be provided because the link is "
+ "offline");
}
File packageList =
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>