if(s_sourceCodeBaseDir != null) {
//Analyze source-code links.
while(flrSCL.hasMoreLines()) {
SOBStringBuffer ssb = new SOBStringBuffer(flrSCL.getNextLine());
int iDeletedChars = 0;
int iLink = 0;
while(iLink != -1) {
iLink = ssb.indexOf(s_relUrlJDToCodeBases);
if(iLink == -1) {
continue;
}
String sOrigLink = uSOB.getStringAround(ssb, iLink, "\"", "\"", false, false);
SOBStringBuffer ssbLink = new SOBStringBuffer(sOrigLink);
ssb.delete(0, uSOB.getGSAInfo().i4);
iDeletedChars += uSOB.getGSAInfo().i4;
//Delete as many "../" as there are directory
//parts in jdf_linkSource.
try {
int iDirParts = jdfLinkSource.getPartCount() - 1;
while(iDirParts > 0) {
int iFound = (jdfLinkSource.getPartCount() - 1 - iDirParts);
if(ssbLink.startsWith(s_relUrlJDToCodeBases) || !ssbLink.startsWith("../")) {
throwAX("It is expected that the source-code link starts with " + (jdfLinkSource.getPartCount() - 1) + " instances of '../', followed by s_relUrlJDToCodeBases ('" + s_relUrlJDToCodeBases + "'). " + iFound + " initial '../' " + (iFound==1?"was":"were") + " actually found.");
}
ssbLink.delete(0, 3);
iDirParts--;
}
//Now the relative link from the javadoc and
//source-code base directories must exist at
//the beginning of what remains.
if(!ssbLink.startsWith(s_relUrlJDToCodeBases)) {
int iFound = jdfLinkSource.getPartCount() - 1;
while(ssbLink.startsWith("../") &&
!ssbLink.startsWith(s_relUrlJDToCodeBases)) {
iFound++;
ssbLink.delete(0, 3);
}
if(iFound > (jdfLinkSource.getPartCount() - 1)) {
throwAX("It is expected that the source-code link starts with " + (jdfLinkSource.getPartCount() - 1) + " instances of '../', followed by s_relUrlJDToCodeBases ('" + s_relUrlJDToCodeBases + "'). " + iFound + " initial '../' " + (iFound==1?"was":"were") + " actually found.");
}
throwAX("It is expected that the source-code link starts with " + (jdfLinkSource.getPartCount() - 1) + " instances of '../', followed by s_relUrlJDToCodeBases ('" + s_relUrlJDToCodeBases + "'). The correct amount of '../' were found, but s_relUrlJDToCodeBases does not exist after them.");
}
//It does exist. Delete it.
ssbLink.delete(0, s_relUrlJDToCodeBases.length());
//Now, what remains must be a file that
//actually exists within s_sourceCodeBaseDir.
if(sb_sclReport != null) {
if(!sPreviousFileSCLR.equals(sCurrentFileSCLR)) {
sb_sclReport.append(sLS + jdfLinkSource.getList(sPD) + sLS);
}
sPreviousFileSCLR = sCurrentFileSCLR;
sb_sclReport.append(" " + ssbLink.toString() + sLS);
}
if(!sSLASH.equals(File.separator)) {
uSOB.replaceAll(ssbLink, sSLASH, File.separator);
}
File f = new File(s_sourceCodeBaseDir + ssbLink.toString());
if(!f.exists()) {
throwAX("The target does not exist: '" + f.getPath() + "'.");
}