@@ -1200,6 +1200,7 @@ public class Javadoc extends Task {
private String href;
private String href;
private boolean offline = false;
private boolean offline = false;
private File packagelistLoc;
private File packagelistLoc;
private boolean resolveLink = false;
/** Constructor for LinkArguement */
/** Constructor for LinkArguement */
public LinkArgument() {
public LinkArgument() {
@@ -1253,6 +1254,24 @@ public class Javadoc extends Task {
public boolean isLinkOffline() {
public boolean isLinkOffline() {
return offline;
return offline;
}
}
/**
* Sets whether Ant should resolve the link attribute relative
* to the current basedir.
* @param resolve a <code>boolean</code> value
*/
public void setResolveLink(boolean resolve) {
this.resolveLink = resolve;
}
/**
* should Ant resolve the link attribute relative to the
* current basedir?
*/
public boolean shouldResolveLink() {
return resolveLink;
}
}
}
/**
/**
@@ -1756,11 +1775,28 @@ public class Javadoc extends Task {
log("No href was given for the link - skipping",
log("No href was given for the link - skipping",
Project.MSG_VERBOSE);
Project.MSG_VERBOSE);
continue;
continue;
} else {
}
String link = null;
if (la.shouldResolveLink()) {
File hrefAsFile =
getProject().resolveFile(la.getHref());
if (hrefAsFile.exists()) {
try {
link = FILE_UTILS.getFileURL(hrefAsFile)
.toExternalForm();
} catch (MalformedURLException ex) {
// should be impossible
log("Warning: link location was invalid "
+ hrefAsFile, Project.MSG_WARN);
}
}
}
if (link == null) {
// is the href a valid URL
// is the href a valid URL
try {
try {
URL base = new URL("file://.");
URL base = new URL("file://.");
new URL(base, la.getHref());
new URL(base, la.getHref());
link = la.getHref();
} catch (MalformedURLException mue) {
} catch (MalformedURLException mue) {
// ok - just skip
// ok - just skip
log("Link href \"" + la.getHref()
log("Link href \"" + la.getHref()
@@ -1790,7 +1826,7 @@ public class Javadoc extends Task {
toExecute.createArgument()
toExecute.createArgument()
.setValue("-linkoffline");
.setValue("-linkoffline");
toExecute.createArgument()
toExecute.createArgument()
.setValue(la.getHref() );
.setValue(link );
toExecute.createArgument()
toExecute.createArgument()
.setValue(packageListURL);
.setValue(packageListURL);
} catch (MalformedURLException ex) {
} catch (MalformedURLException ex) {
@@ -1804,7 +1840,7 @@ public class Javadoc extends Task {
}
}
} else {
} else {
toExecute.createArgument().setValue("-link");
toExecute.createArgument().setValue("-link");
toExecute.createArgument().setValue(la.getHref() );
toExecute.createArgument().setValue(link );
}
}
}
}
}
}