Fix bug where infinite recursion isn't detected in getNodeHref()

This commit is contained in:
hns 2004-03-09 17:21:10 +00:00
parent a21e6464f6
commit 304c08f8a3

View file

@ -1077,7 +1077,7 @@ public final class Application implements IPathElement, Runnable {
} }
private final void composeHref(Object elem, StringBuffer b, int pathCount) { private final void composeHref(Object elem, StringBuffer b, int pathCount) {
if ((elem == null) || (pathCount > 20)) { if ((elem == null) || (pathCount > 50)) {
return; return;
} }
@ -1091,10 +1091,16 @@ public final class Application implements IPathElement, Runnable {
return; return;
} }
composeHref(getParentElement(elem), b, pathCount++); // recurse to parent element
b.append(UrlEncoded.encode(getElementName(elem))); composeHref(getParentElement(elem), b, ++pathCount);
// append ourselves
String ename = getElementName(elem);
if (ename != null) {
b.append(UrlEncoded.encode(ename));
b.append("/"); b.append("/");
} }
}
/** /**
* Returns the baseURI for Hrefs in this application. * Returns the baseURI for Hrefs in this application.