boolean cyclicLink = false;
String cssPath = PathUtils.clean(((newPath.length() > 0 && newPath.charAt(0) != '/') ? "/" :
"") + newPath + replaceInfo.text);
for (FragmentDescriptor dep : deps)
if (dep instanceof ExternalFragment) {
ExternalFragment ef = (ExternalFragment) dep;
if (ef.getFilePath() != null && ef.getFilePath().equals(cssPath)) {
cyclicLink = true;
break;
}
}
if (cyclicLink) {
logger.error("Found cyclic link!!!!");
start = replaceInfo.end;
continue;
}
boolean addFile = true;
if (settings.isIgnoreMissedFiles() && !(new File(request.getRealPath(cssPath))).exists()) {
logger.warn(MessageFormat.format("File {0} not found, ignored", cssPath));
addFile = false;
}
if (addFile) {
String filename;
if (replaceInfo.text.startsWith("/"))
filename = replaceInfo.text;
else filename = cssPath;
FragmentDescriptor imp = new ExternalFragment(filename);
deps.add(imp);
sb.append(handle(imp, request, settings, deps));
}
}
start = replaceInfo.end;