StringBuffer sbLinkSource = new StringBuffer(dir_file.getSubFile(i).getRelDir());
if(s_pkgPrefix != null) {
sbLinkSource.insert(0, s_pkgPrefix);
}
JDFile jdfLinkSource = new JDFile(sbLinkSource.toString(), sCurrentFile + sDOT_HTML);
optr_dbg.writeNoln(true, sDebugPfx + sCurrentFile + " ");
int j = 0;
String sPath = fThis.getPath();
FLRFile flrf = new FLRFile(sPath);
ForLineRetrieval flrJDLC = null;
ForLineRetrieval flrSCL = null;
if(sPath.endsWith(".java")) {
StringBuffer sbJDText = getJDTextFromJava(flrf);
if(jdc_array != null) {
flrJDLC = new FLRString(sbJDText);
}
if(s_relUrlJDToCodeBases != null) {
//Must duplicate sbJDText!!!
flrSCL = new FLRString(new StringBuffer(sbJDText.toString()));
}
} else {
if(jdc_array != null) {
flrJDLC = flrf;
}
if(s_relUrlJDToCodeBases != null) {
if(jdc_array == null) {
flrSCL = new FLRFile(sPath);
} else {
flrSCL = flrf;
}
}
}
final String sJVDC_LNK = "-- JAVADOC LINK: ";
if(jdc_array != null) {
//Analyze Javadoc Link Codes.
try {
i_i ii = uTemplate.addUnqGapNamesToACS(acs_uniqueGapNames,
flrJDLC,
new GapConfig(getJDLinkGapTextStart(), getJDLinkGapTextEnd()),
(new Outputter()));
iUniqueJDLCs += ii.i1;
iAbsoluteJDLCs += ii.i2;
} catch(AssertException ax) {
String sXMsg = ax.toString().substring(ax.toString().indexOf(sERR_2CHOPUP2) + sERR_2CHOPUP2.length());
iErrors++;
optr_dbg.writeNoln("x");
if(b_printXOnTheFly) {
optr_dbg.write(sLS + sJVDC_LNK + acs_uniqueGapNames.getString(j) + sLS + sXMsg);
}
if(!sPreviousFile.equals(sCurrentFile)) {
sb_errors.append(sLS + "SOURCE FILE: " + fThis.getPath() + sLS);
}
sPreviousFile = sCurrentFile;
if(acs_uniqueGapNames.size() > 0) {
sb_errors.append(sJVDC_LNK + acs_uniqueGapNames.getString(j) + sLS);
}
sb_errors.append(sXMsg + sLS);
}
for(; j < acs_uniqueGapNames.size(); j++) {
try {
SplitLinkCode slc = new SplitLinkCode(acs_uniqueGapNames.getString(j));
getRelUrl(slc, jdfLinkSource, jdc_array, b_cibJDLCTarget, b_ignoreIndirectJDLCs);
optr_dbg.writeNoln(sPD);
} catch(AssertException ax) {
String sXMsg = ax.toString().substring(ax.toString().indexOf(sERR_2CHOPUP2) + sERR_2CHOPUP2.length());
iErrors++;
optr_dbg.writeNoln("x");
if(b_printXOnTheFly) {
optr_dbg.write(sLS + sJVDC_LNK + acs_uniqueGapNames.getString(j) + sLS + sXMsg);
}
if(!sPreviousFile.equals(sCurrentFile)) {
sb_errors.append(sLS + "SOURCE FILE: " + fThis.getPath() + sLS);
}
sPreviousFile = sCurrentFile;
if(acs_uniqueGapNames.size() > 0) {
sb_errors.append(sJVDC_LNK + acs_uniqueGapNames.getString(j) + sLS);
}
sb_errors.append(sXMsg + sLS);
}
}
acs_uniqueGapNames.initializeVector();
}
if(jdc_array != null && s_sourceCodeBaseDir != null) {
optr_dbg.writeNoln("|");
}
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);
}